Skip to content

Commit f0caf9c

Browse files
authored
Remove redundant generators (#3310)
1 parent cb1be7f commit f0caf9c

9 files changed

+0
-998
lines changed

TUnit.Core.SourceGenerator/Generators/AotMethodInvocationGenerator.cs

Lines changed: 0 additions & 717 deletions
This file was deleted.

TUnit.Core.SourceGenerator/Generators/DataSourceHelpersGenerator.cs

Lines changed: 0 additions & 202 deletions
This file was deleted.

TUnit.Core/Helpers/DataSourceHelpers.cs

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -292,41 +292,6 @@ public static T InvokeIfFunc<T>(object? value)
292292
return [() => Task.FromResult<object?>(InvokeIfFunc(data))];
293293
}
294294

295-
296-
/// <summary>
297-
/// AOT-compatible runtime dispatcher for data source property initialization.
298-
/// This will be populated by the generated DataSourceHelpers class.
299-
/// </summary>
300-
private static readonly Dictionary<Type, Func<object, MethodMetadata, string, Task>> PropertyInitializers = new();
301-
302-
/// <summary>
303-
/// Register a type-specific property initializer (called by generated code)
304-
/// </summary>
305-
public static void RegisterPropertyInitializer<T>(Func<T, MethodMetadata, string, Task> initializer)
306-
{
307-
PropertyInitializers[typeof(T)] = (instance, testInfo, sessionId) =>
308-
initializer((T)instance, testInfo, sessionId);
309-
}
310-
311-
/// <summary>
312-
/// Initialize data source properties on an instance using registered type-specific helpers
313-
/// </summary>
314-
public static async Task InitializeDataSourcePropertiesAsync(object? instance, MethodMetadata testInformation, string testSessionId)
315-
{
316-
if (instance == null)
317-
{
318-
return;
319-
}
320-
321-
var instanceType = instance.GetType();
322-
323-
if (PropertyInitializers.TryGetValue(instanceType, out var initializer))
324-
{
325-
await initializer(instance, testInformation, testSessionId);
326-
}
327-
// If no initializer is registered, the type has no data source properties
328-
}
329-
330295
public static object?[] ToObjectArray(this object? item)
331296
{
332297
item = InvokeIfFunc(item);
@@ -618,15 +583,4 @@ public static void RegisterTypeCreator<T>(Func<MethodMetadata, string, Task<T>>
618583

619584
return null;
620585
}
621-
622-
/// <summary>
623-
/// Resolves a data source property value at runtime for an existing instance.
624-
/// This is used when we need to set init-only properties via reflection.
625-
/// </summary>
626-
public static Task<object?> ResolveDataSourcePropertyAsync(object instance, string propertyName, MethodMetadata testInformation, string testSessionId)
627-
{
628-
// For now, return a default value - the runtime resolution is complex
629-
// In practice, this should be rare since most data sources can be resolved at compile time
630-
return Task.FromResult<object?>(null);
631-
}
632586
}

