diff --git a/Src/FluentAssertions/AssertionExtensions.cs b/Src/FluentAssertions/AssertionExtensions.cs index a651e486b3..300a86039a 100644 --- a/Src/FluentAssertions/AssertionExtensions.cs +++ b/Src/FluentAssertions/AssertionExtensions.cs @@ -1050,9 +1050,9 @@ public static void Should(this SimpleTimeSpanAssertions + /// [Obsolete("You are asserting the 'AndConstraint' itself. Remove the 'Should()' method directly following 'And'", error: true)] - public static void Should(this TaskCompletionSourceAssertions _) + public static void Should(this TaskCompletionSourceAssertionsBase _) { InvalidShouldCall(); } @@ -1089,17 +1089,6 @@ public static void Should(this DateTimeOffsetRangeAssertions - [Obsolete("You are asserting the 'AndConstraint' itself. Remove the 'Should()' method directly following 'And'", error: true)] - public static void Should(this TaskCompletionSourceAssertions _) - { - InvalidShouldCall(); - } - -#endif - [DoesNotReturn] private static void InvalidShouldCall() { diff --git a/Src/FluentAssertions/Specialized/TaskCompletionSourceAssertions.cs b/Src/FluentAssertions/Specialized/TaskCompletionSourceAssertions.cs index 0ea3a39e34..3adc8892a0 100644 --- a/Src/FluentAssertions/Specialized/TaskCompletionSourceAssertions.cs +++ b/Src/FluentAssertions/Specialized/TaskCompletionSourceAssertions.cs @@ -26,7 +26,7 @@ public TaskCompletionSourceAssertions(TaskCompletionSource tcs, IClock clock) } /// - /// Asserts that the of the current will complete within the specified time. + /// Asserts that the of the current will complete within the specified time. /// /// The allowed time span for the operation. /// @@ -57,7 +57,7 @@ public TaskCompletionSourceAssertions(TaskCompletionSource tcs, IClock clock) } /// - /// Asserts that the of the current will not complete within the specified time. + /// Asserts that the of the current will not complete within the specified time. /// /// The time span to wait for the operation. /// @@ -189,7 +189,7 @@ protected TaskCompletionSourceAssertionsBase(IClock clock) /// /// Monitors the specified task whether it completes withing the remaining time span. /// - protected async Task CompletesWithinTimeoutAsync(Task target, TimeSpan remainingTime) + private protected async Task CompletesWithinTimeoutAsync(Task target, TimeSpan remainingTime) { using var timeoutCancellationTokenSource = new CancellationTokenSource(); diff --git a/Tests/Approval.Tests/ApprovedApi/FluentAssertions/net47.verified.txt b/Tests/Approval.Tests/ApprovedApi/FluentAssertions/net47.verified.txt index f2d2ba526e..f4c9cab2a9 100644 --- a/Tests/Approval.Tests/ApprovedApi/FluentAssertions/net47.verified.txt +++ b/Tests/Approval.Tests/ApprovedApi/FluentAssertions/net47.verified.txt @@ -43,6 +43,9 @@ namespace FluentAssertions [System.Obsolete("You are asserting the \'AndConstraint\' itself. Remove the \'Should()\' method direct" + "ly following \'And\'", true)] public static void Should(this FluentAssertions.Specialized.ExecutionTimeAssertions _) { } + [System.Obsolete("You are asserting the \'AndConstraint\' itself. Remove the \'Should()\' method direct" + + "ly following \'And\'", true)] + public static void Should(this FluentAssertions.Specialized.TaskCompletionSourceAssertionsBase _) { } public static FluentAssertions.Types.MethodInfoSelectorAssertions Should(this FluentAssertions.Types.MethodInfoSelector methodSelector) { } [System.Obsolete("You are asserting the \'AndConstraint\' itself. Remove the \'Should()\' method direct" + "ly following \'And\'", true)] @@ -135,9 +138,6 @@ namespace FluentAssertions "ly following \'And\'", true)] public static void Should(this FluentAssertions.Primitives.SimpleTimeSpanAssertions _) where TAssertions : FluentAssertions.Primitives.SimpleTimeSpanAssertions { } - [System.Obsolete("You are asserting the \'AndConstraint\' itself. Remove the \'Should()\' method direct" + - "ly following \'And\'", true)] - public static void Should(this FluentAssertions.Specialized.TaskCompletionSourceAssertions _) { } public static FluentAssertions.Collections.GenericCollectionAssertions Should(this System.Collections.Generic.IEnumerable actualValue) { } public static FluentAssertions.Specialized.GenericAsyncFunctionAssertions Should(this System.Func> action) { } public static FluentAssertions.Specialized.FunctionAssertions Should(this System.Func func) { } @@ -2348,13 +2348,17 @@ namespace FluentAssertions.Specialized public NonGenericAsyncFunctionAssertions(System.Func subject, FluentAssertions.Specialized.IExtractExceptions extractor) { } public NonGenericAsyncFunctionAssertions(System.Func subject, FluentAssertions.Specialized.IExtractExceptions extractor, FluentAssertions.Common.IClock clock) { } } - public class TaskCompletionSourceAssertions + public class TaskCompletionSourceAssertionsBase + { + protected TaskCompletionSourceAssertionsBase(FluentAssertions.Common.IClock clock) { } + public override bool Equals(object obj) { } + } + public class TaskCompletionSourceAssertions : FluentAssertions.Specialized.TaskCompletionSourceAssertionsBase { public TaskCompletionSourceAssertions(System.Threading.Tasks.TaskCompletionSource tcs) { } public TaskCompletionSourceAssertions(System.Threading.Tasks.TaskCompletionSource tcs, FluentAssertions.Common.IClock clock) { } public System.Threading.Tasks.Task, T>> CompleteWithinAsync(System.TimeSpan timeSpan, string because = "", params object[] becauseArgs) { } - public override bool Equals(object obj) { } - public System.Threading.Tasks.Task NotCompleteWithinAsync(System.TimeSpan timeSpan, string because = "", params object[] becauseArgs) { } + public System.Threading.Tasks.Task>> NotCompleteWithinAsync(System.TimeSpan timeSpan, string because = "", params object[] becauseArgs) { } } } namespace FluentAssertions.Streams diff --git a/Tests/Approval.Tests/ApprovedApi/FluentAssertions/net6.0.verified.txt b/Tests/Approval.Tests/ApprovedApi/FluentAssertions/net6.0.verified.txt index 72b667097b..b2fc685a80 100644 --- a/Tests/Approval.Tests/ApprovedApi/FluentAssertions/net6.0.verified.txt +++ b/Tests/Approval.Tests/ApprovedApi/FluentAssertions/net6.0.verified.txt @@ -43,6 +43,9 @@ namespace FluentAssertions [System.Obsolete("You are asserting the \'AndConstraint\' itself. Remove the \'Should()\' method direct" + "ly following \'And\'", true)] public static void Should(this FluentAssertions.Specialized.ExecutionTimeAssertions _) { } + [System.Obsolete("You are asserting the \'AndConstraint\' itself. Remove the \'Should()\' method direct" + + "ly following \'And\'", true)] + public static void Should(this FluentAssertions.Specialized.TaskCompletionSourceAssertionsBase _) { } public static FluentAssertions.Types.MethodInfoSelectorAssertions Should(this FluentAssertions.Types.MethodInfoSelector methodSelector) { } [System.Obsolete("You are asserting the \'AndConstraint\' itself. Remove the \'Should()\' method direct" + "ly following \'And\'", true)] @@ -148,9 +151,6 @@ namespace FluentAssertions "ly following \'And\'", true)] public static void Should(this FluentAssertions.Primitives.TimeOnlyAssertions _) where TAssertions : FluentAssertions.Primitives.TimeOnlyAssertions { } - [System.Obsolete("You are asserting the \'AndConstraint\' itself. Remove the \'Should()\' method direct" + - "ly following \'And\'", true)] - public static void Should(this FluentAssertions.Specialized.TaskCompletionSourceAssertions _) { } public static FluentAssertions.Collections.GenericCollectionAssertions Should(this System.Collections.Generic.IEnumerable actualValue) { } public static FluentAssertions.Specialized.GenericAsyncFunctionAssertions Should(this System.Func> action) { } public static FluentAssertions.Specialized.FunctionAssertions Should(this System.Func func) { } @@ -2467,21 +2467,24 @@ namespace FluentAssertions.Specialized public NonGenericAsyncFunctionAssertions(System.Func subject, FluentAssertions.Specialized.IExtractExceptions extractor) { } public NonGenericAsyncFunctionAssertions(System.Func subject, FluentAssertions.Specialized.IExtractExceptions extractor, FluentAssertions.Common.IClock clock) { } } - public class TaskCompletionSourceAssertions + public class TaskCompletionSourceAssertions : FluentAssertions.Specialized.TaskCompletionSourceAssertionsBase { public TaskCompletionSourceAssertions(System.Threading.Tasks.TaskCompletionSource tcs) { } public TaskCompletionSourceAssertions(System.Threading.Tasks.TaskCompletionSource tcs, FluentAssertions.Common.IClock clock) { } - public System.Threading.Tasks.Task CompleteWithinAsync(System.TimeSpan timeSpan, string because = "", params object[] becauseArgs) { } + public System.Threading.Tasks.Task> CompleteWithinAsync(System.TimeSpan timeSpan, string because = "", params object[] becauseArgs) { } + public System.Threading.Tasks.Task> NotCompleteWithinAsync(System.TimeSpan timeSpan, string because = "", params object[] becauseArgs) { } + } + public class TaskCompletionSourceAssertionsBase + { + protected TaskCompletionSourceAssertionsBase(FluentAssertions.Common.IClock clock) { } public override bool Equals(object obj) { } - public System.Threading.Tasks.Task NotCompleteWithinAsync(System.TimeSpan timeSpan, string because = "", params object[] becauseArgs) { } } - public class TaskCompletionSourceAssertions + public class TaskCompletionSourceAssertions : FluentAssertions.Specialized.TaskCompletionSourceAssertionsBase { public TaskCompletionSourceAssertions(System.Threading.Tasks.TaskCompletionSource tcs) { } public TaskCompletionSourceAssertions(System.Threading.Tasks.TaskCompletionSource tcs, FluentAssertions.Common.IClock clock) { } public System.Threading.Tasks.Task, T>> CompleteWithinAsync(System.TimeSpan timeSpan, string because = "", params object[] becauseArgs) { } - public override bool Equals(object obj) { } - public System.Threading.Tasks.Task NotCompleteWithinAsync(System.TimeSpan timeSpan, string because = "", params object[] becauseArgs) { } + public System.Threading.Tasks.Task>> NotCompleteWithinAsync(System.TimeSpan timeSpan, string because = "", params object[] becauseArgs) { } } } namespace FluentAssertions.Streams diff --git a/Tests/Approval.Tests/ApprovedApi/FluentAssertions/netcoreapp2.1.verified.txt b/Tests/Approval.Tests/ApprovedApi/FluentAssertions/netcoreapp2.1.verified.txt index 9e06dba6fd..326829c95c 100644 --- a/Tests/Approval.Tests/ApprovedApi/FluentAssertions/netcoreapp2.1.verified.txt +++ b/Tests/Approval.Tests/ApprovedApi/FluentAssertions/netcoreapp2.1.verified.txt @@ -43,6 +43,9 @@ namespace FluentAssertions [System.Obsolete("You are asserting the \'AndConstraint\' itself. Remove the \'Should()\' method direct" + "ly following \'And\'", true)] public static void Should(this FluentAssertions.Specialized.ExecutionTimeAssertions _) { } + [System.Obsolete("You are asserting the \'AndConstraint\' itself. Remove the \'Should()\' method direct" + + "ly following \'And\'", true)] + public static void Should(this FluentAssertions.Specialized.TaskCompletionSourceAssertionsBase _) { } public static FluentAssertions.Types.MethodInfoSelectorAssertions Should(this FluentAssertions.Types.MethodInfoSelector methodSelector) { } [System.Obsolete("You are asserting the \'AndConstraint\' itself. Remove the \'Should()\' method direct" + "ly following \'And\'", true)] @@ -135,9 +138,6 @@ namespace FluentAssertions "ly following \'And\'", true)] public static void Should(this FluentAssertions.Primitives.SimpleTimeSpanAssertions _) where TAssertions : FluentAssertions.Primitives.SimpleTimeSpanAssertions { } - [System.Obsolete("You are asserting the \'AndConstraint\' itself. Remove the \'Should()\' method direct" + - "ly following \'And\'", true)] - public static void Should(this FluentAssertions.Specialized.TaskCompletionSourceAssertions _) { } public static FluentAssertions.Collections.GenericCollectionAssertions Should(this System.Collections.Generic.IEnumerable actualValue) { } public static FluentAssertions.Specialized.GenericAsyncFunctionAssertions Should(this System.Func> action) { } public static FluentAssertions.Specialized.FunctionAssertions Should(this System.Func func) { } @@ -2348,13 +2348,17 @@ namespace FluentAssertions.Specialized public NonGenericAsyncFunctionAssertions(System.Func subject, FluentAssertions.Specialized.IExtractExceptions extractor) { } public NonGenericAsyncFunctionAssertions(System.Func subject, FluentAssertions.Specialized.IExtractExceptions extractor, FluentAssertions.Common.IClock clock) { } } - public class TaskCompletionSourceAssertions + public class TaskCompletionSourceAssertionsBase + { + protected TaskCompletionSourceAssertionsBase(FluentAssertions.Common.IClock clock) { } + public override bool Equals(object obj) { } + } + public class TaskCompletionSourceAssertions : FluentAssertions.Specialized.TaskCompletionSourceAssertionsBase { public TaskCompletionSourceAssertions(System.Threading.Tasks.TaskCompletionSource tcs) { } public TaskCompletionSourceAssertions(System.Threading.Tasks.TaskCompletionSource tcs, FluentAssertions.Common.IClock clock) { } public System.Threading.Tasks.Task, T>> CompleteWithinAsync(System.TimeSpan timeSpan, string because = "", params object[] becauseArgs) { } - public override bool Equals(object obj) { } - public System.Threading.Tasks.Task NotCompleteWithinAsync(System.TimeSpan timeSpan, string because = "", params object[] becauseArgs) { } + public System.Threading.Tasks.Task>> NotCompleteWithinAsync(System.TimeSpan timeSpan, string because = "", params object[] becauseArgs) { } } } namespace FluentAssertions.Streams diff --git a/Tests/Approval.Tests/ApprovedApi/FluentAssertions/netcoreapp3.0.verified.txt b/Tests/Approval.Tests/ApprovedApi/FluentAssertions/netcoreapp3.0.verified.txt index 26f5978a06..3cf876407b 100644 --- a/Tests/Approval.Tests/ApprovedApi/FluentAssertions/netcoreapp3.0.verified.txt +++ b/Tests/Approval.Tests/ApprovedApi/FluentAssertions/netcoreapp3.0.verified.txt @@ -43,6 +43,9 @@ namespace FluentAssertions [System.Obsolete("You are asserting the \'AndConstraint\' itself. Remove the \'Should()\' method direct" + "ly following \'And\'", true)] public static void Should(this FluentAssertions.Specialized.ExecutionTimeAssertions _) { } + [System.Obsolete("You are asserting the \'AndConstraint\' itself. Remove the \'Should()\' method direct" + + "ly following \'And\'", true)] + public static void Should(this FluentAssertions.Specialized.TaskCompletionSourceAssertionsBase _) { } public static FluentAssertions.Types.MethodInfoSelectorAssertions Should(this FluentAssertions.Types.MethodInfoSelector methodSelector) { } [System.Obsolete("You are asserting the \'AndConstraint\' itself. Remove the \'Should()\' method direct" + "ly following \'And\'", true)] @@ -135,9 +138,6 @@ namespace FluentAssertions "ly following \'And\'", true)] public static void Should(this FluentAssertions.Primitives.SimpleTimeSpanAssertions _) where TAssertions : FluentAssertions.Primitives.SimpleTimeSpanAssertions { } - [System.Obsolete("You are asserting the \'AndConstraint\' itself. Remove the \'Should()\' method direct" + - "ly following \'And\'", true)] - public static void Should(this FluentAssertions.Specialized.TaskCompletionSourceAssertions _) { } public static FluentAssertions.Collections.GenericCollectionAssertions Should(this System.Collections.Generic.IEnumerable actualValue) { } public static FluentAssertions.Specialized.GenericAsyncFunctionAssertions Should(this System.Func> action) { } public static FluentAssertions.Specialized.FunctionAssertions Should(this System.Func func) { } @@ -2348,13 +2348,17 @@ namespace FluentAssertions.Specialized public NonGenericAsyncFunctionAssertions(System.Func subject, FluentAssertions.Specialized.IExtractExceptions extractor) { } public NonGenericAsyncFunctionAssertions(System.Func subject, FluentAssertions.Specialized.IExtractExceptions extractor, FluentAssertions.Common.IClock clock) { } } - public class TaskCompletionSourceAssertions + public class TaskCompletionSourceAssertionsBase + { + protected TaskCompletionSourceAssertionsBase(FluentAssertions.Common.IClock clock) { } + public override bool Equals(object obj) { } + } + public class TaskCompletionSourceAssertions : FluentAssertions.Specialized.TaskCompletionSourceAssertionsBase { public TaskCompletionSourceAssertions(System.Threading.Tasks.TaskCompletionSource tcs) { } public TaskCompletionSourceAssertions(System.Threading.Tasks.TaskCompletionSource tcs, FluentAssertions.Common.IClock clock) { } public System.Threading.Tasks.Task, T>> CompleteWithinAsync(System.TimeSpan timeSpan, string because = "", params object[] becauseArgs) { } - public override bool Equals(object obj) { } - public System.Threading.Tasks.Task NotCompleteWithinAsync(System.TimeSpan timeSpan, string because = "", params object[] becauseArgs) { } + public System.Threading.Tasks.Task>> NotCompleteWithinAsync(System.TimeSpan timeSpan, string because = "", params object[] becauseArgs) { } } } namespace FluentAssertions.Streams diff --git a/Tests/Approval.Tests/ApprovedApi/FluentAssertions/netstandard2.0.verified.txt b/Tests/Approval.Tests/ApprovedApi/FluentAssertions/netstandard2.0.verified.txt index d64dbc6ef5..37237ba2d8 100644 --- a/Tests/Approval.Tests/ApprovedApi/FluentAssertions/netstandard2.0.verified.txt +++ b/Tests/Approval.Tests/ApprovedApi/FluentAssertions/netstandard2.0.verified.txt @@ -42,6 +42,9 @@ namespace FluentAssertions [System.Obsolete("You are asserting the \'AndConstraint\' itself. Remove the \'Should()\' method direct" + "ly following \'And\'", true)] public static void Should(this FluentAssertions.Specialized.ExecutionTimeAssertions _) { } + [System.Obsolete("You are asserting the \'AndConstraint\' itself. Remove the \'Should()\' method direct" + + "ly following \'And\'", true)] + public static void Should(this FluentAssertions.Specialized.TaskCompletionSourceAssertionsBase _) { } public static FluentAssertions.Types.MethodInfoSelectorAssertions Should(this FluentAssertions.Types.MethodInfoSelector methodSelector) { } [System.Obsolete("You are asserting the \'AndConstraint\' itself. Remove the \'Should()\' method direct" + "ly following \'And\'", true)] @@ -134,9 +137,6 @@ namespace FluentAssertions "ly following \'And\'", true)] public static void Should(this FluentAssertions.Primitives.SimpleTimeSpanAssertions _) where TAssertions : FluentAssertions.Primitives.SimpleTimeSpanAssertions { } - [System.Obsolete("You are asserting the \'AndConstraint\' itself. Remove the \'Should()\' method direct" + - "ly following \'And\'", true)] - public static void Should(this FluentAssertions.Specialized.TaskCompletionSourceAssertions _) { } public static FluentAssertions.Collections.GenericCollectionAssertions Should(this System.Collections.Generic.IEnumerable actualValue) { } public static FluentAssertions.Specialized.GenericAsyncFunctionAssertions Should(this System.Func> action) { } public static FluentAssertions.Specialized.FunctionAssertions Should(this System.Func func) { } @@ -2300,13 +2300,17 @@ namespace FluentAssertions.Specialized public NonGenericAsyncFunctionAssertions(System.Func subject, FluentAssertions.Specialized.IExtractExceptions extractor) { } public NonGenericAsyncFunctionAssertions(System.Func subject, FluentAssertions.Specialized.IExtractExceptions extractor, FluentAssertions.Common.IClock clock) { } } - public class TaskCompletionSourceAssertions + public class TaskCompletionSourceAssertionsBase + { + protected TaskCompletionSourceAssertionsBase(FluentAssertions.Common.IClock clock) { } + public override bool Equals(object obj) { } + } + public class TaskCompletionSourceAssertions : FluentAssertions.Specialized.TaskCompletionSourceAssertionsBase { public TaskCompletionSourceAssertions(System.Threading.Tasks.TaskCompletionSource tcs) { } public TaskCompletionSourceAssertions(System.Threading.Tasks.TaskCompletionSource tcs, FluentAssertions.Common.IClock clock) { } public System.Threading.Tasks.Task, T>> CompleteWithinAsync(System.TimeSpan timeSpan, string because = "", params object[] becauseArgs) { } - public override bool Equals(object obj) { } - public System.Threading.Tasks.Task NotCompleteWithinAsync(System.TimeSpan timeSpan, string because = "", params object[] becauseArgs) { } + public System.Threading.Tasks.Task>> NotCompleteWithinAsync(System.TimeSpan timeSpan, string because = "", params object[] becauseArgs) { } } } namespace FluentAssertions.Streams diff --git a/Tests/Approval.Tests/ApprovedApi/FluentAssertions/netstandard2.1.verified.txt b/Tests/Approval.Tests/ApprovedApi/FluentAssertions/netstandard2.1.verified.txt index fdddf3faf8..7cb0960b6b 100644 --- a/Tests/Approval.Tests/ApprovedApi/FluentAssertions/netstandard2.1.verified.txt +++ b/Tests/Approval.Tests/ApprovedApi/FluentAssertions/netstandard2.1.verified.txt @@ -43,6 +43,9 @@ namespace FluentAssertions [System.Obsolete("You are asserting the \'AndConstraint\' itself. Remove the \'Should()\' method direct" + "ly following \'And\'", true)] public static void Should(this FluentAssertions.Specialized.ExecutionTimeAssertions _) { } + [System.Obsolete("You are asserting the \'AndConstraint\' itself. Remove the \'Should()\' method direct" + + "ly following \'And\'", true)] + public static void Should(this FluentAssertions.Specialized.TaskCompletionSourceAssertionsBase _) { } public static FluentAssertions.Types.MethodInfoSelectorAssertions Should(this FluentAssertions.Types.MethodInfoSelector methodSelector) { } [System.Obsolete("You are asserting the \'AndConstraint\' itself. Remove the \'Should()\' method direct" + "ly following \'And\'", true)] @@ -135,9 +138,6 @@ namespace FluentAssertions "ly following \'And\'", true)] public static void Should(this FluentAssertions.Primitives.SimpleTimeSpanAssertions _) where TAssertions : FluentAssertions.Primitives.SimpleTimeSpanAssertions { } - [System.Obsolete("You are asserting the \'AndConstraint\' itself. Remove the \'Should()\' method direct" + - "ly following \'And\'", true)] - public static void Should(this FluentAssertions.Specialized.TaskCompletionSourceAssertions _) { } public static FluentAssertions.Collections.GenericCollectionAssertions Should(this System.Collections.Generic.IEnumerable actualValue) { } public static FluentAssertions.Specialized.GenericAsyncFunctionAssertions Should(this System.Func> action) { } public static FluentAssertions.Specialized.FunctionAssertions Should(this System.Func func) { } @@ -2348,13 +2348,17 @@ namespace FluentAssertions.Specialized public NonGenericAsyncFunctionAssertions(System.Func subject, FluentAssertions.Specialized.IExtractExceptions extractor) { } public NonGenericAsyncFunctionAssertions(System.Func subject, FluentAssertions.Specialized.IExtractExceptions extractor, FluentAssertions.Common.IClock clock) { } } - public class TaskCompletionSourceAssertions + public class TaskCompletionSourceAssertionsBase + { + protected TaskCompletionSourceAssertionsBase(FluentAssertions.Common.IClock clock) { } + public override bool Equals(object obj) { } + } + public class TaskCompletionSourceAssertions : FluentAssertions.Specialized.TaskCompletionSourceAssertionsBase { public TaskCompletionSourceAssertions(System.Threading.Tasks.TaskCompletionSource tcs) { } public TaskCompletionSourceAssertions(System.Threading.Tasks.TaskCompletionSource tcs, FluentAssertions.Common.IClock clock) { } public System.Threading.Tasks.Task, T>> CompleteWithinAsync(System.TimeSpan timeSpan, string because = "", params object[] becauseArgs) { } - public override bool Equals(object obj) { } - public System.Threading.Tasks.Task NotCompleteWithinAsync(System.TimeSpan timeSpan, string because = "", params object[] becauseArgs) { } + public System.Threading.Tasks.Task>> NotCompleteWithinAsync(System.TimeSpan timeSpan, string because = "", params object[] becauseArgs) { } } } namespace FluentAssertions.Streams diff --git a/Tests/FluentAssertions.Specs/AssertionExtensionsSpecs.cs b/Tests/FluentAssertions.Specs/AssertionExtensionsSpecs.cs index 920d89afe5..ef6d97af10 100644 --- a/Tests/FluentAssertions.Specs/AssertionExtensionsSpecs.cs +++ b/Tests/FluentAssertions.Specs/AssertionExtensionsSpecs.cs @@ -56,7 +56,6 @@ private static bool OverridesEquals(Type t) #if NET6_0_OR_GREATER new object[] { new DateOnlyAssertions(default) }, new object[] { new TimeOnlyAssertions(default) }, - new object[] { new TaskCompletionSourceAssertions(default) } #endif }; @@ -84,13 +83,12 @@ public void Guarding_equals_throws(object obj) [InlineData(typeof(NumericAssertions>))] [InlineData(typeof(PropertyInfoSelectorAssertions))] [InlineData(typeof(SimpleTimeSpanAssertions))] - [InlineData(typeof(TaskCompletionSourceAssertions))] + [InlineData(typeof(TaskCompletionSourceAssertionsBase))] [InlineData(typeof(TypeSelectorAssertions))] [InlineData(typeof(EnumAssertions>))] #if NET6_0_OR_GREATER [InlineData(typeof(DateOnlyAssertions))] [InlineData(typeof(TimeOnlyAssertions))] - [InlineData(typeof(TaskCompletionSourceAssertions))] #endif public void Fake_should_method_throws(Type type) { @@ -136,11 +134,13 @@ public void Should_methods_have_a_matching_overload_to_guard_against_chaining_an .Distinct() .Concat(new[] { + // @jnyrup: DateTimeRangeAssertions and DateTimeOffsetRangeAssertions are manually added here, + // because they expose AndConstraints, + // and hence should have a guarding Should(DateTimeRangeAssertions _) overloads, + // but they do not have a regular Should() overload, + // as they are always constructed through the fluent API. typeof(DateTimeRangeAssertions<>), typeof(DateTimeOffsetRangeAssertions<>), -#if NET6_0_OR_GREATER - typeof(TaskCompletionSourceAssertions), -#endif }) .ToList();