-
-
Notifications
You must be signed in to change notification settings - Fork 754
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/CookieCrumble/src/CookieCrumble.Xunit3/CookieCrumble.Xunit3.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="xunit.v3" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="../CookieCrumble/CookieCrumble.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
9 changes: 9 additions & 0 deletions
9
src/CookieCrumble/src/CookieCrumble.Xunit3/CookieCrumbleXunit3.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace CookieCrumble.Xunit3; | ||
|
||
public static class CookieCrumbleXunit3 | ||
{ | ||
public static void Initialize() | ||
{ | ||
Snapshot.RegisterTestFramework(new Xunit3Framework()); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/CookieCrumble/src/CookieCrumble.Xunit3/Xunit3Framework.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System.Reflection; | ||
using Xunit; | ||
using Xunit.Sdk; | ||
|
||
namespace CookieCrumble.Xunit3; | ||
|
||
public class Xunit3Framework : ITestFramework | ||
{ | ||
public bool IsValidTestMethod(MemberInfo? method) | ||
=> IsFactTestMethod(method) || IsTheoryTestMethod(method); | ||
|
||
private static bool IsFactTestMethod(MemberInfo? method) | ||
=> method?.GetCustomAttributes(typeof(FactAttribute)).Any() ?? false; | ||
|
||
private static bool IsTheoryTestMethod(MemberInfo? method) | ||
=> method?.GetCustomAttributes(typeof(TheoryAttribute)).Any() ?? false; | ||
|
||
public void ThrowTestException(string message) | ||
{ | ||
throw new XunitException(message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters