Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added CookieCrumble.TUnit #7784

Merged
merged 2 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/CookieCrumble/CookieCrumble.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<PackageReference Include="TUnit" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="../CookieCrumble/CookieCrumble.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace CookieCrumble.TUnit;

public static class CookieCrumbleTUnit
{
public static void Initialize()
{
Snapshot.RegisterTestFramework(new TUnitFramework());
}
}
15 changes: 15 additions & 0 deletions src/CookieCrumble/src/CookieCrumble.TUnit/TUnitFramework.cs
Original file line number Diff line number Diff line change
@@ -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);
}
}
Loading