diff --git a/src/CookieCrumble/CookieCrumble.sln b/src/CookieCrumble/CookieCrumble.sln index 295bfb931fe..a156cb8efe3 100644 --- a/src/CookieCrumble/CookieCrumble.sln +++ b/src/CookieCrumble/CookieCrumble.sln @@ -11,6 +11,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CookieCrumble.Fusion", "src EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CookieCrumble.HotChocolate", "src\CookieCrumble.HotChocolate\CookieCrumble.HotChocolate.csproj", "{9B57E4BC-E62A-4B7B-94FB-462C5F92D35B}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CookieCrumble.TUnit", "src\CookieCrumble.TUnit\CookieCrumble.TUnit.csproj", "{CB61556C-4E8D-4B70-9CD8-C9CB254BB423}" +EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CookieCrumble.Xunit", "src\CookieCrumble.Xunit\CookieCrumble.Xunit.csproj", "{CEE25A68-69B5-4CFD-9C35-E82736B1E205}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{EB8F1D90-60D6-48FA-9744-D4180A0E4AC0}" @@ -38,6 +40,10 @@ Global {9B57E4BC-E62A-4B7B-94FB-462C5F92D35B}.Debug|Any CPU.Build.0 = Debug|Any CPU {9B57E4BC-E62A-4B7B-94FB-462C5F92D35B}.Release|Any CPU.ActiveCfg = Release|Any CPU {9B57E4BC-E62A-4B7B-94FB-462C5F92D35B}.Release|Any CPU.Build.0 = Release|Any CPU + {CB61556C-4E8D-4B70-9CD8-C9CB254BB423}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CB61556C-4E8D-4B70-9CD8-C9CB254BB423}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CB61556C-4E8D-4B70-9CD8-C9CB254BB423}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CB61556C-4E8D-4B70-9CD8-C9CB254BB423}.Release|Any CPU.Build.0 = Release|Any CPU {CEE25A68-69B5-4CFD-9C35-E82736B1E205}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CEE25A68-69B5-4CFD-9C35-E82736B1E205}.Debug|Any CPU.Build.0 = Debug|Any CPU {CEE25A68-69B5-4CFD-9C35-E82736B1E205}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -51,6 +57,7 @@ Global {8E71FA9B-8352-4675-A9B4-A934E40AF9E0} = {2465C122-714C-4D0A-A24D-D9C22A25D73A} {E6862862-986B-4A67-8703-49C70051DBDC} = {2465C122-714C-4D0A-A24D-D9C22A25D73A} {9B57E4BC-E62A-4B7B-94FB-462C5F92D35B} = {2465C122-714C-4D0A-A24D-D9C22A25D73A} + {CB61556C-4E8D-4B70-9CD8-C9CB254BB423} = {2465C122-714C-4D0A-A24D-D9C22A25D73A} {CEE25A68-69B5-4CFD-9C35-E82736B1E205} = {2465C122-714C-4D0A-A24D-D9C22A25D73A} {844E7501-7ED6-4548-8E99-D8E50D4F39A4} = {EB8F1D90-60D6-48FA-9744-D4180A0E4AC0} EndGlobalSection diff --git a/src/CookieCrumble/src/CookieCrumble.TUnit/CookieCrumble.TUnit.csproj b/src/CookieCrumble/src/CookieCrumble.TUnit/CookieCrumble.TUnit.csproj new file mode 100644 index 00000000000..b0fe6d17d90 --- /dev/null +++ b/src/CookieCrumble/src/CookieCrumble.TUnit/CookieCrumble.TUnit.csproj @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/CookieCrumble/src/CookieCrumble.TUnit/CookieCrumbleTUnit.cs b/src/CookieCrumble/src/CookieCrumble.TUnit/CookieCrumbleTUnit.cs new file mode 100644 index 00000000000..d179b0e35ad --- /dev/null +++ b/src/CookieCrumble/src/CookieCrumble.TUnit/CookieCrumbleTUnit.cs @@ -0,0 +1,9 @@ +namespace CookieCrumble.TUnit; + +public static class CookieCrumbleTUnit +{ + public static void Initialize() + { + Snapshot.RegisterTestFramework(new TUnitFramework()); + } +} diff --git a/src/CookieCrumble/src/CookieCrumble.TUnit/TUnitFramework.cs b/src/CookieCrumble/src/CookieCrumble.TUnit/TUnitFramework.cs new file mode 100644 index 00000000000..d4839c71258 --- /dev/null +++ b/src/CookieCrumble/src/CookieCrumble.TUnit/TUnitFramework.cs @@ -0,0 +1,15 @@ +using System.Reflection; +using TUnit.Core.Exceptions; + +namespace CookieCrumble.TUnit; + +public class TUnitFramework : ITestFramework +{ + public bool IsValidTestMethod(MemberInfo? method) + => method?.GetCustomAttributes(typeof(TestAttribute)).Any() ?? false; + + public void ThrowTestException(string message) + { + throw new TUnitException(message); + } +}