-
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
manually construct attributes (#1451)
* WIP * Fixes * Fixes * Tidy * Tidy * Switch to Verify * Commit verified code * Tidy .csprojs
- Loading branch information
Showing
104 changed files
with
29,056 additions
and
1,375 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
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
1 change: 1 addition & 0 deletions
1
TUnit.Core.SourceGenerator.Tests/AbstractTests.AbstractClass.verified.txt
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 @@ | ||
[] |
90 changes: 90 additions & 0 deletions
90
TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete1.verified.txt
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,90 @@ | ||
[ | ||
// <auto-generated/> | ||
#pragma warning disable | ||
using global::System.Linq; | ||
using global::System.Reflection; | ||
using global::TUnit.Core; | ||
using global::TUnit.Core.Extensions; | ||
|
||
namespace TUnit.SourceGenerated; | ||
|
||
[global::System.Diagnostics.StackTraceHidden] | ||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] | ||
file partial class Inherited_ConcreteClass1 : TUnit.Core.Interfaces.SourceGenerator.ITestSource | ||
{ | ||
[global::System.Runtime.CompilerServices.ModuleInitializer] | ||
public static void Initialise() | ||
{ | ||
SourceRegistrar.Register(new Inherited_ConcreteClass1()); | ||
} | ||
public global::System.Collections.Generic.IReadOnlyList<SourceGeneratedTestNode> CollectTests(string sessionId) | ||
{ | ||
return Tests0(sessionId); | ||
} | ||
private global::System.Collections.Generic.List<SourceGeneratedTestNode> Tests0(string sessionId) | ||
{ | ||
global::System.Collections.Generic.List<SourceGeneratedTestNode> nodes = []; | ||
var classDataIndex = 0; | ||
var testMethodDataIndex = 0; | ||
try | ||
{ | ||
var testClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1); | ||
var methodInfo = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1).GetMethod("AssertClassName", 0, []); | ||
|
||
var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); | ||
var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); | ||
|
||
var resettableClassFactoryDelegate = () => new ResettableLazy<global::TUnit.TestProject.AbstractTests.ConcreteClass1>(() => | ||
new global::TUnit.TestProject.AbstractTests.ConcreteClass1() | ||
, sessionId, testBuilderContext); | ||
|
||
var resettableClassFactory = resettableClassFactoryDelegate(); | ||
|
||
nodes.Add(new TestMetadata<global::TUnit.TestProject.AbstractTests.ConcreteClass1> | ||
{ | ||
TestId = $"TUnit.TestProject.AbstractTests.ConcreteClass1.AssertClassName:0", | ||
TestClassArguments = [], | ||
TestMethodArguments = [], | ||
TestClassProperties = [], | ||
CurrentRepeatAttempt = 0, | ||
RepeatLimit = 0, | ||
MethodInfo = methodInfo, | ||
ResettableClassFactory = resettableClassFactory, | ||
TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.AssertClassName()), | ||
TestFilePath = @"", | ||
TestLineNumber = 8, | ||
TestAttributes = [ new global::TUnit.Core.TestAttribute() | ||
{ | ||
|
||
} ], | ||
ClassAttributes = [ new global::TUnit.Core.InheritsTestsAttribute() | ||
{ | ||
|
||
} ], | ||
AssemblyAttributes = [ ], | ||
DataAttributes = [ ], | ||
TestBuilderContext = testBuilderContext, | ||
}); | ||
resettableClassFactory = resettableClassFactoryDelegate(); | ||
testBuilderContext = new(); | ||
testBuilderContextAccessor.Current = testBuilderContext; | ||
} | ||
catch (global::System.Exception exception) | ||
{ | ||
nodes.Add(new FailedInitializationTest | ||
{ | ||
TestId = $"TUnit.TestProject.AbstractTests.ConcreteClass1.AssertClassName:0", | ||
TestClass = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1), | ||
ReturnType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1).GetMethod("AssertClassName", 0, []).ReturnType, | ||
ParameterTypeFullNames = [], | ||
TestName = "AssertClassName", | ||
TestFilePath = @"", | ||
TestLineNumber = 8, | ||
Exception = exception, | ||
}); | ||
} | ||
return nodes; | ||
} | ||
} | ||
|
||
] |
274 changes: 274 additions & 0 deletions
274
TUnit.Core.SourceGenerator.Tests/AbstractTests.Concrete2.verified.txt
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,274 @@ | ||
[ | ||
// <auto-generated/> | ||
#pragma warning disable | ||
using global::System.Linq; | ||
using global::System.Reflection; | ||
using global::TUnit.Core; | ||
using global::TUnit.Core.Extensions; | ||
|
||
namespace TUnit.SourceGenerated; | ||
|
||
[global::System.Diagnostics.StackTraceHidden] | ||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] | ||
file partial class ConcreteClass2 : TUnit.Core.Interfaces.SourceGenerator.ITestSource | ||
{ | ||
[global::System.Runtime.CompilerServices.ModuleInitializer] | ||
public static void Initialise() | ||
{ | ||
SourceRegistrar.Register(new ConcreteClass2()); | ||
} | ||
public global::System.Collections.Generic.IReadOnlyList<SourceGeneratedTestNode> CollectTests(string sessionId) | ||
{ | ||
return Tests0(sessionId); | ||
} | ||
private global::System.Collections.Generic.List<SourceGeneratedTestNode> Tests0(string sessionId) | ||
{ | ||
global::System.Collections.Generic.List<SourceGeneratedTestNode> nodes = []; | ||
var classDataIndex = 0; | ||
var testMethodDataIndex = 0; | ||
try | ||
{ | ||
var testClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2); | ||
var methodInfo = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2).GetMethod("SecondTest", 0, []); | ||
|
||
var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); | ||
var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); | ||
|
||
var resettableClassFactoryDelegate = () => new ResettableLazy<global::TUnit.TestProject.AbstractTests.ConcreteClass2>(() => | ||
new global::TUnit.TestProject.AbstractTests.ConcreteClass2() | ||
, sessionId, testBuilderContext); | ||
|
||
var resettableClassFactory = resettableClassFactoryDelegate(); | ||
|
||
nodes.Add(new TestMetadata<global::TUnit.TestProject.AbstractTests.ConcreteClass2> | ||
{ | ||
TestId = $"TUnit.TestProject.AbstractTests.ConcreteClass2.SecondTest:0", | ||
TestClassArguments = [], | ||
TestMethodArguments = [], | ||
TestClassProperties = [], | ||
CurrentRepeatAttempt = 0, | ||
RepeatLimit = 0, | ||
MethodInfo = methodInfo, | ||
ResettableClassFactory = resettableClassFactory, | ||
TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.SecondTest()), | ||
TestFilePath = @"", | ||
TestLineNumber = 11, | ||
TestAttributes = [ new global::TUnit.Core.TestAttribute() | ||
{ | ||
|
||
} ], | ||
ClassAttributes = [ new global::TUnit.Core.InheritsTestsAttribute() | ||
{ | ||
|
||
}, new global::TUnit.Core.InheritsTestsAttribute() | ||
{ | ||
|
||
} ], | ||
AssemblyAttributes = [ ], | ||
DataAttributes = [ ], | ||
TestBuilderContext = testBuilderContext, | ||
}); | ||
resettableClassFactory = resettableClassFactoryDelegate(); | ||
testBuilderContext = new(); | ||
testBuilderContextAccessor.Current = testBuilderContext; | ||
} | ||
catch (global::System.Exception exception) | ||
{ | ||
nodes.Add(new FailedInitializationTest | ||
{ | ||
TestId = $"TUnit.TestProject.AbstractTests.ConcreteClass2.SecondTest:0", | ||
TestClass = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), | ||
ReturnType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2).GetMethod("SecondTest", 0, []).ReturnType, | ||
ParameterTypeFullNames = [], | ||
TestName = "SecondTest", | ||
TestFilePath = @"", | ||
TestLineNumber = 11, | ||
Exception = exception, | ||
}); | ||
} | ||
return nodes; | ||
} | ||
} | ||
|
||
|
||
// <auto-generated/> | ||
#pragma warning disable | ||
using global::System.Linq; | ||
using global::System.Reflection; | ||
using global::TUnit.Core; | ||
using global::TUnit.Core.Extensions; | ||
|
||
namespace TUnit.SourceGenerated; | ||
|
||
[global::System.Diagnostics.StackTraceHidden] | ||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] | ||
file partial class Inherited_ConcreteClass2 : TUnit.Core.Interfaces.SourceGenerator.ITestSource | ||
{ | ||
[global::System.Runtime.CompilerServices.ModuleInitializer] | ||
public static void Initialise() | ||
{ | ||
SourceRegistrar.Register(new Inherited_ConcreteClass2()); | ||
} | ||
public global::System.Collections.Generic.IReadOnlyList<SourceGeneratedTestNode> CollectTests(string sessionId) | ||
{ | ||
return Tests0(sessionId); | ||
} | ||
private global::System.Collections.Generic.List<SourceGeneratedTestNode> Tests0(string sessionId) | ||
{ | ||
global::System.Collections.Generic.List<SourceGeneratedTestNode> nodes = []; | ||
var classDataIndex = 0; | ||
var testMethodDataIndex = 0; | ||
try | ||
{ | ||
var testClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2); | ||
var methodInfo = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2).GetMethod("AssertClassName", 0, []); | ||
|
||
var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); | ||
var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); | ||
|
||
var resettableClassFactoryDelegate = () => new ResettableLazy<global::TUnit.TestProject.AbstractTests.ConcreteClass2>(() => | ||
new global::TUnit.TestProject.AbstractTests.ConcreteClass2() | ||
, sessionId, testBuilderContext); | ||
|
||
var resettableClassFactory = resettableClassFactoryDelegate(); | ||
|
||
nodes.Add(new TestMetadata<global::TUnit.TestProject.AbstractTests.ConcreteClass2> | ||
{ | ||
TestId = $"TUnit.TestProject.AbstractTests.ConcreteClass2.AssertClassName:0", | ||
TestClassArguments = [], | ||
TestMethodArguments = [], | ||
TestClassProperties = [], | ||
CurrentRepeatAttempt = 0, | ||
RepeatLimit = 0, | ||
MethodInfo = methodInfo, | ||
ResettableClassFactory = resettableClassFactory, | ||
TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.AssertClassName()), | ||
TestFilePath = @"", | ||
TestLineNumber = 8, | ||
TestAttributes = [ new global::TUnit.Core.TestAttribute() | ||
{ | ||
|
||
} ], | ||
ClassAttributes = [ new global::TUnit.Core.InheritsTestsAttribute() | ||
{ | ||
|
||
}, new global::TUnit.Core.InheritsTestsAttribute() | ||
{ | ||
|
||
} ], | ||
AssemblyAttributes = [ ], | ||
DataAttributes = [ ], | ||
TestBuilderContext = testBuilderContext, | ||
}); | ||
resettableClassFactory = resettableClassFactoryDelegate(); | ||
testBuilderContext = new(); | ||
testBuilderContextAccessor.Current = testBuilderContext; | ||
} | ||
catch (global::System.Exception exception) | ||
{ | ||
nodes.Add(new FailedInitializationTest | ||
{ | ||
TestId = $"TUnit.TestProject.AbstractTests.ConcreteClass2.AssertClassName:0", | ||
TestClass = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2), | ||
ReturnType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass2).GetMethod("AssertClassName", 0, []).ReturnType, | ||
ParameterTypeFullNames = [], | ||
TestName = "AssertClassName", | ||
TestFilePath = @"", | ||
TestLineNumber = 8, | ||
Exception = exception, | ||
}); | ||
} | ||
return nodes; | ||
} | ||
} | ||
|
||
|
||
// <auto-generated/> | ||
#pragma warning disable | ||
using global::System.Linq; | ||
using global::System.Reflection; | ||
using global::TUnit.Core; | ||
using global::TUnit.Core.Extensions; | ||
|
||
namespace TUnit.SourceGenerated; | ||
|
||
[global::System.Diagnostics.StackTraceHidden] | ||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] | ||
file partial class Inherited_ConcreteClass1 : TUnit.Core.Interfaces.SourceGenerator.ITestSource | ||
{ | ||
[global::System.Runtime.CompilerServices.ModuleInitializer] | ||
public static void Initialise() | ||
{ | ||
SourceRegistrar.Register(new Inherited_ConcreteClass1()); | ||
} | ||
public global::System.Collections.Generic.IReadOnlyList<SourceGeneratedTestNode> CollectTests(string sessionId) | ||
{ | ||
return Tests0(sessionId); | ||
} | ||
private global::System.Collections.Generic.List<SourceGeneratedTestNode> Tests0(string sessionId) | ||
{ | ||
global::System.Collections.Generic.List<SourceGeneratedTestNode> nodes = []; | ||
var classDataIndex = 0; | ||
var testMethodDataIndex = 0; | ||
try | ||
{ | ||
var testClassType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1); | ||
var methodInfo = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1).GetMethod("AssertClassName", 0, []); | ||
|
||
var testBuilderContext = new global::TUnit.Core.TestBuilderContext(); | ||
var testBuilderContextAccessor = new global::TUnit.Core.TestBuilderContextAccessor(testBuilderContext); | ||
|
||
var resettableClassFactoryDelegate = () => new ResettableLazy<global::TUnit.TestProject.AbstractTests.ConcreteClass1>(() => | ||
new global::TUnit.TestProject.AbstractTests.ConcreteClass1() | ||
, sessionId, testBuilderContext); | ||
|
||
var resettableClassFactory = resettableClassFactoryDelegate(); | ||
|
||
nodes.Add(new TestMetadata<global::TUnit.TestProject.AbstractTests.ConcreteClass1> | ||
{ | ||
TestId = $"TUnit.TestProject.AbstractTests.ConcreteClass1.AssertClassName:0", | ||
TestClassArguments = [], | ||
TestMethodArguments = [], | ||
TestClassProperties = [], | ||
CurrentRepeatAttempt = 0, | ||
RepeatLimit = 0, | ||
MethodInfo = methodInfo, | ||
ResettableClassFactory = resettableClassFactory, | ||
TestMethodFactory = (classInstance, cancellationToken) => AsyncConvert.Convert(() => classInstance.AssertClassName()), | ||
TestFilePath = @"", | ||
TestLineNumber = 8, | ||
TestAttributes = [ new global::TUnit.Core.TestAttribute() | ||
{ | ||
|
||
} ], | ||
ClassAttributes = [ new global::TUnit.Core.InheritsTestsAttribute() | ||
{ | ||
|
||
} ], | ||
AssemblyAttributes = [ ], | ||
DataAttributes = [ ], | ||
TestBuilderContext = testBuilderContext, | ||
}); | ||
resettableClassFactory = resettableClassFactoryDelegate(); | ||
testBuilderContext = new(); | ||
testBuilderContextAccessor.Current = testBuilderContext; | ||
} | ||
catch (global::System.Exception exception) | ||
{ | ||
nodes.Add(new FailedInitializationTest | ||
{ | ||
TestId = $"TUnit.TestProject.AbstractTests.ConcreteClass1.AssertClassName:0", | ||
TestClass = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1), | ||
ReturnType = typeof(global::TUnit.TestProject.AbstractTests.ConcreteClass1).GetMethod("AssertClassName", 0, []).ReturnType, | ||
ParameterTypeFullNames = [], | ||
TestName = "AssertClassName", | ||
TestFilePath = @"", | ||
TestLineNumber = 8, | ||
Exception = exception, | ||
}); | ||
} | ||
return nodes; | ||
} | ||
} | ||
|
||
] |
Oops, something went wrong.