Skip to content

Commit

Permalink
Reproduction for issue AArnott#33
Browse files Browse the repository at this point in the history
  • Loading branch information
0xced committed Dec 4, 2024
1 parent a16b833 commit d02cb06
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Xunit.SkippableFact.sln
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26228.9
MinimumVisualStudioVersion = 10.0.40219.1
Expand All @@ -24,6 +24,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Xunit.SkippableFact.Tests",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Samples", "samples\Samples.csproj", "{115DBEC6-9D00-4070-82C3-C17D3F508EE0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Issue33", "test\Issue33\Issue33.csproj", "{FEB438DC-E4A3-476C-A7A6-3F57CC88F2DF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -42,6 +44,10 @@ Global
{115DBEC6-9D00-4070-82C3-C17D3F508EE0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{115DBEC6-9D00-4070-82C3-C17D3F508EE0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{115DBEC6-9D00-4070-82C3-C17D3F508EE0}.Release|Any CPU.Build.0 = Release|Any CPU
{FEB438DC-E4A3-476C-A7A6-3F57CC88F2DF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FEB438DC-E4A3-476C-A7A6-3F57CC88F2DF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FEB438DC-E4A3-476C-A7A6-3F57CC88F2DF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FEB438DC-E4A3-476C-A7A6-3F57CC88F2DF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
24 changes: 24 additions & 0 deletions test/Issue33/Issue33.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
<Using Include="Xunit"/>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Xunit.SkippableFact\Xunit.SkippableFact.csproj" />
</ItemGroup>

</Project>
31 changes: 31 additions & 0 deletions test/Issue33/Test.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright (c) Andrew Arnott. All rights reserved.
// Licensed under the Microsoft Public License (Ms-PL). See LICENSE.txt file in the project root for full license information.

using System.Diagnostics.CodeAnalysis;

namespace Issue33;

[SuppressMessage("Style", "IDE0028:Simplify collection initialization", Justification = "How the theory data is initialized is the point of this issue")]
[SuppressMessage("ReSharper", "UseCollectionExpression", Justification = "How the theory data is initialized is the point of this issue")]
public class Test
{
public static TheoryData<IEnumerable<string>> WorkingData() => new() { Array.Empty<string>() };

public static TheoryData<IEnumerable<string>> FailingData() => new() { Enumerable.Empty<string>() };

[SkippableTheory]
[MemberData(nameof(WorkingData))]
public void WorkingTest(IEnumerable<string> ignored)
{
_ = ignored;
throw new SkipException();
}

[SkippableTheory]
[MemberData(nameof(FailingData))]
public void FailingTest(IEnumerable<string> ignored)
{
_ = ignored;
throw new SkipException();
}
}

0 comments on commit d02cb06

Please sign in to comment.