diff --git a/Directory.Packages.props b/Directory.Packages.props index 6fb20cffc..982264e16 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -39,7 +39,7 @@ - + diff --git a/test/Dap.Tests/FoundationTests.cs b/test/Dap.Tests/FoundationTests.cs index f592e298a..a73c92d20 100644 --- a/test/Dap.Tests/FoundationTests.cs +++ b/test/Dap.Tests/FoundationTests.cs @@ -249,7 +249,7 @@ public void HandlersShouldHaveExpectedExtensionMethodsBasedOnDirection( extensionClass.GetMethods(BindingFlags.Static | BindingFlags.Public) .Where(z => z.Name == onMethodName) .Where(z => item.matcher(z.GetParameters()[0])) - .Should().HaveCountGreaterOrEqualTo(1, $"{descriptor.HandlerType.FullName} is missing a registry implementation for {item.type}"); + .Should().HaveCountGreaterThanOrEqualTo(1, $"{descriptor.HandlerType.FullName} is missing a registry implementation for {item.type}"); } foreach (var item in expectedRequestHandlers) @@ -257,7 +257,7 @@ public void HandlersShouldHaveExpectedExtensionMethodsBasedOnDirection( extensionClass.GetMethods(BindingFlags.Static | BindingFlags.Public) .Where(z => z.Name == sendMethodName) .Where(z => item.matcher(z.GetParameters()[0])) - .Should().HaveCountGreaterOrEqualTo(1, $"{descriptor.HandlerType.FullName} is missing a request implementation for {item.type}"); + .Should().HaveCountGreaterThanOrEqualTo(1, $"{descriptor.HandlerType.FullName} is missing a request implementation for {item.type}"); } { @@ -268,7 +268,7 @@ Func ForParameter(int index, Func m) return info => m(info.GetParameters()[index]); } - var containsCancellationToken = ForParameter(1, info => info.ParameterType.GetGenericArguments().Reverse().Take(2).Any(x => x == typeof(CancellationToken))); + var containsCancellationToken = ForParameter(1, info => info.ParameterType.GetGenericArguments().AsEnumerable().Reverse().Take(2).Any(x => x == typeof(CancellationToken))); var returnType = descriptor.HasResponseType ? typeof(Task<>).MakeGenericType(descriptor.ResponseType!) : typeof(Task); var returns = ForParameter(1, info => info.ParameterType.GetGenericArguments().LastOrDefault() == returnType); var isAction = ForParameter(1, info => info.ParameterType.Name.StartsWith(nameof(Action))); @@ -291,7 +291,7 @@ Func ForParameter(int index, Func m) } { var matcher = new MethodMatcher(sendMethodRegistries, descriptor, extensionClass, sendMethodName); - Func containsCancellationToken = info => info.GetParameters().Reverse().Take(2).Any(x => x.ParameterType == typeof(CancellationToken)); + Func containsCancellationToken = info => info.GetParameters().AsEnumerable().Reverse().Take(2).Any(x => x.ParameterType == typeof(CancellationToken)); var returnType = descriptor.HasResponseType ? typeof(Task<>).MakeGenericType(descriptor.ResponseType!) : typeof(Task); Func returns = info => info.ReturnType == returnType; Func isAction = info => info.ReturnType.Name == "Void"; diff --git a/test/Lsp.Integration.Tests/FluentAssertionsExtensions.cs b/test/Lsp.Integration.Tests/FluentAssertionsExtensions.cs index cbb682d93..49c450c92 100644 --- a/test/Lsp.Integration.Tests/FluentAssertionsExtensions.cs +++ b/test/Lsp.Integration.Tests/FluentAssertionsExtensions.cs @@ -9,7 +9,7 @@ namespace Lsp.Integration.Tests { public static class FluentAssertionsExtensions { - public static EquivalencyAssertionOptions ConfigureForSupports(this EquivalencyAssertionOptions options, ILogger? logger = null) + public static EquivalencyOptions ConfigureForSupports(this EquivalencyOptions options, ILogger? logger = null) { return options .WithTracing(new TraceWriter(logger ?? NullLogger.Instance)) diff --git a/test/Lsp.Tests/FluentAssertionsExtensions.cs b/test/Lsp.Tests/FluentAssertionsExtensions.cs index 7378b1acc..74afac78d 100644 --- a/test/Lsp.Tests/FluentAssertionsExtensions.cs +++ b/test/Lsp.Tests/FluentAssertionsExtensions.cs @@ -9,7 +9,7 @@ namespace Lsp.Tests { public static class FluentAssertionsExtensions { - public static EquivalencyAssertionOptions ConfigureForSupports(this EquivalencyAssertionOptions options, ILogger? logger = null) + public static EquivalencyOptions ConfigureForSupports(this EquivalencyOptions options, ILogger? logger = null) { return options .WithTracing(new TraceWriter(logger ?? NullLogger.Instance)) diff --git a/test/Lsp.Tests/FoundationTests.cs b/test/Lsp.Tests/FoundationTests.cs index a46838a9c..74d40e816 100644 --- a/test/Lsp.Tests/FoundationTests.cs +++ b/test/Lsp.Tests/FoundationTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics; using System.IO.Pipelines; @@ -262,13 +262,13 @@ public void HandlersShouldExtensionMethodClassWithMethods( { registries .Where(z => typeof(ILanguageClientProxy).IsAssignableFrom(z) || typeof(ILanguageServerRegistry).IsAssignableFrom(z)) - .Should().HaveCountGreaterOrEqualTo( + .Should().HaveCountGreaterThanOrEqualTo( 1, $"{descriptor.HandlerType.FullName} there should be methods for both handing the event and sending the event" ); registries .Where(z => typeof(ILanguageServerProxy).IsAssignableFrom(z) || typeof(ILanguageClientRegistry).IsAssignableFrom(z)) - .Should().HaveCountGreaterOrEqualTo( + .Should().HaveCountGreaterThanOrEqualTo( 1, $"{descriptor.HandlerType.FullName} there should be methods for both handing the event and sending the event" ); @@ -277,7 +277,7 @@ public void HandlersShouldExtensionMethodClassWithMethods( { registries .Where(z => typeof(ILanguageServerProxy).IsAssignableFrom(z) || typeof(ILanguageClientRegistry).IsAssignableFrom(z)) - .Should().HaveCountGreaterOrEqualTo( + .Should().HaveCountGreaterThanOrEqualTo( 1, $"{descriptor.HandlerType.FullName} there should be methods for both handing the event and sending the event" ); @@ -289,7 +289,7 @@ public void HandlersShouldExtensionMethodClassWithMethods( { registries .Where(z => typeof(ILanguageClientProxy).IsAssignableFrom(z) || typeof(ILanguageServerRegistry).IsAssignableFrom(z)) - .Should().HaveCountGreaterOrEqualTo( + .Should().HaveCountGreaterThanOrEqualTo( 1, $"{descriptor.HandlerType.FullName} there should be methods for both handing the event and sending the event" ); @@ -341,7 +341,7 @@ public void HandlersShouldHaveExpectedExtensionMethodsBasedOnDirection( extensionClass.GetMethods(BindingFlags.Static | BindingFlags.Public) .Where(z => z.Name == onMethodName) .Where(z => item.matcher(z.GetParameters()[0])) - .Should().HaveCountGreaterOrEqualTo(1, $"{descriptor.HandlerType.FullName} is missing a registry implementation for {item.type}"); + .Should().HaveCountGreaterThanOrEqualTo(1, $"{descriptor.HandlerType.FullName} is missing a registry implementation for {item.type}"); } foreach (var item in expectedRequestHandlers) @@ -349,7 +349,7 @@ public void HandlersShouldHaveExpectedExtensionMethodsBasedOnDirection( extensionClass.GetMethods(BindingFlags.Static | BindingFlags.Public) .Where(z => z.Name == sendMethodName) .Where(z => item.matcher(z.GetParameters()[0])) - .Should().HaveCountGreaterOrEqualTo(1, $"{descriptor.HandlerType.FullName} is missing a request implementation for {item.type}"); + .Should().HaveCountGreaterThanOrEqualTo(1, $"{descriptor.HandlerType.FullName} is missing a request implementation for {item.type}"); } } @@ -386,7 +386,7 @@ Func ForAnyParameter(Func m) } var containsCancellationToken = ForAnyParameter( - info => info.ParameterType.GetGenericArguments().Reverse().Take(2).Any(x => x == typeof(CancellationToken)) + info => info.ParameterType.GetGenericArguments().AsEnumerable().Reverse().Take(2).Any(x => x == typeof(CancellationToken)) ); var returnType = descriptor.HasResponseType ? typeof(Task<>).MakeGenericType(descriptor.ResponseType!) : typeof(Task); var returns = ForAnyParameter(info => info.ParameterType.GetGenericArguments().LastOrDefault() == returnType); @@ -517,7 +517,7 @@ Func ForAnyParameter(Func m) { var matcher = new MethodMatcher(sendMethodRegistries, descriptor, extensionClass); Func containsCancellationToken = - info => info.GetParameters().Reverse().Take(2).Any(x => x.ParameterType == typeof(CancellationToken)); + info => info.GetParameters().AsEnumerable().Reverse().Take(2).Any(x => x.ParameterType == typeof(CancellationToken)); var returnType = descriptor.HasResponseType ? typeof(Task<>).MakeGenericType(descriptor.ResponseType!) : typeof(Task); Func returns = info => info.ReturnType == returnType; Func isAction = info => info.ReturnType.Name == "Void"; diff --git a/test/Lsp.Tests/Models/PositionTests.cs b/test/Lsp.Tests/Models/PositionTests.cs index 180b0e8fd..81a525675 100644 --- a/test/Lsp.Tests/Models/PositionTests.cs +++ b/test/Lsp.Tests/Models/PositionTests.cs @@ -34,8 +34,8 @@ public void Is_Sortable_By_Character() a.CompareTo(c).Should().Be(0); - a.Should().BeLessOrEqualTo(c); - a.Should().BeGreaterOrEqualTo(c); + a.Should().BeLessThanOrEqualTo(c); + a.Should().BeGreaterThanOrEqualTo(c); } [Fact] @@ -50,8 +50,8 @@ public void Is_Sortable_By_Line() a.CompareTo(c).Should().Be(0); - a.Should().BeLessOrEqualTo(c); - a.Should().BeGreaterOrEqualTo(c); + a.Should().BeLessThanOrEqualTo(c); + a.Should().BeGreaterThanOrEqualTo(c); } [Fact] diff --git a/test/TestingUtils/RecordExtensions.cs b/test/TestingUtils/RecordExtensions.cs index a3c574d35..7e185f4c4 100644 --- a/test/TestingUtils/RecordExtensions.cs +++ b/test/TestingUtils/RecordExtensions.cs @@ -1,12 +1,12 @@ -using FluentAssertions.Equivalency; +using FluentAssertions.Equivalency; namespace TestingUtils { public static class RecordExtensions { - public static EquivalencyAssertionOptions UsingStructuralRecordEquality(this EquivalencyAssertionOptions options) + public static EquivalencyOptions UsingStructuralRecordEquality(this EquivalencyOptions options) { return options.Using(new RecordStructuralEqualityEquivalencyStep()); } } -} \ No newline at end of file +} diff --git a/test/TestingUtils/RecordStructuralEqualityEquivalencyStep.cs b/test/TestingUtils/RecordStructuralEqualityEquivalencyStep.cs index c874e8499..5ebd63621 100644 --- a/test/TestingUtils/RecordStructuralEqualityEquivalencyStep.cs +++ b/test/TestingUtils/RecordStructuralEqualityEquivalencyStep.cs @@ -5,9 +5,9 @@ namespace TestingUtils { public class RecordStructuralEqualityEquivalencyStep : StructuralEqualityEquivalencyStep, IEquivalencyStep { - EquivalencyResult IEquivalencyStep.Handle(Comparands comparands, IEquivalencyValidationContext context, IEquivalencyValidator nestedValidator) + EquivalencyResult IEquivalencyStep.Handle(Comparands comparands, IEquivalencyValidationContext context, IValidateChildNodeEquivalency nestedValidator) { - return comparands.Subject?.GetType()?.GetMethod("$") != null ? EquivalencyResult.AssertionCompleted : EquivalencyResult.ContinueWithNext; + return comparands.Subject?.GetType()?.GetMethod("$") != null ? EquivalencyResult.EquivalencyProven : EquivalencyResult.ContinueWithNext; } } }