TUnit.PublicAPI/Tests.Core_Library_Has_No_API_Changes.DotNet8_0.verified.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2006,20 +2006,17 @@ namespace .Helpers
20062006
public static class DataSourceHelpers
20072007
{
20082008
public static <.<object?>>[] HandleTupleValue(object? value, bool shouldUnwrap) { }
2009-
public static . InitializeDataSourcePropertiesAsync(object? instance, .MethodMetadata testInformation, string testSessionId) { }
20102009
public static object? InvokeIfFunc(object? value) { }
20112010
public static T InvokeIfFunc<T>(object? value) { }
20122011
public static bool IsTuple(object? obj) { }
20132012
public static .<object?> ProcessDataSourceResult<T>(T data) { }
20142013
public static .<object?> ProcessDataSourceResultGeneric<T>(T data) { }
20152014
public static .<object?> ProcessEnumerableDataSource<T>(.<T> enumerable) { }
20162015
public static <.<object?>>[] ProcessTestDataSource<T>(T data, int expectedParameterCount = -1) { }
2017-
public static void RegisterPropertyInitializer<T>(<T, .MethodMetadata, string, .> initializer) { }
20182016
public static void RegisterTypeCreator<T>(<.MethodMetadata, string, .<T>> creator) { }
20192017
[.("Data source resolution may require dynamic code generation")]
20202018
[.("Property types are resolved through reflection")]
20212019
public static .<object?> ResolveDataSourceForPropertyAsync([.(..None | ..PublicParameterlessConstructor | ..PublicFields | ..NonPublicFields | ..PublicProperties)] containingType, string propertyName, .MethodMetadata testInformation, string testSessionId) { }
2022-
public static .<object?> ResolveDataSourcePropertyAsync(object instance, string propertyName, .MethodMetadata testInformation, string testSessionId) { }
20232020
public static object?[] ToObjectArray(this object? item) { }
20242021
public static object?[] ToObjectArrayWithTypes(this object? item, []? expectedTypes) { }
20252022
[return: .(new string[] {

TUnit.PublicAPI/Tests.Core_Library_Has_No_API_Changes.DotNet9_0.verified.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2006,20 +2006,17 @@ namespace .Helpers
20062006
public static class DataSourceHelpers
20072007
{
20082008
public static <.<object?>>[] HandleTupleValue(object? value, bool shouldUnwrap) { }
2009-
public static . InitializeDataSourcePropertiesAsync(object? instance, .MethodMetadata testInformation, string testSessionId) { }
20102009
public static object? InvokeIfFunc(object? value) { }
20112010
public static T InvokeIfFunc<T>(object? value) { }
20122011
public static bool IsTuple(object? obj) { }
20132012
public static .<object?> ProcessDataSourceResult<T>(T data) { }
20142013
public static .<object?> ProcessDataSourceResultGeneric<T>(T data) { }
20152014
public static .<object?> ProcessEnumerableDataSource<T>(.<T> enumerable) { }
20162015
public static <.<object?>>[] ProcessTestDataSource<T>(T data, int expectedParameterCount = -1) { }
2017-
public static void RegisterPropertyInitializer<T>(<T, .MethodMetadata, string, .> initializer) { }
20182016
public static void RegisterTypeCreator<T>(<.MethodMetadata, string, .<T>> creator) { }
20192017
[.("Data source resolution may require dynamic code generation")]
20202018
[.("Property types are resolved through reflection")]
20212019
public static .<object?> ResolveDataSourceForPropertyAsync([.(..None | ..PublicParameterlessConstructor | ..PublicFields | ..NonPublicFields | ..PublicProperties)] containingType, string propertyName, .MethodMetadata testInformation, string testSessionId) { }
2022-
public static .<object?> ResolveDataSourcePropertyAsync(object instance, string propertyName, .MethodMetadata testInformation, string testSessionId) { }
20232020
public static object?[] ToObjectArray(this object? item) { }
20242021
public static object?[] ToObjectArrayWithTypes(this object? item, []? expectedTypes) { }
20252022
[return: .(new string[] {

TUnit.PublicAPI/Tests.Core_Library_Has_No_API_Changes.Net4_7.verified.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1887,18 +1887,15 @@ namespace .Helpers
18871887
public static class DataSourceHelpers
18881888
{
18891889
public static <.<object?>>[] HandleTupleValue(object? value, bool shouldUnwrap) { }
1890-
public static . InitializeDataSourcePropertiesAsync(object? instance, .MethodMetadata testInformation, string testSessionId) { }
18911890
public static object? InvokeIfFunc(object? value) { }
18921891
public static T InvokeIfFunc<T>(object? value) { }
18931892
public static bool IsTuple(object? obj) { }
18941893
public static .<object?> ProcessDataSourceResult<T>(T data) { }
18951894
public static .<object?> ProcessDataSourceResultGeneric<T>(T data) { }
18961895
public static .<object?> ProcessEnumerableDataSource<T>(.<T> enumerable) { }
18971896
public static <.<object?>>[] ProcessTestDataSource<T>(T data, int expectedParameterCount = -1) { }
1898-
public static void RegisterPropertyInitializer<T>(<T, .MethodMetadata, string, .> initializer) { }
18991897
public static void RegisterTypeCreator<T>(<.MethodMetadata, string, .<T>> creator) { }
19001898
public static .<object?> ResolveDataSourceForPropertyAsync( containingType, string propertyName, .MethodMetadata testInformation, string testSessionId) { }
1901-
public static .<object?> ResolveDataSourcePropertyAsync(object instance, string propertyName, .MethodMetadata testInformation, string testSessionId) { }
19021899
public static object?[] ToObjectArray(this object? item) { }
19031900
public static object?[] ToObjectArrayWithTypes(this object? item, []? expectedTypes) { }
19041901
[return: .(new string[] {

TUnit.PublicAPI/Tests.Playwright_Library_Has_No_API_Changes.DotNet8_0.verified.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
[assembly: .(".NETCoreApp,Version=v8.0", FrameworkDisplayName=".NET 8.0")]
22
namespace
3-
{
4-
public static class AotMethodInvokers
5-
{
6-
public static string GetMethodKey(string typeName, string methodName, int parameterCount = 0) { }
7-
public static .<object?> InvokeMethodAsync(string methodKey, object? instance, params object?[]? parameters) { }
8-
}
9-
}
10-
namespace
113
{
124
public class BrowserTest : .PlaywrightTest
135
{

TUnit.PublicAPI/Tests.Playwright_Library_Has_No_API_Changes.DotNet9_0.verified.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
[assembly: .(".NETCoreApp,Version=v9.0", FrameworkDisplayName=".NET 9.0")]
22
namespace
3-
{
4-
public static class AotMethodInvokers
5-
{
6-
public static string GetMethodKey(string typeName, string methodName, int parameterCount = 0) { }
7-
public static .<object?> InvokeMethodAsync(string methodKey, object? instance, params object?[]? parameters) { }
8-
}
9-
}
10-
namespace
113
{
124
public class BrowserTest : .PlaywrightTest
135
{

TUnit.PublicAPI/Tests.Playwright_Library_Has_No_API_Changes.Net4_7.verified.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
[assembly: .(".NETStandard,Version=v2.0", FrameworkDisplayName=".NET Standard 2.0")]
22
namespace
3-
{
4-
public static class AotMethodInvokers
5-
{
6-
public static string GetMethodKey(string typeName, string methodName, int parameterCount = 0) { }
7-
public static .<object?> InvokeMethodAsync(string methodKey, object? instance, params object?[]? parameters) { }
8-
}
9-
}
10-
namespace
113
{
124
public class BrowserTest : .PlaywrightTest
135
{

0 commit comments

Comments
 (0)