("webfrontend")
8 | .WithExternalHttpEndpoints()
9 | .WithReference(cache)
10 | .WaitFor(cache)
11 | .WithReference(apiService)
12 | .WaitFor(apiService);
13 |
14 | builder.Build().Run();
15 |
--------------------------------------------------------------------------------
/TUnit.Templates/content/TUnit.Aspire.Starter/ExampleNamespace.AppHost/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft.AspNetCore": "Warning"
6 | }
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/TUnit.Templates/content/TUnit.Aspire.Starter/ExampleNamespace.AppHost/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft.AspNetCore": "Warning",
6 | "Aspire.Hosting.Dcp": "Warning"
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/TUnit.Templates/content/TUnit.Aspire.Starter/ExampleNamespace.TestProject/Models/WeatherForecast.cs:
--------------------------------------------------------------------------------
1 | namespace ExampleNamespace.TestProject.Models
2 | {
3 | record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary)
4 | {
5 | public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/TUnit.Templates/content/TUnit.Aspire.Starter/ExampleNamespace.WebApp/Components/Pages/Counter.razor:
--------------------------------------------------------------------------------
1 | @page "/counter"
2 | @rendermode InteractiveServer
3 |
4 | Counter
5 |
6 | Counter
7 |
8 | Current count: @currentCount
9 |
10 |
11 |
12 | @code {
13 | private int currentCount = 0;
14 |
15 | private void IncrementCount()
16 | {
17 | currentCount++;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/TUnit.Templates/content/TUnit.Aspire.Starter/ExampleNamespace.WebApp/Components/Pages/Home.razor:
--------------------------------------------------------------------------------
1 | @page "/"
2 |
3 | Home
4 |
5 | Hello, world!
6 |
7 | Welcome to your new app.
8 |
--------------------------------------------------------------------------------
/TUnit.Templates/content/TUnit.Aspire.Starter/ExampleNamespace.WebApp/Components/Routes.razor:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/TUnit.Templates/content/TUnit.Aspire.Starter/ExampleNamespace.WebApp/Components/_Imports.razor:
--------------------------------------------------------------------------------
1 | @using System.Net.Http
2 | @using System.Net.Http.Json
3 | @using Microsoft.AspNetCore.Components.Forms
4 | @using Microsoft.AspNetCore.Components.Routing
5 | @using Microsoft.AspNetCore.Components.Web
6 | @using static Microsoft.AspNetCore.Components.Web.RenderMode
7 | @using Microsoft.AspNetCore.Components.Web.Virtualization
8 | @using Microsoft.AspNetCore.OutputCaching
9 | @using Microsoft.JSInterop
10 | @using WebApp
11 | @using WebApp.Components
12 |
--------------------------------------------------------------------------------
/TUnit.Templates/content/TUnit.Aspire.Starter/ExampleNamespace.WebApp/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft.AspNetCore": "Warning"
6 | }
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/TUnit.Templates/content/TUnit.Aspire.Starter/ExampleNamespace.WebApp/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft.AspNetCore": "Warning"
6 | }
7 | },
8 | "AllowedHosts": "*"
9 | }
10 |
--------------------------------------------------------------------------------
/TUnit.Templates/content/TUnit.Aspire.Starter/ExampleNamespace.WebApp/wwwroot/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thomhurst/TUnit/a9411849b3062e1629f841e7e44eeeb487e381b0/TUnit.Templates/content/TUnit.Aspire.Starter/ExampleNamespace.WebApp/wwwroot/favicon.png
--------------------------------------------------------------------------------
/TUnit.Templates/content/TUnit.FSharp/Tests3.fs:
--------------------------------------------------------------------------------
1 | namespace TestProject
2 |
3 | open System
4 | open TUnit.Core
5 |
6 | [)>]
7 | [)>]
8 | type AndEvenMoreTests(dataClass: DataClass) =
9 |
10 | []
11 | member _.HaveFun() =
12 | Console.WriteLine(dataClass)
13 | Console.WriteLine("For more information, check out the documentation")
14 | Console.WriteLine("https://tunit.dev/")
15 |
16 |
--------------------------------------------------------------------------------
/TUnit.Templates/content/TUnit.Playwright/GlobalSetup.cs:
--------------------------------------------------------------------------------
1 | // Here you could define global logic that would affect all tests
2 |
3 | // You can use attributes at the assembly level to apply to all tests in the assembly
4 | [assembly: System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
--------------------------------------------------------------------------------
/TUnit.Templates/content/TUnit.Playwright/Hooks.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 |
3 | namespace TestProject;
4 |
5 | public class Hooks
6 | {
7 | [Before(TestSession)]
8 | public static void InstallPlaywright()
9 | {
10 | if (Debugger.IsAttached)
11 | {
12 | Environment.SetEnvironmentVariable("PWDEBUG", "1");
13 | }
14 |
15 | Microsoft.Playwright.Program.Main(["install"]);
16 | }
17 | }
--------------------------------------------------------------------------------
/TUnit.Templates/content/TUnit.Playwright/TestProject.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | enable
5 | enable
6 | Exe
7 | net8.0
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/TUnit.Templates/content/TUnit.VB/TestProject.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | latest
6 | enable
7 | enable
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/TUnit.Templates/content/TUnit/Data/DataGenerator.cs:
--------------------------------------------------------------------------------
1 | namespace TestProject.Data;
2 |
3 | public class DataGenerator : DataSourceGeneratorAttribute
4 | {
5 | public override IEnumerable> GenerateDataSources(DataGeneratorMetadata dataGeneratorMetadata)
6 | {
7 | yield return () => (1, 1, 2);
8 | yield return () => (1, 2, 3);
9 | yield return () => (4, 5, 9);
10 | }
11 | }
--------------------------------------------------------------------------------
/TUnit.Templates/content/TUnit/TestProject.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | enable
5 | enable
6 | Exe
7 | net8.0
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/TUnit.Templates/content/TUnit/Tests3.cs:
--------------------------------------------------------------------------------
1 | namespace TestProject;
2 |
3 | [ClassDataSource]
4 | [ClassConstructor]
5 | public class AndEvenMoreTests(DataClass dataClass)
6 | {
7 | [Test]
8 | public void HaveFun()
9 | {
10 | Console.WriteLine(dataClass);
11 | Console.WriteLine("For more information, check out the documentation");
12 | Console.WriteLine("https://tunit.dev/");
13 | }
14 | }
--------------------------------------------------------------------------------
/TUnit.TestProject.FSharp/ClassConstructorTest.fs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject
2 |
3 | open TUnit.Core
4 |
5 | [)>]
6 | type ClassConstructorTest(dummyReferenceTypeClass: DummyReferenceTypeClass) =
7 |
8 | member _.DummyReferenceTypeClass = dummyReferenceTypeClass
9 |
10 | []
11 | member _.Test() = ()
12 |
13 |
--------------------------------------------------------------------------------
/TUnit.TestProject.FSharp/DummyReferenceTypeClass.fs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject
2 |
3 | type DummyReferenceTypeClass() = class end
4 |
5 |
--------------------------------------------------------------------------------
/TUnit.TestProject.FSharp/Tests.fs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject.FSharp
2 |
3 | open TUnit.Assertions
4 | open TUnit.Assertions.Extensions
5 | open TUnit.Assertions.FSharp.Operations
6 | open TUnit.Core
7 |
8 | type Tests() =
9 | []
10 | member this.Test() =
11 | printfn "Test method executed"
12 |
13 | #if NETCOREAPP
14 | []
15 | member this.TestAsync() = async {
16 | let result = 1 + 1
17 | do! check (Assert.That(result).IsPositive())
18 | }
19 | #endif
--------------------------------------------------------------------------------
/TUnit.TestProject.Library/BaseTests.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject.Library;
2 |
3 | public abstract class BaseTests
4 | {
5 | [Test]
6 | public void BaseTest()
7 | {
8 | }
9 | }
--------------------------------------------------------------------------------
/TUnit.TestProject.Library/Bugs/1889/BaseTests.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject.Library.Bugs._1889;
2 |
3 | public abstract class BaseTest
4 | {
5 | [Test]
6 | public void Test1()
7 | {
8 | }
9 |
10 | [Test]
11 | [MatrixDataSource]
12 | public void Test2(bool condition)
13 | {
14 | }
15 |
16 | [Test]
17 | [Arguments(false)]
18 | [Arguments(true)]
19 | public void Test3(bool condition)
20 | {
21 | }
22 | }
--------------------------------------------------------------------------------
/TUnit.TestProject.Library/Bugs/1899/BaseClass.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject.Library.Bugs._1899;
2 |
3 | public abstract class BaseClass
4 | {
5 | private int _value;
6 |
7 | [Before(HookType.Test)]
8 | public void Setup()
9 | {
10 | _value = 99;
11 | }
12 |
13 | [Test]
14 | public void Test1()
15 | {
16 | if (_value != 99)
17 | {
18 | throw new Exception("Setup method was not called");
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/TUnit.TestProject.Library/Hooks.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject.Library;
2 |
3 | public class Hooks
4 | {
5 | [Before(Test)]
6 | public void BeforeTests(TestContext testContext)
7 | {
8 | testContext.ObjectBag.Add("BeforeHit", true);
9 | }
10 |
11 | [After(Test)]
12 | public void AfterTests(TestContext testContext)
13 | {
14 | testContext.ObjectBag.Add("AfterHit", true);
15 | }
16 | }
--------------------------------------------------------------------------------
/TUnit.TestProject.Library/Models/Dummy.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject.Library.Models;
2 |
3 | public record Dummy;
--------------------------------------------------------------------------------
/TUnit.TestProject.Library/Models/InitializableClass.cs:
--------------------------------------------------------------------------------
1 | using TUnit.Core.Interfaces;
2 |
3 | namespace TUnit.TestProject.Library.Models;
4 |
5 | public class InitializableClass : IAsyncInitializer
6 | {
7 | public Task InitializeAsync()
8 | {
9 | IsInitialized = true;
10 | return Task.CompletedTask;
11 | }
12 |
13 | public bool IsInitialized { get; private set; }
14 | }
--------------------------------------------------------------------------------
/TUnit.TestProject.Library/Models/ParallelLimit3.cs:
--------------------------------------------------------------------------------
1 | using TUnit.Core.Interfaces;
2 |
3 | namespace TUnit.TestProject.Library.Models;
4 |
5 | public class ParallelLimit3 : IParallelLimit
6 | {
7 | public int Limit => 3;
8 | }
--------------------------------------------------------------------------------
/TUnit.TestProject.Library/Models/SomeAsyncDisposableClass.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject.Library.Models;
2 |
3 | public class SomeAsyncDisposableClass : IAsyncDisposable
4 | {
5 | public bool IsDisposed { get; private set; }
6 |
7 | public int Value => 1;
8 |
9 | public ValueTask DisposeAsync()
10 | {
11 | IsDisposed = true;
12 | return default;
13 | }
14 | }
--------------------------------------------------------------------------------
/TUnit.TestProject.Library/Polyfill/ModuleInitializerAttribute.cs:
--------------------------------------------------------------------------------
1 | // ReSharper disable once CheckNamespace
2 | namespace System.Runtime.CompilerServices;
3 |
4 | [AttributeUsage(AttributeTargets.Method, Inherited = false)]
5 | sealed class ModuleInitializerAttribute : Attribute;
--------------------------------------------------------------------------------
/TUnit.TestProject.Library/ProjectReferenceEnum.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject.Library;
2 |
3 | public enum ProjectReferenceEnum
4 | {
5 | Value1,
6 | Value2
7 | }
--------------------------------------------------------------------------------
/TUnit.TestProject.VB.NET/ClassConstructorTest.vb:
--------------------------------------------------------------------------------
1 | Imports TUnit.Core
2 |
3 |
4 | Public Class ClassConstructorTest
5 |
6 | Public Sub New(dummyReferenceTypeClass As DummyReferenceTypeClass)
7 | Me.DummyReferenceTypeClass = dummyReferenceTypeClass
8 | End Sub
9 |
10 | Public ReadOnly Property DummyReferenceTypeClass As DummyReferenceTypeClass
11 |
12 |
13 | Public Sub Test()
14 | ' Test logic here
15 | End Sub
16 |
17 | End Class
--------------------------------------------------------------------------------
/TUnit.TestProject.VB.NET/DummyReferenceTypeClass.vb:
--------------------------------------------------------------------------------
1 | Public Class DummyReferenceTypeClass
2 |
3 | End Class
4 |
--------------------------------------------------------------------------------
/TUnit.TestProject/AbstractTests/AbstractBaseClass.cs:
--------------------------------------------------------------------------------
1 | using TUnit.Assertions;
2 | using TUnit.Assertions.Extensions;
3 |
4 | namespace TUnit.TestProject.AbstractTests;
5 |
6 | public abstract class AbstractBaseClass
7 | {
8 | [Test]
9 | public async Task AssertClassName()
10 | {
11 | var name = GetName();
12 |
13 | await Assert.That(name).IsEqualTo(GetType().Name, StringComparison.Ordinal);
14 | }
15 |
16 | protected abstract string GetName();
17 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/AbstractTests/ConcreteClass1.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject.AbstractTests;
2 |
3 | [InheritsTests]
4 | public class ConcreteClass1 : AbstractBaseClass
5 | {
6 | protected override string GetName()
7 | {
8 | return "Concrete1";
9 | }
10 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/AbstractTests/ConcreteClass2.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject.AbstractTests;
2 |
3 | [InheritsTests]
4 | public class ConcreteClass2 : ConcreteClass1
5 | {
6 | protected override string GetName()
7 | {
8 | return "ConcreteClass2";
9 | }
10 |
11 | [Test]
12 | public void SecondTest()
13 | {
14 | // Dummy method
15 | }
16 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/ApplicableAttributeTests.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject;
2 |
3 | public class ApplicableAttributeTests
4 | {
5 | [Test, CustomSkip, SomethingElse]
6 | public async Task Test()
7 | {
8 | await Task.CompletedTask;
9 | }
10 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/AsyncDisposableTests.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject;
2 |
3 | public class AsyncDisposableTests : IAsyncDisposable
4 | {
5 | [Test]
6 | public void One()
7 | {
8 |
9 | }
10 |
11 | [Test]
12 | public Task Two()
13 | {
14 | return Task.CompletedTask;
15 | }
16 |
17 | [Test]
18 | public async Task Three()
19 | {
20 | await Task.CompletedTask;
21 | }
22 |
23 | public async ValueTask DisposeAsync()
24 | {
25 | await Task.CompletedTask;
26 | }
27 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/Attributes/SkipMacOSAttribute.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace TUnit.TestProject.Attributes;
4 |
5 | public class SkipMacOSAttribute(string reason) : SkipAttribute(reason)
6 | {
7 | public override Task ShouldSkip(BeforeTestContext context)
8 | {
9 | return Task.FromResult(RuntimeInformation.IsOSPlatform(OSPlatform.OSX));
10 | }
11 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/Attributes/SkipNetFrameworkAttribute.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace TUnit.TestProject.Attributes;
4 |
5 | public class SkipNetFrameworkAttribute(string reason) : SkipAttribute(reason)
6 | {
7 | public override Task ShouldSkip(BeforeTestContext context)
8 | {
9 | return Task.FromResult(RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework"));
10 | }
11 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/AutoDataTests.cs:
--------------------------------------------------------------------------------
1 | using TUnit.TestProject.Attributes;
2 |
3 | namespace TUnit.TestProject;
4 |
5 | public class AutoDataTests
6 | {
7 | [AutoData]
8 | [Test]
9 | public Task Test1(string value1, int value2, double value3, bool value4)
10 | {
11 | return Task.CompletedTask;
12 | }
13 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/BasicTests.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject;
2 |
3 | public class BasicTests
4 | {
5 | [Test]
6 | public void SynchronousTest()
7 | {
8 | // Dummy method
9 | }
10 |
11 | [Test]
12 | public async Task AsynchronousTest()
13 | {
14 | await Task.CompletedTask;
15 | }
16 |
17 | [Test]
18 | public async ValueTask ValueTaskAsynchronousTest()
19 | {
20 | await new ValueTask();
21 | }
22 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/Bugs/1410/SharedFixture.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject.Bugs._1410;
2 |
3 | public class SharedFixture : IDisposable
4 | {
5 | public bool IsDisposed { get; private set; }
6 |
7 | public void Dispose()
8 | {
9 | IsDisposed = true;
10 | }
11 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/Bugs/1432/EnumMemberNamesTests.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject.Bugs._1432;
2 |
3 | public class EnumMemberNamesTests
4 | {
5 | [Test]
6 | [Arguments(nameof(SomeEnum.A))]
7 | [Arguments(nameof(SomeEnum.B))]
8 | [Arguments(nameof(SomeEnum.C))]
9 | public void SomeTest(string value)
10 | {
11 | }
12 |
13 | public enum SomeEnum
14 | {
15 | A, B, C
16 | }
17 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/Bugs/1692/Tests.cs:
--------------------------------------------------------------------------------
1 | using TUnit.Assertions;
2 | using TUnit.Assertions.Extensions;
3 |
4 | namespace TUnit.TestProject.Bugs._1692;
5 |
6 | public class Tests
7 | {
8 | private const string? NullContent = null;
9 |
10 | [Test]
11 | [Arguments(NullContent)]
12 | [Arguments(null)]
13 | public async Task NullTest(string? t) => await Assert.That(t).IsNull();
14 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/Bugs/1889/DerivedTest.cs:
--------------------------------------------------------------------------------
1 | using TUnit.TestProject.Library.Bugs._1889;
2 |
3 | namespace TUnit.TestProject.Bugs._1889;
4 |
5 | [InheritsTests]
6 | public class DerivedTest : BaseTest;
--------------------------------------------------------------------------------
/TUnit.TestProject/Bugs/1899/DerivedTest.cs:
--------------------------------------------------------------------------------
1 | using TUnit.TestProject.Library.Bugs._1899;
2 |
3 | namespace TUnit.TestProject.Bugs._1899;
4 |
5 | [InheritsTests]
6 | public class DerivedTest: BaseClass;
--------------------------------------------------------------------------------
/TUnit.TestProject/Bugs/2083/Tests.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject.Bugs._2083;
2 |
3 | public class Tests
4 | {
5 | [Test]
6 | [Arguments(0)]
7 | [Arguments(byte.MaxValue)]
8 | [Arguments(short.MaxValue)]
9 | [Arguments(char.MaxValue)]
10 | [Arguments(int.MaxValue)]
11 | [Arguments(long.MaxValue)]
12 | public void MyTest(long value)
13 | {
14 | }
15 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/ByteArgumentTests.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject;
2 |
3 | public class ByteArgumentTests
4 | {
5 | [Test]
6 | [Arguments((byte)1)]
7 | public void Normal(byte b)
8 | {
9 | // Dummy method
10 | }
11 |
12 | [Test]
13 | [Arguments((byte)1)]
14 | [Arguments(null)]
15 | public void Nullable(byte? b)
16 | {
17 | // Dummy method
18 | }
19 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/ClassConstructorTest.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject;
2 |
3 | [ClassConstructor]
4 | public class ClassConstructorTest(DummyReferenceTypeClass dummyReferenceTypeClass)
5 | {
6 | public DummyReferenceTypeClass DummyReferenceTypeClass { get; } = dummyReferenceTypeClass;
7 |
8 | [Test]
9 | public void Test()
10 | {
11 | }
12 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/CommonTestData.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject;
2 |
3 | public static class CommonTestData
4 | {
5 | public static List EnumerableInteger()
6 | {
7 | return [1, 2, 3];
8 | }
9 |
10 | public static int One() => 1;
11 | public static int Two() => 2;
12 | public static int Three() => 3;
13 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/ConsoleTests.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject;
2 |
3 | public class ConsoleTests
4 | {
5 | [Test]
6 | public void Write_Source_Gen_Information()
7 | {
8 | Console.WriteLine(TestContext.Current!.TestDetails.TestMethod);
9 | }
10 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/CustomAssertions/ProblemDetailsSourceGenerationContext.cs:
--------------------------------------------------------------------------------
1 | #if NET
2 | using System.Text.Json.Serialization;
3 |
4 | namespace TUnit.TestProject.CustomAssertions;
5 |
6 | [JsonSourceGenerationOptions(WriteIndented = true)]
7 | [JsonSerializable(typeof(ProblemDetails))]
8 | public partial class ProblemDetailsSourceGenerationContext : JsonSerializerContext;
9 | #endif
--------------------------------------------------------------------------------
/TUnit.TestProject/CustomFilteringTests.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject;
2 |
3 | public class CustomFilteringTests
4 | {
5 | [Test, Property("one", "yes")]
6 | public async Task Custom_Filter_One()
7 | {
8 | await Task.CompletedTask;
9 | }
10 |
11 | [Test, Property("one", "no")]
12 | public async Task Custom_Filter_Two()
13 | {
14 | await Task.CompletedTask;
15 | }
16 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/CustomSkipAttribute.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject;
2 |
3 | public class CustomSkipAttribute() : SkipAttribute("Some reason");
--------------------------------------------------------------------------------
/TUnit.TestProject/Data/Blah.txt:
--------------------------------------------------------------------------------
1 | Blah!
--------------------------------------------------------------------------------
/TUnit.TestProject/Data/Zip.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thomhurst/TUnit/a9411849b3062e1629f841e7e44eeeb487e381b0/TUnit.TestProject/Data/Zip.zip
--------------------------------------------------------------------------------
/TUnit.TestProject/DebugAssertFailureTests.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 |
3 | namespace TUnit.TestProject;
4 |
5 | public class DebugAssertFailureTests
6 | {
7 | [Test]
8 | public void Test()
9 | {
10 | var @true = "true";
11 | Trace.Assert(@true is "false", "Some message");
12 | }
13 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/DependsOnAndNotInParallelTests.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject;
2 |
3 | public class DependsOnAndNotInParallelTests
4 | {
5 | [Test, NotInParallel]
6 | public async Task Test1()
7 | {
8 | await Task.Delay(TimeSpan.FromSeconds(5));
9 | }
10 |
11 | [Test, DependsOn(nameof(Test1))]
12 | public async Task Test2()
13 | {
14 | await Task.CompletedTask;
15 | }
16 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/DependsOnTestsWithProceedOnFailure.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject;
2 |
3 | public class DependsOnTestsWithProceedOnFailure
4 | {
5 | [Test]
6 | public void Test1()
7 | {
8 | throw new Exception();
9 | }
10 |
11 | [Test, DependsOn(nameof(Test1), ProceedOnFailure = true)]
12 | public void Test2()
13 | {
14 | }
15 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/DependsOnTestsWithoutProceedOnFailure.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject;
2 |
3 | public class DependsOnTestsWithoutProceedOnFailure
4 | {
5 | [Test]
6 | public void Test1()
7 | {
8 | throw new Exception();
9 | }
10 |
11 | [Test, DependsOn(nameof(Test1))]
12 | public void Test2()
13 | {
14 | }
15 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/DisposableFieldTests.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject;
2 |
3 | public class DisposableFieldTests
4 | {
5 | private Stream? _stream;
6 |
7 | [Before(Test)]
8 | public void Setup()
9 | {
10 | _stream = new MemoryStream();
11 | }
12 |
13 | [After(Test)]
14 | public void Blah()
15 | {
16 | _stream?.Dispose();
17 | }
18 |
19 | [Test]
20 | public void Test1()
21 | {
22 | // Dummy method
23 | }
24 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/DummyReferenceTypeClass.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject;
2 |
3 | public class DummyReferenceTypeClass;
--------------------------------------------------------------------------------
/TUnit.TestProject/DynamicCodeOnlyAttribute.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.CompilerServices;
2 |
3 | namespace TUnit.TestProject;
4 |
5 | public class DynamicCodeOnlyAttribute() : SkipAttribute("This test is only supported when dynamic code is available")
6 | {
7 | public override Task ShouldSkip(BeforeTestContext context)
8 | {
9 | #if NET
10 | return Task.FromResult(!RuntimeFeature.IsDynamicCodeSupported);
11 | #else
12 | return Task.FromResult(false);
13 | #endif
14 | }
15 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/DynamicallyAddedTestsAtRuntimeTests.cs:
--------------------------------------------------------------------------------
1 | #pragma warning disable
2 | namespace TUnit.TestProject;
3 |
4 | public class DynamicallyAddedTestsAtRuntimeTests
5 | {
6 | private static int _testRepeatLimit = 0;
7 |
8 | [Test]
9 | [Arguments(1)]
10 | public void Failure(int i)
11 | {
12 | throw new Exception($"Random reason: {i}");
13 | }
14 |
15 | [After(Test)]
16 | public void CreateRepeatTestIfFailure(TestContext context)
17 | {
18 | // TODO
19 | }
20 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/EnumTests.cs:
--------------------------------------------------------------------------------
1 | using TUnit.TestProject.Attributes;
2 | using TUnit.TestProject.Enums;
3 |
4 | namespace TUnit.TestProject;
5 |
6 | public class EnumTests
7 | {
8 | [EnumGenerator]
9 | [Test]
10 | public void Test(PriorityLevel priorityLevel)
11 | {
12 | }
13 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/Enums/PriorityLevel.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject.Enums;
2 |
3 | public enum PriorityLevel
4 | {
5 | Low,
6 | Medium,
7 | High
8 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/ExperimentalTests.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics.CodeAnalysis;
2 |
3 | namespace TUnit.TestProject;
4 |
5 | public class ExperimentalTests
6 | {
7 | [Experimental("Blah")]
8 | [Test]
9 | public void SynchronousTest()
10 | {
11 | // Dummy method
12 | }
13 |
14 | [Experimental("Blah")]
15 | [Test]
16 | public async Task AsynchronousTest()
17 | {
18 | await Task.CompletedTask;
19 | }
20 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/ExplicitTests.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject;
2 |
3 | [Explicit]
4 | public class ExplicitTests
5 | {
6 | [Test]
7 | public void MyExplicitTest()
8 | {
9 |
10 | }
11 |
12 | [Test]
13 | public void MyExplicitTest2()
14 | {
15 |
16 | }
17 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/ExternalEnumArgumentTest.cs:
--------------------------------------------------------------------------------
1 | using Polly.CircuitBreaker;
2 |
3 | namespace TUnit.TestProject;
4 |
5 | public class ExternalEnumArgumentTest
6 | {
7 | [Test]
8 | [Arguments(CircuitState.Closed)]
9 | public void MyTest(CircuitState value)
10 | {
11 | }
12 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/FailedInitializationTests.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject;
2 |
3 | public class FailedInitializationTests
4 | {
5 | [Test]
6 | [MethodDataSource(nameof(Data))]
7 | public void FailingDataSource(int value)
8 | {
9 | }
10 |
11 | public static int Data() => throw new Exception();
12 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/FailedInitializationTests2.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics.CodeAnalysis;
2 |
3 | namespace TUnit.TestProject;
4 |
5 | [UnconditionalSuppressMessage("Usage", "TUnit0033:Conflicting DependsOn attributes")]
6 | public class FailedInitializationTests2
7 | {
8 | [Test]
9 | [DependsOn(nameof(Test2))]
10 | public void Test()
11 | {
12 | }
13 |
14 | [Test]
15 | [DependsOn(nameof(Test))]
16 | public void Test2()
17 | {
18 | }
19 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/GenericHooks.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject;
2 |
3 | [Arguments(1)]
4 | [Arguments("Hello")]
5 | public class GenericHooks(T arg)
6 | {
7 | [Before(HookType.Test)]
8 | public void Before()
9 | {
10 | Console.WriteLine(arg);
11 | }
12 |
13 | [After(HookType.Test)]
14 | public void After()
15 | {
16 | Console.WriteLine(arg);
17 | }
18 |
19 | [Test]
20 | public void Test()
21 | {
22 | Console.WriteLine(arg);
23 | }
24 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/GlobalSetUpCleanUp.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject;
2 |
3 | public static class GlobalSetUpCleanUp
4 | {
5 | [Before(Assembly)]
6 | public static void BlahSetUp()
7 | {
8 | // Dummy method
9 | }
10 |
11 | [Before(Assembly)]
12 | public static void BlahSetUp2()
13 | {
14 | // Dummy method
15 | }
16 |
17 | [After(Assembly)]
18 | public static Task BlahCleanUp()
19 | {
20 | return Task.CompletedTask;
21 | }
22 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/GlobalUsings.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thomhurst/TUnit/a9411849b3062e1629f841e7e44eeeb487e381b0/TUnit.TestProject/GlobalUsings.cs
--------------------------------------------------------------------------------
/TUnit.TestProject/IDisposableTests.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject;
2 |
3 | public class DisposableTests : IDisposable
4 | {
5 | [Test]
6 | public void One()
7 | {
8 |
9 | }
10 |
11 | [Test]
12 | public Task Two()
13 | {
14 | return Task.CompletedTask;
15 | }
16 |
17 | [Test]
18 | public async Task Three()
19 | {
20 | await Task.CompletedTask;
21 | }
22 |
23 | public void Dispose()
24 | {
25 |
26 | }
27 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/InheritedPropertySetterTests.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject;
2 |
3 | [InheritsTests]
4 | public class InheritedPropertySetterTests : PropertySetterTests;
--------------------------------------------------------------------------------
/TUnit.TestProject/InstanceData.cs:
--------------------------------------------------------------------------------
1 | using TUnit.Assertions;
2 | using TUnit.Assertions.Extensions;
3 |
4 | namespace TUnit.TestProject;
5 |
6 | public class InstanceData
7 | {
8 | private int _value;
9 |
10 | [Test]
11 | public void Test()
12 | {
13 | #pragma warning disable TUnit0018
14 | _value = 99;
15 | #pragma warning restore TUnit0018
16 | }
17 |
18 | [Test]
19 | public async Task Test2()
20 | {
21 | await Assert.That(_value).IsEqualTo(99);
22 | }
23 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/LongFailures.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject;
2 |
3 | [Category("LongFailures")]
4 | public class LongFailures
5 | {
6 | private static int _counter;
7 |
8 | [Repeat(100)]
9 | [Test]
10 | public async Task LongFailure()
11 | {
12 | await Task.Delay(TimeSpan.FromSeconds(Interlocked.Increment(ref _counter)));
13 | throw new Exception();
14 | }
15 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/MyTests.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject;
2 |
3 | public class MyTests;
--------------------------------------------------------------------------------
/TUnit.TestProject/NameOfArgumentTests.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject;
2 |
3 | public class NameOfArgumentTests
4 | {
5 | [Test]
6 | [Arguments(nameof(TestName))]
7 | public void TestName(string name)
8 | {
9 | // Dummy method
10 | }
11 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/NullableByteArgumentTests.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject;
2 |
3 | public class NullableByteArgumentTests
4 | {
5 | [Test]
6 | [Arguments((byte)1)]
7 | [Arguments(null)]
8 | public void Test(byte? someByte)
9 | {
10 | }
11 |
12 | [Test]
13 | [Arguments((byte)1, (byte)1)]
14 | [Arguments((byte)1, null)]
15 | public void Test2(byte byte1, byte? byte2)
16 | {
17 | }
18 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/OneTimeCleanUpWithBaseTests/Base1.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject.OneTimeCleanUpWithBaseTests;
2 |
3 | public class Base1 : Base2
4 | {
5 | [After(Class)]
6 | public static Task Base1AfterAllTestsInClass()
7 | {
8 | return Task.CompletedTask;
9 | }
10 |
11 | [After(Test)]
12 | public Task Base1CleanUp()
13 | {
14 | return Task.CompletedTask;
15 | }
16 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/OneTimeCleanUpWithBaseTests/Base2.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject.OneTimeCleanUpWithBaseTests;
2 |
3 | public class Base2
4 | {
5 | [After(Class)]
6 | public static Task Base2AfterAllTestsInClass()
7 | {
8 | return Task.CompletedTask;
9 | }
10 |
11 | [After(Test)]
12 | public Task Base2CleanUp()
13 | {
14 | return Task.CompletedTask;
15 | }
16 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/OneTimeCleanUpWithBaseTests/NonBase.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject.OneTimeCleanUpWithBaseTests;
2 |
3 | public class NonBase : Base1
4 | {
5 | [After(Class)]
6 | public static Task NonBaseAfterAllTestsInClass()
7 | {
8 | return Task.CompletedTask;
9 | }
10 |
11 | [After(HookType.Test)]
12 | public Task NonBaseCleanUp()
13 | {
14 | return Task.CompletedTask;
15 | }
16 |
17 | [Test]
18 | public void Test()
19 | {
20 | // Dummy method
21 | }
22 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/OneTimeSetUpWithBaseTests/Base1.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject.OneTimeSetUpWithBaseTests;
2 |
3 | public class Base1 : Base2
4 | {
5 | [Before(Class)]
6 | public static Task Base1OneTimeSetup()
7 | {
8 | return Task.CompletedTask;
9 | }
10 |
11 | [Before(Test)]
12 | public Task Base1SetUp()
13 | {
14 | return Task.CompletedTask;
15 | }
16 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/OneTimeSetUpWithBaseTests/Base2.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject.OneTimeSetUpWithBaseTests;
2 |
3 | public class Base2
4 | {
5 | [Before(Class)]
6 | public static Task Base2OneTimeSetup()
7 | {
8 | return Task.CompletedTask;
9 | }
10 |
11 | [Before(Test)]
12 | public Task Base2SetUp()
13 | {
14 | return Task.CompletedTask;
15 | }
16 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/OneTimeSetUpWithBaseTests/NonBase.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject.OneTimeSetUpWithBaseTests;
2 |
3 | public class NonBase : Base1
4 | {
5 | [Before(Class)]
6 | public static Task NonBaseOneTimeSetup()
7 | {
8 | return Task.CompletedTask;
9 | }
10 |
11 | [Before(HookType.Test)]
12 | public Task NonBaseSetUp()
13 | {
14 | return Task.CompletedTask;
15 | }
16 |
17 | [Test]
18 | public void Test()
19 | {
20 | // Dummy method
21 | }
22 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/OptionalArgumentsTests.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject;
2 |
3 | public class OptionalArgumentsTests
4 | {
5 | [Test]
6 | [Arguments(1)]
7 | public void Test(int value, bool flag = true)
8 | {
9 | // Dummy Method
10 | }
11 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/RepeatTests.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject;
2 |
3 | [Repeat(3)]
4 | public class RepeatTests
5 | {
6 | [Test]
7 | [Repeat(1)]
8 | public void One()
9 | {
10 | // Dummy method
11 | }
12 |
13 | [Test]
14 | [Repeat(2)]
15 | public void Two()
16 | {
17 | // Dummy method
18 | }
19 |
20 | [Test]
21 | public void Three()
22 | {
23 | // Dummy method
24 | }
25 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/SkipTests.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject;
2 |
3 | public class SkipTests : SkipDummyHooks
4 | {
5 | [Test]
6 | [Skip("Just because.")]
7 | public void SkippedTest()
8 | {
9 | }
10 | }
11 |
12 | public class SkipDummyHooks
13 | {
14 | public string? _dummy;
15 |
16 | [Before(Test)]
17 | public void SetUp()
18 | {
19 | }
20 |
21 | [After(Test)]
22 | public void TearDown()
23 | {
24 | }
25 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/SomethingElseAttribute.cs:
--------------------------------------------------------------------------------
1 | using TUnit.Core.Interfaces;
2 |
3 | namespace TUnit.TestProject;
4 |
5 | public class SomethingElseAttribute : Attribute, ITestStartEventReceiver
6 | {
7 | public ValueTask OnTestStart(BeforeTestContext beforeTestContext)
8 | {
9 | return default;
10 | }
11 |
12 | public int Order => 0;
13 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/TestArtifactTests.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject;
2 |
3 | public class TestArtifactTests
4 | {
5 | [Test]
6 | public void Artifact_Test()
7 | {
8 | TestContext.Current!.AddArtifact(new Artifact
9 | {
10 | File = new FileInfo("Data/Zip.zip"),
11 | DisplayName = "Blah!"
12 | });
13 | }
14 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/TestData.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject;
2 |
3 | public class TestData
4 | {
5 | public static string Foo() => "foo";
6 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/TestDataSources.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject;
2 |
3 | public class TestDataSources
4 | {
5 | public static int One() => 1;
6 | public static int Two() => 2;
7 |
8 | public static int[] OneEnumerable() => [1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
9 | public static int[] OneFailingEnumerable() => [1, 2, 3, 4, 5, 6, 7, 8, 9];
10 |
11 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/TestDiscoveryHookTests.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject;
2 |
3 | public class TestDiscoveryHookTests
4 | {
5 | [BeforeEvery(TestDiscovery, Order = 5)]
6 | public static void BeforeDiscovery()
7 | {
8 | }
9 |
10 | [AfterEvery(TestDiscovery)]
11 | public static void AfterDiscovery()
12 | {
13 | }
14 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/TestEnum.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject;
2 |
3 | public enum TestEnum
4 | {
5 | One,
6 | Two
7 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/TestEnum2.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject;
2 |
3 | public enum TestEnum2
4 | {
5 | One,
6 | Two
7 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/TupleDataSourceDrivenTests.cs:
--------------------------------------------------------------------------------
1 | namespace TUnit.TestProject;
2 |
3 | public class TupleDataSourceDrivenTests
4 | {
5 | [Test]
6 | [MethodDataSource(nameof(TupleMethod))]
7 | public void DataSource_TupleMethod(int value, string value2, bool value3)
8 | {
9 | // Dummy method
10 | }
11 |
12 | public static (int, string, bool) TupleMethod() => (1, "String", true);
13 | }
--------------------------------------------------------------------------------
/TUnit.TestProject/testconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "MyKey1": "MyValue1",
3 | "Nested": {
4 | "MyKey2": "MyValue2"
5 | }
6 | }
--------------------------------------------------------------------------------
/TUnit.UnitTests/Extensions/ReflectionExtensions.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 |
3 | namespace TUnit.UnitTests.Extensions;
4 |
5 | public static class ReflectionExtensions
6 | {
7 | public static FieldInfo? GetBackingField(this PropertyInfo propertyInfo)
8 | {
9 | return propertyInfo.DeclaringType!.GetField($"<{propertyInfo.Name}>k__BackingField", BindingFlags.Instance | BindingFlags.NonPublic);
10 | }
11 | }
--------------------------------------------------------------------------------
/TUnit.UnitTests/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | global using Assert = TUnit.Assertions.Assert;
2 | global using TestAttribute = TUnit.Core.TestAttribute;
--------------------------------------------------------------------------------
/TUnit/TUnit.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/TUnit/TUnit.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | latest
6 |
7 |
8 |
--------------------------------------------------------------------------------
/assets/banner.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thomhurst/TUnit/a9411849b3062e1629f841e7e44eeeb487e381b0/assets/banner.png
--------------------------------------------------------------------------------
/assets/logo.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thomhurst/TUnit/a9411849b3062e1629f841e7e44eeeb487e381b0/assets/logo.jpg
--------------------------------------------------------------------------------
/clean.ps1:
--------------------------------------------------------------------------------
1 | Get-ChildItem .\ -include bin,obj -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse }
2 |
--------------------------------------------------------------------------------
/docs/.gitignore:
--------------------------------------------------------------------------------
1 | # Dependencies
2 | /node_modules
3 |
4 | # Production
5 | /build
6 |
7 | # Generated files
8 | .docusaurus
9 | .cache-loader
10 |
11 | # Misc
12 | .DS_Store
13 | .env.local
14 | .env.development.local
15 | .env.test.local
16 | .env.production.local
17 |
18 | npm-debug.log*
19 | yarn-debug.log*
20 | yarn-error.log*
21 |
--------------------------------------------------------------------------------
/docs/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
3 | };
4 |
--------------------------------------------------------------------------------
/docs/docs/comparison/_category_.json:
--------------------------------------------------------------------------------
1 | {
2 | "label": "Test Framework Comparisons",
3 | "position": 5,
4 | "link": {
5 | "type": "generated-index"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/docs/docs/customization-extensibility/libraries.md:
--------------------------------------------------------------------------------
1 | # Libraries
2 |
3 | If you want a library package to define things like re-useable base classes with hooks etc, then you shouldn't use the main `TUnit` package - As this assumes your project is a test project and tries to build it as an executable etc.
4 |
5 | Instead, reference `TUnit.Core` instead - It has all of the models required for wiring up your tests, but without all the extra setting up of the test suite execition.
6 |
--------------------------------------------------------------------------------
/docs/docs/examples/_category_.json:
--------------------------------------------------------------------------------
1 | {
2 | "label": "Examples",
3 | "position": 6,
4 | "link": {
5 | "type": "generated-index"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/docs/docs/examples/intro.md:
--------------------------------------------------------------------------------
1 | # Examples
2 |
3 | This can serve as a place to show how to use TUnit to test more complex systems, utilising advanced features like ClassData sources with IAsyncInitializers and IAsyncDisposables, or utilising test events to drive things.
4 |
5 | As tests come in all shapes and sizes, this is a good place for community contributions. If you have a good example for showing other users how to setup a specific testing scenario, then please submit a pull request with code examples.
6 |
--------------------------------------------------------------------------------
/docs/docs/experimental/_category_.json:
--------------------------------------------------------------------------------
1 | {
2 | "label": "Experimental",
3 | "position": 7,
4 | "link": {
5 | "type": "generated-index",
6 | "description": "Documentation for Experimental Features."
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/docs/docs/extensions/_category_.json:
--------------------------------------------------------------------------------
1 | {
2 | "label": "Extensions",
3 | "position": 5,
4 | "link": {
5 | "type": "generated-index"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/docs/docs/getting-started/congratulations.md:
--------------------------------------------------------------------------------
1 | # Congratulations!
2 |
3 | You have just learned the basics of writing a test in TUnit.
4 |
5 | Keep reading if you'd like to know more on assertions, or more advanced features such as test setups and cleanups.
6 |
--------------------------------------------------------------------------------
/docs/docs/migration/_category_.json:
--------------------------------------------------------------------------------
1 | {
2 | "label": "Migration",
3 | "position": 5,
4 | "link": {
5 | "type": "generated-index",
6 | "description": "How to migrate from xUnit."
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/docs/src/components/HomepageFeatures/styles.module.css:
--------------------------------------------------------------------------------
1 | .features {
2 | display: flex;
3 | align-items: center;
4 | padding: 2rem 0;
5 | width: 100%;
6 | }
7 |
8 | .featureSvg {
9 | height: 200px;
10 | width: 200px;
11 | fill: #333;
12 | }
13 |
--------------------------------------------------------------------------------
/docs/src/pages/index.module.css:
--------------------------------------------------------------------------------
1 | /**
2 | * CSS files with the .module.css suffix will be treated as CSS modules
3 | * and scoped locally.
4 | */
5 |
6 | .heroBanner {
7 | padding: 4rem 0;
8 | text-align: center;
9 | position: relative;
10 | overflow: hidden;
11 | }
12 |
13 | @media screen and (max-width: 996px) {
14 | .heroBanner {
15 | padding: 2rem;
16 | }
17 | }
18 |
19 | .buttons {
20 | display: flex;
21 | align-items: center;
22 | justify-content: center;
23 | }
24 |
--------------------------------------------------------------------------------
/docs/src/pages/markdown-page.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Markdown page example
3 | ---
4 |
5 | # Markdown page example
6 |
7 | You don't need React to write simple standalone pages.
8 |
9 |
--------------------------------------------------------------------------------
/docs/static/.nojekyll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thomhurst/TUnit/a9411849b3062e1629f841e7e44eeeb487e381b0/docs/static/.nojekyll
--------------------------------------------------------------------------------
/docs/static/CNAME:
--------------------------------------------------------------------------------
1 | tunit.dev
--------------------------------------------------------------------------------
/docs/static/img/docusaurus-social-card.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thomhurst/TUnit/a9411849b3062e1629f841e7e44eeeb487e381b0/docs/static/img/docusaurus-social-card.jpg
--------------------------------------------------------------------------------
/docs/static/img/docusaurus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thomhurst/TUnit/a9411849b3062e1629f841e7e44eeeb487e381b0/docs/static/img/docusaurus.png
--------------------------------------------------------------------------------
/docs/static/img/fast.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/docs/static/img/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thomhurst/TUnit/a9411849b3062e1629f841e7e44eeeb487e381b0/docs/static/img/favicon.ico
--------------------------------------------------------------------------------
/docs/static/img/flexible.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/docs/static/img/lab.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/docs/static/img/rider.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thomhurst/TUnit/a9411849b3062e1629f841e7e44eeeb487e381b0/docs/static/img/rider.png
--------------------------------------------------------------------------------
/docs/static/img/visual-studio-code.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thomhurst/TUnit/a9411849b3062e1629f841e7e44eeeb487e381b0/docs/static/img/visual-studio-code.png
--------------------------------------------------------------------------------
/docs/static/img/visual-studio.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thomhurst/TUnit/a9411849b3062e1629f841e7e44eeeb487e381b0/docs/static/img/visual-studio.png
--------------------------------------------------------------------------------
/docs/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | // This file is not used in compilation. It is here just for a nice editor experience.
3 | "extends": "@docusaurus/tsconfig",
4 | "compilerOptions": {
5 | "baseUrl": "."
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/renovate.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3 | "ignorePaths": [
4 | "**/node_modules/**",
5 | "**/bower_components/**",
6 | "**/Snapshots/**"
7 | ]
8 | }
9 |
--------------------------------------------------------------------------------
/rider.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thomhurst/TUnit/a9411849b3062e1629f841e7e44eeeb487e381b0/rider.png
--------------------------------------------------------------------------------
/strongname.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thomhurst/TUnit/a9411849b3062e1629f841e7e44eeeb487e381b0/strongname.snk
--------------------------------------------------------------------------------
/tools/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/tools/Directory.Build.targets:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/tools/speed-comparison/.idea/.idea.TestProjects/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 | # Rider ignored files
5 | /projectSettingsUpdater.xml
6 | /.idea.TestProjects.iml
7 | /contentModel.xml
8 | /modules.xml
9 | # Editor-based HTTP Client requests
10 | /httpRequests/
11 | # Datasource local storage ignored files
12 | /dataSources/
13 | /dataSources.local.xml
14 |
--------------------------------------------------------------------------------
/tools/speed-comparison/.idea/.idea.TestProjects/.idea/.name:
--------------------------------------------------------------------------------
1 | TestProjects
--------------------------------------------------------------------------------
/tools/speed-comparison/.idea/.idea.TestProjects/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/tools/speed-comparison/.idea/.idea.TestProjects/.idea/indexLayout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/tools/speed-comparison/.idea/.idea.TestProjects/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/tools/speed-comparison/MSTestTimer/.idea/.idea.MSTestTimer/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 | # Rider ignored files
5 | /contentModel.xml
6 | /projectSettingsUpdater.xml
7 | /modules.xml
8 | /.idea.MSTestTimer.iml
9 | # Editor-based HTTP Client requests
10 | /httpRequests/
11 | # Datasource local storage ignored files
12 | /dataSources/
13 | /dataSources.local.xml
14 |
--------------------------------------------------------------------------------
/tools/speed-comparison/MSTestTimer/.idea/.idea.MSTestTimer/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/tools/speed-comparison/MSTestTimer/MSTestTimer/BasicTest.cs:
--------------------------------------------------------------------------------
1 | namespace MSTestTimer;
2 |
3 | public class BasicTest
4 | {
5 | [TestMethod]
6 | public void Test()
7 | {
8 | }
9 | }
--------------------------------------------------------------------------------
/tools/speed-comparison/MSTestTimer/MSTestTimer/GlobalUsings.cs:
--------------------------------------------------------------------------------
1 | global using Microsoft.VisualStudio.TestTools.UnitTesting;
--------------------------------------------------------------------------------
/tools/speed-comparison/MSTestTimer/MSTestTimer/RepeatTests.cs:
--------------------------------------------------------------------------------
1 | namespace MSTestTimer;
2 |
3 | [TestClass]
4 | public class RepeatTests
5 | {
6 | [TestMethod]
7 | [DynamicData(nameof(Repeat), DynamicDataSourceType.Method)]
8 | public async Task TestMethod1(int _)
9 | {
10 | await Task.Delay(50);
11 | }
12 |
13 | public static IEnumerable