diff --git a/Directory.Packages.props b/Directory.Packages.props index a5889cc2..e2801059 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -5,50 +5,50 @@ - - + + - - + + - - + + - - - - - - + + + + + + - + - - - - + + + + - + - - + + - + - + @@ -58,10 +58,10 @@ - - - - + + + + @@ -94,8 +94,8 @@ - - - + + + diff --git a/src/Immediate.Handlers.Analyzers/InvalidHandlerUsageAnalyzer.cs b/src/Immediate.Handlers.Analyzers/InvalidHandlerUsageAnalyzer.cs index e0604267..b29a2d92 100644 --- a/src/Immediate.Handlers.Analyzers/InvalidHandlerUsageAnalyzer.cs +++ b/src/Immediate.Handlers.Analyzers/InvalidHandlerUsageAnalyzer.cs @@ -70,27 +70,27 @@ private record struct InvalidSymbolLocation(Location Location, INamedTypeSymbol AllInterfaces: var interfaces, } ints when Enumerable - .Select([baseType, .. interfaces], t => GetInvalidSymbol(t, new(SymbolEqualityComparer.Default), token)) + .Select([baseType, .. interfaces], t => GetInvalidSymbol(t, [with(SymbolEqualityComparer.Default)], token)) .FirstOrDefault(x => x is { }) is { } invalidSymbol => new(GetTypeIdentifierLocation(ints, token), invalidSymbol), IParameterSymbol { Type: INamedTypeSymbol type } ips - when GetInvalidSymbol(type, new(SymbolEqualityComparer.Default), token) is { } invalidSymbol => + when GetInvalidSymbol(type, [with(SymbolEqualityComparer.Default)], token) is { } invalidSymbol => new(GetTypeLocation(ips, token), invalidSymbol), IFieldSymbol { Type: INamedTypeSymbol type } ifs - when GetInvalidSymbol(type, new(SymbolEqualityComparer.Default), token) is { } invalidSymbol => + when GetInvalidSymbol(type, [with(SymbolEqualityComparer.Default)], token) is { } invalidSymbol => new(GetTypeLocation(ifs, token), invalidSymbol), IPropertySymbol { Type: INamedTypeSymbol type } ips - when GetInvalidSymbol(type, new(SymbolEqualityComparer.Default), token) is { } invalidSymbol => + when GetInvalidSymbol(type, [with(SymbolEqualityComparer.Default)], token) is { } invalidSymbol => new(GetTypeLocation(ips, token), invalidSymbol), IMethodSymbol { ReturnType: INamedTypeSymbol type, MethodKind: not (MethodKind.PropertyGet or MethodKind.PropertySet), - } ims when GetInvalidSymbol(type, new(SymbolEqualityComparer.Default), token) is { } invalidSymbol => + } ims when GetInvalidSymbol(type, [with(SymbolEqualityComparer.Default)], token) is { } invalidSymbol => new(GetTypeLocation(ims, token), invalidSymbol), _ => null, diff --git a/tests/Immediate.Handlers.FunctionalTests/Behavior/Constraints/Tests.Base.cs b/tests/Immediate.Handlers.FunctionalTests/Behavior/Constraints/Tests.Base.cs index e9b506d6..8da87942 100644 --- a/tests/Immediate.Handlers.FunctionalTests/Behavior/Constraints/Tests.Base.cs +++ b/tests/Immediate.Handlers.FunctionalTests/Behavior/Constraints/Tests.Base.cs @@ -1,6 +1,4 @@ -using System.Diagnostics.CodeAnalysis; using Immediate.Handlers.Shared; -using Microsoft.Extensions.DependencyInjection; namespace Immediate.Handlers.FunctionalTests.Behavior.Constraints; @@ -12,21 +10,6 @@ public record C : A; public record D : B; -[SuppressMessage("Naming", "CA1707", Justification = "Test names.")] -public sealed partial class Tests -{ - private static IServiceCollection ConfigureBehaviors(IServiceCollection services) - { - _ = services.AddSingleton(); - _ = services.AddScoped(typeof(BehaviorA<,>)); - _ = services.AddScoped(typeof(BehaviorB<,>)); - _ = services.AddScoped(typeof(BehaviorC<,>)); - _ = services.AddScoped(typeof(BehaviorD<,>)); - - return services; - } -} - public sealed class BehaviorWalker { public IList BehaviorsRan { get; init; } = []; diff --git a/tests/Immediate.Handlers.FunctionalTests/Behavior/Constraints/Tests.BehaviorShouldConstrain_A.cs b/tests/Immediate.Handlers.FunctionalTests/Behavior/Constraints/Tests.BehaviorShouldConstrain_A.cs index c3fd5391..44bd2cae 100644 --- a/tests/Immediate.Handlers.FunctionalTests/Behavior/Constraints/Tests.BehaviorShouldConstrain_A.cs +++ b/tests/Immediate.Handlers.FunctionalTests/Behavior/Constraints/Tests.BehaviorShouldConstrain_A.cs @@ -25,8 +25,8 @@ public sealed partial class Tests [Fact] public async Task BehaviorShouldConstrain_A() { - IServiceCollection services = new ServiceCollection(); - services = ConfigureBehaviors(services); + var services = new ServiceCollection() + .AddSingleton(); services = BehaviorShouldConstrainA.AddHandlers(services); var serviceProvider = services.BuildServiceProvider(); diff --git a/tests/Immediate.Handlers.FunctionalTests/Behavior/Constraints/Tests.BehaviorShouldConstrain_B.cs b/tests/Immediate.Handlers.FunctionalTests/Behavior/Constraints/Tests.BehaviorShouldConstrain_B.cs index f68f49d5..c51c53a7 100644 --- a/tests/Immediate.Handlers.FunctionalTests/Behavior/Constraints/Tests.BehaviorShouldConstrain_B.cs +++ b/tests/Immediate.Handlers.FunctionalTests/Behavior/Constraints/Tests.BehaviorShouldConstrain_B.cs @@ -26,8 +26,8 @@ public sealed partial class Tests [Fact] public async Task BehaviorShouldConstrain_B() { - IServiceCollection services = new ServiceCollection(); - services = ConfigureBehaviors(services); + var services = new ServiceCollection() + .AddSingleton(); services = BehaviorShouldConstrainB.AddHandlers(services); var serviceProvider = services.BuildServiceProvider(); diff --git a/tests/Immediate.Handlers.FunctionalTests/Behavior/Constraints/Tests.BehaviorShouldConstrain_C.cs b/tests/Immediate.Handlers.FunctionalTests/Behavior/Constraints/Tests.BehaviorShouldConstrain_C.cs index fc2cb7e8..12e60d45 100644 --- a/tests/Immediate.Handlers.FunctionalTests/Behavior/Constraints/Tests.BehaviorShouldConstrain_C.cs +++ b/tests/Immediate.Handlers.FunctionalTests/Behavior/Constraints/Tests.BehaviorShouldConstrain_C.cs @@ -26,8 +26,8 @@ public sealed partial class Tests [Fact] public async Task BehaviorShouldConstrain_C() { - IServiceCollection services = new ServiceCollection(); - services = ConfigureBehaviors(services); + var services = new ServiceCollection() + .AddSingleton(); services = BehaviorShouldConstrainC.AddHandlers(services); var serviceProvider = services.BuildServiceProvider(); diff --git a/tests/Immediate.Handlers.FunctionalTests/Behavior/Constraints/Tests.BehaviorShouldConstrain_D.cs b/tests/Immediate.Handlers.FunctionalTests/Behavior/Constraints/Tests.BehaviorShouldConstrain_D.cs index 069e2349..aba3ac7e 100644 --- a/tests/Immediate.Handlers.FunctionalTests/Behavior/Constraints/Tests.BehaviorShouldConstrain_D.cs +++ b/tests/Immediate.Handlers.FunctionalTests/Behavior/Constraints/Tests.BehaviorShouldConstrain_D.cs @@ -26,8 +26,8 @@ public sealed partial class Tests [Fact] public async Task BehaviorShouldConstrain_D() { - IServiceCollection services = new ServiceCollection(); - services = ConfigureBehaviors(services); + var services = new ServiceCollection() + .AddSingleton(); services = BehaviorShouldConstrainD.AddHandlers(services); var serviceProvider = services.BuildServiceProvider(); diff --git a/tests/Immediate.Handlers.Tests/Utility.cs b/tests/Immediate.Handlers.Tests/Utility.cs index 7fa424e9..a0882567 100644 --- a/tests/Immediate.Handlers.Tests/Utility.cs +++ b/tests/Immediate.Handlers.Tests/Utility.cs @@ -23,7 +23,7 @@ public static class Utility "net11.0", new PackageIdentity( "Microsoft.NETCore.App.Ref", - "11.0.0-preview.6.26359.118" + "11.0.0-rc.1.26425.128" ), Path.Combine("ref", "net11.0") );