Skip to content
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
6 changes: 3 additions & 3 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@
<PackageVersion Include="trxparser" Version="0.5.0" />
<PackageVersion Include="Verify" Version="30.4.0" />
<PackageVersion Include="Verify.NUnit" Version="30.5.0" />
<PackageVersion Include="TUnit" Version="0.24.0" />
<PackageVersion Include="TUnit.Core" Version="0.24.0" />
<PackageVersion Include="TUnit.Assertions" Version="0.24.0" />
<PackageVersion Include="TUnit" Version="0.50.0" />
<PackageVersion Include="TUnit.Core" Version="0.50.0" />
<PackageVersion Include="TUnit.Assertions" Version="0.50.0" />
<PackageVersion Include="Vogen" Version="7.0.4" />
<PackageVersion Include="xunit" Version="2.9.3" />
<PackageVersion Include="xunit.assert" Version="2.9.3" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public class DataGenerator : DataSourceGeneratorAttribute<int, int, int>
{
public override IEnumerable<Func<(int, int, int)>> GenerateDataSources(DataGeneratorMetadata dataGeneratorMetadata)
protected override IEnumerable<Func<(int, int, int)>> GenerateDataSources(DataGeneratorMetadata dataGeneratorMetadata)
{
yield return () => (1, 1, 2);
yield return () => (1, 2, 3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ namespace TUnit;

public class DependencyInjectionClassConstructor : IClassConstructor
{
public object Create(Type type, ClassConstructorMetadata classConstructorMetadata)
public Task<object> Create(Type type, ClassConstructorMetadata classConstructorMetadata)
{
Console.WriteLine(@"You can also control how your test classes are new'd up, giving you lots of power and the ability to utilise tools such as dependency injection");

if (type == typeof(AndEvenMoreTests))
{
return new AndEvenMoreTests(new DataClass());
return Task.FromResult<object>(new AndEvenMoreTests(new DataClass()));
}

throw new NotImplementedException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ open TUnit.Assertions.Extensions

type Tests() =

[<ClassDataSource(typeof<WebApplicationFactory>, Shared = SharedType.PerTestSession)>]
[<ClassDataSource(typeof<WebApplicationFactory>, Shared = [|SharedType.PerTestSession|])>]
member val public WebApplicationFactory: WebApplicationFactory = Unchecked.defaultof<WebApplicationFactory> with get, set

[<Test>]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ type DependencyInjectionClassConstructor() =
.BuildServiceProvider()

interface IClassConstructor with
member _.Create(typ: Type, _: ClassConstructorMetadata) : obj =
member _.Create(typ: Type, _: ClassConstructorMetadata) : Threading.Tasks.Task<obj> =
Console.WriteLine("You can also control how your test classes are new'd up, giving you lots of power and the ability to utilise tools such as dependency injection")
ActivatorUtilities.GetServiceOrCreateInstance(serviceProvider, typ)
Threading.Tasks.Task.FromResult(ActivatorUtilities.GetServiceOrCreateInstance(serviceProvider, typ))
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ type Tests() =

[<Test>]
[<ClassDataSource(typeof<DataClass>)>]
[<ClassDataSource(typeof<DataClass>, Shared = SharedType.PerClass)>]
[<ClassDataSource(typeof<DataClass>, Shared = SharedType.PerAssembly)>]
[<ClassDataSource(typeof<DataClass>, Shared = SharedType.PerTestSession)>]
[<ClassDataSource(typeof<DataClass>, Shared = [|SharedType.PerClass|])>]
[<ClassDataSource(typeof<DataClass>, Shared = [|SharedType.PerAssembly|])>]
[<ClassDataSource(typeof<DataClass>, Shared = [|SharedType.PerTestSession|])>]
member _.ClassDataSource(dataClass: DataClass) =
Console.WriteLine("This test can accept a class, which can also be pre-initialised before being injected in")
Console.WriteLine("These can also be shared among other tests, or new'd up each time, by using the `Shared` property on the attribute")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type MoreTests(title: string) =
Console.WriteLine(title)
Console.WriteLine("Did I forget that data injection works on classes too?")

[<ClassDataSource(typeof<DataClass>, Shared = SharedType.PerTestSession)>]
[<ClassDataSource(typeof<DataClass>, Shared = [|SharedType.PerTestSession|])>]
member val DataClass: DataClass = Unchecked.defaultof<_> with get, set

[<Test>]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Namespace Data
Public Class DataGenerator
Inherits DataSourceGeneratorAttribute(Of Integer, Integer, Integer)

Public Overrides Iterator Function GenerateDataSources(dataGeneratorMetadata As DataGeneratorMetadata) As IEnumerable(Of Func(Of (Integer, Integer, Integer)))
Protected Overrides Iterator Function GenerateDataSources(dataGeneratorMetadata As DataGeneratorMetadata) As IEnumerable(Of Func(Of (Integer, Integer, Integer)))
Yield Function() (1, 1, 2)
Yield Function() (1, 2, 3)
Yield Function() (4, 5, 9)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ Public Class DependencyInjectionClassConstructor
End Function

' Explicit interface implementation for IClassConstructor.Create(Type, ClassConstructorMetadata)
Private Function IClassConstructor_Create(type As Type, classConstructorMetadata As ClassConstructorMetadata) As Object Implements IClassConstructor.Create
Private Function IClassConstructor_Create(type As Type, classConstructorMetadata As ClassConstructorMetadata) As Task(Of Object) Implements IClassConstructor.Create
If type Is GetType(AndEvenMoreTests) Then
Return New AndEvenMoreTests(New DataClass())
Return Task.FromResult(Of Object)(New AndEvenMoreTests(New DataClass()))
End If

Throw New NotImplementedException()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Public Class MoreTests
Console.WriteLine("Did I forget that data injection works on classes too?")
End Sub

<ClassDataSource(GetType(DataClass), Shared:=SharedType.PerTestSession)>
<ClassDataSource(GetType(DataClass), Shared:={SharedType.PerTestSession})>
Public Property DataClass As DataClass

<Test>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.7" />
<PackageReference Include="TUnit" Version="0.24.0" />
<PackageReference Include="TUnit.Assertions.FSharp" Version="0.24.0" />
<PackageReference Include="TUnit" Version="0.50.0" />
<PackageReference Include="TUnit.Assertions.FSharp" Version="0.50.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ open TUnit.Assertions.Extensions

type Tests() =

[<ClassDataSource(typeof<WebApplicationFactory>, Shared = SharedType.PerTestSession)>]
[<ClassDataSource(typeof<WebApplicationFactory>, Shared = [|SharedType.PerTestSession|])>]
member val public WebApplicationFactory: WebApplicationFactory = Unchecked.defaultof<WebApplicationFactory> with get, set

[<Test>]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.7" />
<PackageReference Include="TUnit" Version="0.24.0" />
<PackageReference Include="TUnit" Version="0.50.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<ItemGroup>
<PackageReference Include="Aspire.Hosting.Testing" Version="9.4.0" />
<PackageReference Include="TUnit" Version="0.24.0" />
<PackageReference Include="TUnit" Version="0.50.0" />
</ItemGroup>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<ItemGroup>
<PackageReference Include="Aspire.Hosting.Testing" Version="9.4.0" />
<PackageReference Include="TUnit" Version="0.24.0" />
<PackageReference Include="TUnit" Version="0.50.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ type DependencyInjectionClassConstructor() =
.BuildServiceProvider()

interface IClassConstructor with
member _.Create(typ: Type, _: ClassConstructorMetadata) : obj =
member _.Create(typ: Type, _: ClassConstructorMetadata) : Threading.Tasks.Task<obj> =
Console.WriteLine("You can also control how your test classes are new'd up, giving you lots of power and the ability to utilise tools such as dependency injection")
ActivatorUtilities.GetServiceOrCreateInstance(serviceProvider, typ)
Threading.Tasks.Task.FromResult(ActivatorUtilities.GetServiceOrCreateInstance(serviceProvider, typ))
4 changes: 2 additions & 2 deletions TUnit.Templates/content/TUnit.FSharp/TestProject.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.7" />
<PackageReference Include="TUnit" Version="0.24.0" />
<PackageReference Include="TUnit.Assertions.FSharp" Version="0.24.0" />
<PackageReference Include="TUnit" Version="0.50.0" />
<PackageReference Include="TUnit.Assertions.FSharp" Version="0.50.0" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions TUnit.Templates/content/TUnit.FSharp/Tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ type Tests() =

[<Test>]
[<ClassDataSource(typeof<DataClass>)>]
[<ClassDataSource(typeof<DataClass>, Shared = SharedType.PerClass)>]
[<ClassDataSource(typeof<DataClass>, Shared = SharedType.PerAssembly)>]
[<ClassDataSource(typeof<DataClass>, Shared = SharedType.PerTestSession)>]
[<ClassDataSource(typeof<DataClass>, Shared = [|SharedType.PerClass|])>]
[<ClassDataSource(typeof<DataClass>, Shared = [|SharedType.PerAssembly|])>]
[<ClassDataSource(typeof<DataClass>, Shared = [|SharedType.PerTestSession|])>]
member _.ClassDataSource(dataClass: DataClass) =
Console.WriteLine("This test can accept a class, which can also be pre-initialised before being injected in")
Console.WriteLine("These can also be shared among other tests, or new'd up each time, by using the `Shared` property on the attribute")
Expand Down
2 changes: 1 addition & 1 deletion TUnit.Templates/content/TUnit.FSharp/Tests2.fs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type MoreTests(title: string) =
Console.WriteLine(title)
Console.WriteLine("Did I forget that data injection works on classes too?")

[<ClassDataSource(typeof<DataClass>, Shared = SharedType.PerTestSession)>]
[<ClassDataSource(typeof<DataClass>, Shared = [|SharedType.PerTestSession|])>]
member val DataClass: DataClass = Unchecked.defaultof<_> with get, set

[<Test>]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="TUnit.Playwright" Version="0.24.0" />
<PackageReference Include="TUnit.Playwright" Version="0.50.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion TUnit.Templates/content/TUnit.VB/Data/DataGenerator.vb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Namespace Data
Public Class DataGenerator
Inherits DataSourceGeneratorAttribute(Of Integer, Integer, Integer)

Public Overrides Iterator Function GenerateDataSources(dataGeneratorMetadata As DataGeneratorMetadata) As IEnumerable(Of Func(Of (Integer, Integer, Integer)))
Protected Overrides Iterator Function GenerateDataSources(dataGeneratorMetadata As DataGeneratorMetadata) As IEnumerable(Of Func(Of (Integer, Integer, Integer)))
Yield Function() (1, 1, 2)
Yield Function() (1, 2, 3)
Yield Function() (4, 5, 9)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ Public Class DependencyInjectionClassConstructor
End Function

' Explicit interface implementation for IClassConstructor.Create(Type, ClassConstructorMetadata)
Private Function IClassConstructor_Create(type As Type, classConstructorMetadata As ClassConstructorMetadata) As Object Implements IClassConstructor.Create
Private Function IClassConstructor_Create(type As Type, classConstructorMetadata As ClassConstructorMetadata) As Task(Of Object) Implements IClassConstructor.Create
If type Is GetType(AndEvenMoreTests) Then
Return New AndEvenMoreTests(New DataClass())
Return Task.FromResult(Of Object)(New AndEvenMoreTests(New DataClass()))
End If

Throw New NotImplementedException()
Expand Down
2 changes: 1 addition & 1 deletion TUnit.Templates/content/TUnit.VB/TestProject.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="TUnit" Version="0.24.0" />
<PackageReference Include="TUnit" Version="0.50.0" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion TUnit.Templates/content/TUnit.VB/Tests2.vb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Public Class MoreTests
Console.WriteLine("Did I forget that data injection works on classes too?")
End Sub

<ClassDataSource(GetType(DataClass), Shared:=SharedType.PerTestSession)>
<ClassDataSource(GetType(DataClass), Shared:={SharedType.PerTestSession})>
Public Property DataClass As DataClass

<Test>
Expand Down
2 changes: 1 addition & 1 deletion TUnit.Templates/content/TUnit/Data/DataSourceGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public class DataGenerator : DataSourceGeneratorAttribute<int, int, int>
{
public override IEnumerable<Func<(int, int, int)>> GenerateDataSources(DataGeneratorMetadata dataGeneratorMetadata)
protected override IEnumerable<Func<(int, int, int)>> GenerateDataSources(DataGeneratorMetadata dataGeneratorMetadata)
{
yield return () => (1, 1, 2);
yield return () => (1, 2, 3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ namespace TestProject;

public class DependencyInjectionClassConstructor : IClassConstructor
{
public object Create(Type type, ClassConstructorMetadata classConstructorMetadata)
public Task<object> Create(Type type, ClassConstructorMetadata classConstructorMetadata)
{
Console.WriteLine(@"You can also control how your test classes are new'd up, giving you lots of power and the ability to utilise tools such as dependency injection");

if (type == typeof(AndEvenMoreTests))
{
return new AndEvenMoreTests(new DataClass());
return Task.FromResult<object>(new AndEvenMoreTests(new DataClass()));
}

throw new NotImplementedException();
Expand Down
2 changes: 1 addition & 1 deletion TUnit.Templates/content/TUnit/TestProject.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="TUnit" Version="0.24.0" />
<PackageReference Include="TUnit" Version="0.50.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<ItemGroup>
<PackageReference Include="TUnit">
<VersionOverride Condition="'$(TUnitVersion)' != ''">$(TUnitVersion)</VersionOverride>
<VersionOverride Condition="'$(TUnitVersion)' != ''">0.50.0</VersionOverride>
</PackageReference>
<PackageReference Include="Polyfill" />
<PackageReference Include="FSharp.Core" />
Expand Down
Loading