From c8d3444cb5838965ceed3772ad05bfb80ad8a074 Mon Sep 17 00:00:00 2001 From: Ian Griffiths Date: Thu, 9 Oct 2025 07:06:37 +0100 Subject: [PATCH 1/5] Upgrade to xunit 2.9.3, FluentAssertions 7.2.0 --- Ix.NET/Source/Directory.Build.props | 2 +- ...m.Interactive.Async.Providers.Tests.csproj | 4 +-- .../AsyncTests.Bugs.cs | 2 +- .../System.Interactive.Async.Tests.csproj | 9 ++++-- .../System/Linq/Operators/Amb.cs | 8 ++--- .../System/Linq/Operators/Timeout.cs | 8 ++--- .../TaskExtTests.cs | 4 +-- .../System.Interactive.Tests.csproj | 9 ++++-- .../System.Linq.Async.Queryable.Tests.csproj | 9 ++++-- .../System.Linq.Async.Tests.csproj | 9 ++++-- .../System/Linq/Operators/Range.cs | 5 ++-- .../System/Linq/Operators/Reverse.cs | 4 +-- .../System/Linq/Operators/Select.cs | 6 ++-- .../System/Linq/Operators/Skip.cs | 30 +++++++++++-------- .../System/Linq/Operators/Take.cs | 30 +++++++++++-------- .../Linq/Operators/ToAsyncEnumerable.cs | 22 ++++++++++---- .../ValueTaskHelpers.cs | 4 +-- ...sts.System.Interactive.ApiApprovals.csproj | 6 ++-- 18 files changed, 103 insertions(+), 68 deletions(-) diff --git a/Ix.NET/Source/Directory.Build.props b/Ix.NET/Source/Directory.Build.props index b21a713515..1deaa23a3d 100644 --- a/Ix.NET/Source/Directory.Build.props +++ b/Ix.NET/Source/Directory.Build.props @@ -38,7 +38,7 @@ - + diff --git a/Ix.NET/Source/System.Interactive.Async.Providers.Tests/System.Interactive.Async.Providers.Tests.csproj b/Ix.NET/Source/System.Interactive.Async.Providers.Tests/System.Interactive.Async.Providers.Tests.csproj index 0f4fbb98c1..8aaef8f088 100644 --- a/Ix.NET/Source/System.Interactive.Async.Providers.Tests/System.Interactive.Async.Providers.Tests.csproj +++ b/Ix.NET/Source/System.Interactive.Async.Providers.Tests/System.Interactive.Async.Providers.Tests.csproj @@ -18,11 +18,11 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/Ix.NET/Source/System.Interactive.Async.Tests/AsyncTests.Bugs.cs b/Ix.NET/Source/System.Interactive.Async.Tests/AsyncTests.Bugs.cs index 8bc478c5a0..3c53dac8a2 100644 --- a/Ix.NET/Source/System.Interactive.Async.Tests/AsyncTests.Bugs.cs +++ b/Ix.NET/Source/System.Interactive.Async.Tests/AsyncTests.Bugs.cs @@ -22,7 +22,7 @@ public AsyncTests() } [Fact] - public async void CorrectDispose() + public async Task CorrectDispose() { var disposed = new TaskCompletionSource(); diff --git a/Ix.NET/Source/System.Interactive.Async.Tests/System.Interactive.Async.Tests.csproj b/Ix.NET/Source/System.Interactive.Async.Tests/System.Interactive.Async.Tests.csproj index 99ef36d686..5b350924e8 100644 --- a/Ix.NET/Source/System.Interactive.Async.Tests/System.Interactive.Async.Tests.csproj +++ b/Ix.NET/Source/System.Interactive.Async.Tests/System.Interactive.Async.Tests.csproj @@ -24,9 +24,12 @@ - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + diff --git a/Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Amb.cs b/Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Amb.cs index e040ec5331..5be54a86f9 100644 --- a/Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Amb.cs +++ b/Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Amb.cs @@ -242,7 +242,7 @@ public async Task Amb_First_GetAsyncEnumerator_Crashes() { await xs.MoveNextAsync(); - Assert.False(true, "Should not have gotten here"); + Assert.Fail("Should not have gotten here"); } catch (InvalidOperationException) { @@ -265,7 +265,7 @@ public async Task Amb_Second_GetAsyncEnumerator_Crashes() { await xs.MoveNextAsync(); - Assert.False(true, "Should not have gotten here"); + Assert.Fail("Should not have gotten here"); } catch (InvalidOperationException) { @@ -292,7 +292,7 @@ public async Task Amb_Many_First_GetAsyncEnumerator_Crashes() { await xs.MoveNextAsync(); - Assert.False(true, "Should not have gotten here"); + Assert.Fail("Should not have gotten here"); } catch (InvalidOperationException) { @@ -319,7 +319,7 @@ public async Task Amb_Many_Last_GetAsyncEnumerator_Crashes() { await xs.MoveNextAsync(); - Assert.False(true, "Should not have gotten here"); + Assert.Fail("Should not have gotten here"); } catch (InvalidOperationException) { diff --git a/Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Timeout.cs b/Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Timeout.cs index 98566da895..bc4327301e 100644 --- a/Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Timeout.cs +++ b/Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Timeout.cs @@ -23,7 +23,7 @@ public async Task Timeout_Never() { await en.MoveNextAsync(); - Assert.False(true, "MoveNextAsync should have thrown"); + Assert.Fail("MoveNextAsync should have thrown"); } catch (TimeoutException) { @@ -48,7 +48,7 @@ public async Task Timeout_Double_Never() { await en.MoveNextAsync(); - Assert.False(true, "MoveNextAsync should have thrown"); + Assert.Fail("MoveNextAsync should have thrown"); } catch (TimeoutException) { @@ -77,7 +77,7 @@ public async Task Timeout_Delayed_Main() { await en.MoveNextAsync(); - Assert.False(true, "MoveNextAsync should have thrown"); + Assert.Fail("MoveNextAsync should have thrown"); } catch (TimeoutException) { @@ -115,7 +115,7 @@ public async Task Timeout_Delayed_Main_Canceled() { await en.MoveNextAsync(); - Assert.False(true, "MoveNextAsync should have thrown"); + Assert.Fail("MoveNextAsync should have thrown"); } catch (TimeoutException) { diff --git a/Ix.NET/Source/System.Interactive.Async.Tests/TaskExtTests.cs b/Ix.NET/Source/System.Interactive.Async.Tests/TaskExtTests.cs index 2ed1a22d8c..4c61d215ea 100644 --- a/Ix.NET/Source/System.Interactive.Async.Tests/TaskExtTests.cs +++ b/Ix.NET/Source/System.Interactive.Async.Tests/TaskExtTests.cs @@ -22,7 +22,7 @@ public async Task ExceptionHandling_ShouldThrowUnwrappedException() } catch (AggregateException) { - Assert.True(false, "AggregateException has been thrown instead of InvalidOperationException"); + Assert.Fail("AggregateException has been thrown instead of InvalidOperationException"); } catch (InvalidOperationException) { @@ -45,7 +45,7 @@ public async Task ExceptionHandling_ShouldThrowUnwrappedException2() } catch (AggregateException) { - Assert.True(false, "AggregateException has been thrown instead of InvalidOperationException"); + Assert.Fail("AggregateException has been thrown instead of InvalidOperationException"); } catch (InvalidOperationException) { diff --git a/Ix.NET/Source/System.Interactive.Tests/System.Interactive.Tests.csproj b/Ix.NET/Source/System.Interactive.Tests/System.Interactive.Tests.csproj index 634d28bdb4..f87e150383 100644 --- a/Ix.NET/Source/System.Interactive.Tests/System.Interactive.Tests.csproj +++ b/Ix.NET/Source/System.Interactive.Tests/System.Interactive.Tests.csproj @@ -22,9 +22,12 @@ - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + diff --git a/Ix.NET/Source/System.Linq.Async.Queryable.Tests/System.Linq.Async.Queryable.Tests.csproj b/Ix.NET/Source/System.Linq.Async.Queryable.Tests/System.Linq.Async.Queryable.Tests.csproj index b5a0dc04d1..218a22bfd0 100644 --- a/Ix.NET/Source/System.Linq.Async.Queryable.Tests/System.Linq.Async.Queryable.Tests.csproj +++ b/Ix.NET/Source/System.Linq.Async.Queryable.Tests/System.Linq.Async.Queryable.Tests.csproj @@ -18,9 +18,12 @@ - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + diff --git a/Ix.NET/Source/System.Linq.Async.Tests/System.Linq.Async.Tests.csproj b/Ix.NET/Source/System.Linq.Async.Tests/System.Linq.Async.Tests.csproj index ed1c232efc..17e64f6cb5 100644 --- a/Ix.NET/Source/System.Linq.Async.Tests/System.Linq.Async.Tests.csproj +++ b/Ix.NET/Source/System.Linq.Async.Tests/System.Linq.Async.Tests.csproj @@ -46,9 +46,12 @@ - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + diff --git a/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Range.cs b/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Range.cs index 1b27d1ed01..e6a76d0463 100644 --- a/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Range.cs +++ b/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Range.cs @@ -63,8 +63,9 @@ public async Task Range_Simple_IAsyncPartition() Assert.Equal(2, await xs.Take(1024).FirstAsync()); Assert.Equal(6, await xs.Take(1024).LastAsync()); - Assert.Equal([2, 3, 4, 5, 6], await xs.ToArrayAsync()); - Assert.Equal(new[] { 2, 3, 4, 5, 6 }, await xs.ToListAsync()); + int[] expected = [2, 3, 4, 5, 6]; + Assert.Equal(expected, await xs.ToArrayAsync()); + Assert.Equal(expected, await xs.ToListAsync()); } [Fact] diff --git a/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Reverse.cs b/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Reverse.cs index aacf431da1..cf09f8935e 100644 --- a/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Reverse.cs +++ b/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Reverse.cs @@ -68,7 +68,7 @@ public async Task Reverse5() var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); var ys = xs.Reverse(); - Assert.Equal([3, 2, 1], await ys.ToArrayAsync()); + Assert.Equal((int[])[3, 2, 1], await ys.ToArrayAsync()); } [Fact] @@ -104,7 +104,7 @@ public async Task Reverse9() var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); var ys = xs.Reverse().Prepend(4); // to trigger onlyIfCheap - Assert.Equal([4, 3, 2, 1], await ys.ToArrayAsync()); + Assert.Equal((int[])[4, 3, 2, 1], await ys.ToArrayAsync()); } } } diff --git a/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Select.cs b/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Select.cs index 65db9e8de8..b54d9d7f2e 100644 --- a/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Select.cs +++ b/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Select.cs @@ -278,7 +278,7 @@ public async Task Select_Sync_IList_ToArray() var xs = ToAsyncEnumerableIList([1, 2, 3, 4, 5]); var ys = xs.Select(x => x * 2); - Assert.Equal([2, 4, 6, 8, 10], await ys.ToArrayAsync()); + Assert.Equal((int[])[2, 4, 6, 8, 10], await ys.ToArrayAsync()); } [Fact] @@ -545,7 +545,7 @@ public async Task SelectAwait_IList_ToArray() var xs = ToAsyncEnumerableIList([1, 2, 3, 4, 5]); var ys = xs.SelectAwait(x => new ValueTask(x * 2)); - Assert.Equal([2, 4, 6, 8, 10], await ys.ToArrayAsync()); + Assert.Equal((int[])[2, 4, 6, 8, 10], await ys.ToArrayAsync()); } #if !NO_DEEP_CANCELLATION @@ -814,7 +814,7 @@ public async Task SelectAwaitWithCancellation_IList_ToArray() var xs = ToAsyncEnumerableIList([1, 2, 3, 4, 5]); var ys = xs.SelectAwaitWithCancellation((int x, CancellationToken ct) => new ValueTask(x * 2)); - Assert.Equal([2, 4, 6, 8, 10], await ys.ToArrayAsync()); + Assert.Equal((int[])[2, 4, 6, 8, 10], await ys.ToArrayAsync()); } #endif diff --git a/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Skip.cs b/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Skip.cs index 3a358fa074..557162f2a1 100644 --- a/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Skip.cs +++ b/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Skip.cs @@ -123,8 +123,9 @@ public async Task Skip_IAsyncPartition_NonEmpty_Skip() Assert.Equal(3, await ys.ElementAtAsync(0)); Assert.Equal(4, await ys.ElementAtAsync(1)); - Assert.Equal([3, 4], await ys.ToArrayAsync()); - Assert.Equal(new[] { 3, 4 }, await ys.ToListAsync()); + int[] expected = [3, 4]; + Assert.Equal(expected, await ys.ToArrayAsync()); + Assert.Equal(expected, await ys.ToListAsync()); } [Fact] @@ -141,8 +142,9 @@ public async Task Skip_IAsyncPartition_NonEmpty_SkipSkip() Assert.Equal(3, await ys.ElementAtAsync(0)); Assert.Equal(4, await ys.ElementAtAsync(1)); - Assert.Equal([3, 4], await ys.ToArrayAsync()); - Assert.Equal(new[] { 3, 4 }, await ys.ToListAsync()); + int[] expected = [3, 4]; + Assert.Equal(expected, await ys.ToArrayAsync()); + Assert.Equal(expected, await ys.ToListAsync()); } [Fact] @@ -159,8 +161,9 @@ public async Task Skip_IAsyncPartition_NonEmpty_SkipTake() Assert.Equal(3, await ys.ElementAtAsync(0)); Assert.Equal(4, await ys.ElementAtAsync(1)); - Assert.Equal([3, 4], await ys.ToArrayAsync()); - Assert.Equal(new[] { 3, 4 }, await ys.ToListAsync()); + int[] expected = [3, 4]; + Assert.Equal(expected, await ys.ToArrayAsync()); + Assert.Equal(expected, await ys.ToListAsync()); } [Fact] @@ -213,8 +216,9 @@ public async Task Skip_IAsyncPartition_IList_NonEmpty_Skip() Assert.Equal(3, await ys.ElementAtAsync(0)); Assert.Equal(4, await ys.ElementAtAsync(1)); - Assert.Equal([3, 4], await ys.ToArrayAsync()); - Assert.Equal(new[] { 3, 4 }, await ys.ToListAsync()); + int[] expected = [3, 4]; + Assert.Equal(expected, await ys.ToArrayAsync()); + Assert.Equal(expected, await ys.ToListAsync()); } [Fact] @@ -231,8 +235,9 @@ public async Task Skip_IAsyncPartition_IList_NonEmpty_SkipSkip() Assert.Equal(3, await ys.ElementAtAsync(0)); Assert.Equal(4, await ys.ElementAtAsync(1)); - Assert.Equal([3, 4], await ys.ToArrayAsync()); - Assert.Equal(new[] { 3, 4 }, await ys.ToListAsync()); + int[] expected = [3, 4]; + Assert.Equal(expected, await ys.ToArrayAsync()); + Assert.Equal(expected, await ys.ToListAsync()); } [Fact] @@ -249,8 +254,9 @@ public async Task Skip_IAsyncPartition_IList_NonEmpty_SkipTake() Assert.Equal(3, await ys.ElementAtAsync(0)); Assert.Equal(4, await ys.ElementAtAsync(1)); - Assert.Equal([3, 4], await ys.ToArrayAsync()); - Assert.Equal(new[] { 3, 4 }, await ys.ToListAsync()); + int[] expected = [3, 4]; + Assert.Equal(expected, await ys.ToArrayAsync()); + Assert.Equal(expected, await ys.ToListAsync()); } [Fact] diff --git a/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Take.cs b/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Take.cs index 451fbcece0..8c4365eb4e 100644 --- a/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Take.cs +++ b/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Take.cs @@ -143,8 +143,9 @@ public async Task Take_IAsyncPartition_NonEmpty_Take() Assert.Equal(1, await ys.ElementAtAsync(0)); Assert.Equal(2, await ys.ElementAtAsync(1)); - Assert.Equal([1, 2], await ys.ToArrayAsync()); - Assert.Equal(new[] { 1, 2 }, await ys.ToListAsync()); + int[] expected = [1, 2]; + Assert.Equal(expected, await ys.ToArrayAsync()); + Assert.Equal(expected, await ys.ToListAsync()); } [Fact] @@ -161,8 +162,9 @@ public async Task Take_IAsyncPartition_NonEmpty_TakeTake() Assert.Equal(1, await ys.ElementAtAsync(0)); Assert.Equal(2, await ys.ElementAtAsync(1)); - Assert.Equal([1, 2], await ys.ToArrayAsync()); - Assert.Equal(new[] { 1, 2 }, await ys.ToListAsync()); + int[] expected = [1, 2]; + Assert.Equal(expected, await ys.ToArrayAsync()); + Assert.Equal(expected, await ys.ToListAsync()); } [Fact] @@ -179,8 +181,9 @@ public async Task Take_IAsyncPartition_NonEmpty_TakeSkip() Assert.Equal(3, await ys.ElementAtAsync(0)); Assert.Equal(4, await ys.ElementAtAsync(1)); - Assert.Equal([3, 4], await ys.ToArrayAsync()); - Assert.Equal(new[] { 3, 4 }, await ys.ToListAsync()); + int[] expected = [3, 4]; + Assert.Equal(expected, await ys.ToArrayAsync()); + Assert.Equal(expected, await ys.ToListAsync()); } [Fact] @@ -233,8 +236,9 @@ public async Task Take_IAsyncPartition_IList_NonEmpty_Take() Assert.Equal(1, await ys.ElementAtAsync(0)); Assert.Equal(2, await ys.ElementAtAsync(1)); - Assert.Equal([1, 2], await ys.ToArrayAsync()); - Assert.Equal(new[] { 1, 2 }, await ys.ToListAsync()); + int[] expected = [1, 2]; + Assert.Equal(expected, await ys.ToArrayAsync()); + Assert.Equal(expected, await ys.ToListAsync()); } [Fact] @@ -251,8 +255,9 @@ public async Task Take_IAsyncPartition_IList_NonEmpty_TakeTake() Assert.Equal(1, await ys.ElementAtAsync(0)); Assert.Equal(2, await ys.ElementAtAsync(1)); - Assert.Equal([1, 2], await ys.ToArrayAsync()); - Assert.Equal(new[] { 1, 2 }, await ys.ToListAsync()); + int[] expected = [1, 2]; + Assert.Equal(expected, await ys.ToArrayAsync()); + Assert.Equal(expected, await ys.ToListAsync()); } [Fact] @@ -269,8 +274,9 @@ public async Task Take_IAsyncPartition_IList_NonEmpty_TakeSkip() Assert.Equal(3, await ys.ElementAtAsync(0)); Assert.Equal(4, await ys.ElementAtAsync(1)); - Assert.Equal([3, 4], await ys.ToArrayAsync()); - Assert.Equal(new[] { 3, 4 }, await ys.ToListAsync()); + int[] expected = [3, 4]; + Assert.Equal(expected, await ys.ToArrayAsync()); + Assert.Equal(expected, await ys.ToListAsync()); } [Fact] diff --git a/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/ToAsyncEnumerable.cs b/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/ToAsyncEnumerable.cs index 30afcbb78e..2e3e10e898 100644 --- a/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/ToAsyncEnumerable.cs +++ b/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/ToAsyncEnumerable.cs @@ -189,7 +189,7 @@ public void ToAsyncEnumerable_Enumerable_HashSet_ICollection() xc.CopyTo(arr, 0); Assert.True(arr.SequenceEqual(xc)); xc.Clear(); - Assert.Equal(0, xc.Count); + Assert.Empty(xc); } [Fact] @@ -223,7 +223,7 @@ public void ToAsyncEnumerable_Enumerable_List_IList() xl.CopyTo(arr, 0); Assert.True(arr.SequenceEqual(xl)); xl.Clear(); - Assert.Equal(0, xl.Count); + Assert.Empty(xl); } [Fact] @@ -314,7 +314,7 @@ public async Task ToAsyncEnumerable_Observable_Dispose() } await e.DisposeAsync(); - stop.WaitOne(); + await Task.Run(stop.WaitOne); } [Fact] @@ -352,7 +352,7 @@ public async Task ToAsyncEnumerable_Observable_Zip() } await e.DisposeAsync(); - stop.WaitOne(); + await Task.Run(stop.WaitOne); Assert.Equal(2, subCount); } @@ -390,7 +390,17 @@ public async Task ToAsyncEnumerable_Observable_Cancel() } c.Cancel(); - stop.WaitOne(); + + // Note that the continuation for the await of HasNextAsync will + // typically occur synchronously inside the source's call to OnNext. + // Older versions of xUnit ran tests in a synchronization context + // that would cause that await to run the continuation via a Post, + // but newer versions don't do that, and so that call to OnNext is + // above us in the call stack, and so the call to stop.Set can't + // run until we return. So that's why we kick off a separate task + // here - it enables this thread to return back up to the source, + // giving the stop.Set a chance to run. + await Task.Run(stop.WaitOne); } [Fact] @@ -453,7 +463,7 @@ public async Task ToAsyncEnumerable_Observable6_Async() } await e.DisposeAsync(); - stop.WaitOne(); + await Task.Run(stop.WaitOne); } // TODO: Add more tests for Observable conversion. diff --git a/Ix.NET/Source/System.Linq.Async.Tests/ValueTaskHelpers.cs b/Ix.NET/Source/System.Linq.Async.Tests/ValueTaskHelpers.cs index 45bb73371b..7364707956 100644 --- a/Ix.NET/Source/System.Linq.Async.Tests/ValueTaskHelpers.cs +++ b/Ix.NET/Source/System.Linq.Async.Tests/ValueTaskHelpers.cs @@ -97,10 +97,10 @@ private static Exception Throws(Type exceptionType, Exception exception) } if (exception == null) - throw new ThrowsException(exceptionType); + throw ThrowsException.ForNoException(exceptionType); if (!exceptionType.Equals(exception.GetType())) - throw new ThrowsException(exceptionType, exception); + throw ThrowsException.ForIncorrectExceptionType(exceptionType, exception); return exception; } diff --git a/Ix.NET/Source/Tests.System.Interactive.ApiApprovals/Tests.System.Interactive.ApiApprovals.csproj b/Ix.NET/Source/Tests.System.Interactive.ApiApprovals/Tests.System.Interactive.ApiApprovals.csproj index a6022437c3..59b00568b2 100644 --- a/Ix.NET/Source/Tests.System.Interactive.ApiApprovals/Tests.System.Interactive.ApiApprovals.csproj +++ b/Ix.NET/Source/Tests.System.Interactive.ApiApprovals/Tests.System.Interactive.ApiApprovals.csproj @@ -17,11 +17,11 @@ - + - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive From 80d862ceb69233d2528401633628186e11480e78 Mon Sep 17 00:00:00 2001 From: Ian Griffiths Date: Thu, 9 Oct 2025 07:17:07 +0100 Subject: [PATCH 2/5] Upgrade to Nerdbank.GitVersioning 3.8.118 --- Ix.NET/Source/Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Ix.NET/Source/Directory.Build.props b/Ix.NET/Source/Directory.Build.props index 1deaa23a3d..170d61a206 100644 --- a/Ix.NET/Source/Directory.Build.props +++ b/Ix.NET/Source/Directory.Build.props @@ -30,7 +30,7 @@ - + From 8c20c44632f7686e65e30f24bfdbaa1550466c2f Mon Sep 17 00:00:00 2001 From: Ian Griffiths Date: Thu, 9 Oct 2025 07:17:48 +0100 Subject: [PATCH 3/5] Upgrade to IsExternalInit 1.0.3 --- .../System.Linq.Async.SourceGenerator.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Ix.NET/Source/System.Linq.Async.SourceGenerator/System.Linq.Async.SourceGenerator.csproj b/Ix.NET/Source/System.Linq.Async.SourceGenerator/System.Linq.Async.SourceGenerator.csproj index 8604e8dc6f..21371461e4 100644 --- a/Ix.NET/Source/System.Linq.Async.SourceGenerator/System.Linq.Async.SourceGenerator.csproj +++ b/Ix.NET/Source/System.Linq.Async.SourceGenerator/System.Linq.Async.SourceGenerator.csproj @@ -6,6 +6,6 @@ - + From 9e2e39d6081c245e577feb6e2635533a9c310b27 Mon Sep 17 00:00:00 2001 From: Ian Griffiths Date: Thu, 9 Oct 2025 07:19:22 +0100 Subject: [PATCH 4/5] Update to BenchmarkDotNet 0.15.4 --- .../Benchmarks.System.Interactive.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Ix.NET/Source/Benchmarks.System.Interactive/Benchmarks.System.Interactive.csproj b/Ix.NET/Source/Benchmarks.System.Interactive/Benchmarks.System.Interactive.csproj index 90a39816c6..032ec88ed9 100644 --- a/Ix.NET/Source/Benchmarks.System.Interactive/Benchmarks.System.Interactive.csproj +++ b/Ix.NET/Source/Benchmarks.System.Interactive/Benchmarks.System.Interactive.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 true Current Sources;Ix.net 3.1.1;Ix.net 3.2 @@ -20,7 +20,7 @@ - + From 1f608373cfd37120d772a933b3ac398c589dca42 Mon Sep 17 00:00:00 2001 From: Ian Griffiths Date: Thu, 9 Oct 2025 08:13:52 +0100 Subject: [PATCH 5/5] Revert "Upgrade to xunit 2.9.3, FluentAssertions 7.2.0" This reverts commit c8d3444cb5838965ceed3772ad05bfb80ad8a074. --- Ix.NET/Source/Directory.Build.props | 2 +- ...m.Interactive.Async.Providers.Tests.csproj | 4 +-- .../AsyncTests.Bugs.cs | 2 +- .../System.Interactive.Async.Tests.csproj | 9 ++---- .../System/Linq/Operators/Amb.cs | 8 ++--- .../System/Linq/Operators/Timeout.cs | 8 ++--- .../TaskExtTests.cs | 4 +-- .../System.Interactive.Tests.csproj | 9 ++---- .../System.Linq.Async.Queryable.Tests.csproj | 9 ++---- .../System.Linq.Async.Tests.csproj | 9 ++---- .../System/Linq/Operators/Range.cs | 5 ++-- .../System/Linq/Operators/Reverse.cs | 4 +-- .../System/Linq/Operators/Select.cs | 6 ++-- .../System/Linq/Operators/Skip.cs | 30 ++++++++----------- .../System/Linq/Operators/Take.cs | 30 ++++++++----------- .../Linq/Operators/ToAsyncEnumerable.cs | 22 ++++---------- .../ValueTaskHelpers.cs | 4 +-- ...sts.System.Interactive.ApiApprovals.csproj | 6 ++-- 18 files changed, 68 insertions(+), 103 deletions(-) diff --git a/Ix.NET/Source/Directory.Build.props b/Ix.NET/Source/Directory.Build.props index 170d61a206..44a3734473 100644 --- a/Ix.NET/Source/Directory.Build.props +++ b/Ix.NET/Source/Directory.Build.props @@ -38,7 +38,7 @@ - + diff --git a/Ix.NET/Source/System.Interactive.Async.Providers.Tests/System.Interactive.Async.Providers.Tests.csproj b/Ix.NET/Source/System.Interactive.Async.Providers.Tests/System.Interactive.Async.Providers.Tests.csproj index 8aaef8f088..0f4fbb98c1 100644 --- a/Ix.NET/Source/System.Interactive.Async.Providers.Tests/System.Interactive.Async.Providers.Tests.csproj +++ b/Ix.NET/Source/System.Interactive.Async.Providers.Tests/System.Interactive.Async.Providers.Tests.csproj @@ -18,11 +18,11 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/Ix.NET/Source/System.Interactive.Async.Tests/AsyncTests.Bugs.cs b/Ix.NET/Source/System.Interactive.Async.Tests/AsyncTests.Bugs.cs index 3c53dac8a2..8bc478c5a0 100644 --- a/Ix.NET/Source/System.Interactive.Async.Tests/AsyncTests.Bugs.cs +++ b/Ix.NET/Source/System.Interactive.Async.Tests/AsyncTests.Bugs.cs @@ -22,7 +22,7 @@ public AsyncTests() } [Fact] - public async Task CorrectDispose() + public async void CorrectDispose() { var disposed = new TaskCompletionSource(); diff --git a/Ix.NET/Source/System.Interactive.Async.Tests/System.Interactive.Async.Tests.csproj b/Ix.NET/Source/System.Interactive.Async.Tests/System.Interactive.Async.Tests.csproj index 5b350924e8..99ef36d686 100644 --- a/Ix.NET/Source/System.Interactive.Async.Tests/System.Interactive.Async.Tests.csproj +++ b/Ix.NET/Source/System.Interactive.Async.Tests/System.Interactive.Async.Tests.csproj @@ -24,12 +24,9 @@ - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + diff --git a/Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Amb.cs b/Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Amb.cs index 5be54a86f9..e040ec5331 100644 --- a/Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Amb.cs +++ b/Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Amb.cs @@ -242,7 +242,7 @@ public async Task Amb_First_GetAsyncEnumerator_Crashes() { await xs.MoveNextAsync(); - Assert.Fail("Should not have gotten here"); + Assert.False(true, "Should not have gotten here"); } catch (InvalidOperationException) { @@ -265,7 +265,7 @@ public async Task Amb_Second_GetAsyncEnumerator_Crashes() { await xs.MoveNextAsync(); - Assert.Fail("Should not have gotten here"); + Assert.False(true, "Should not have gotten here"); } catch (InvalidOperationException) { @@ -292,7 +292,7 @@ public async Task Amb_Many_First_GetAsyncEnumerator_Crashes() { await xs.MoveNextAsync(); - Assert.Fail("Should not have gotten here"); + Assert.False(true, "Should not have gotten here"); } catch (InvalidOperationException) { @@ -319,7 +319,7 @@ public async Task Amb_Many_Last_GetAsyncEnumerator_Crashes() { await xs.MoveNextAsync(); - Assert.Fail("Should not have gotten here"); + Assert.False(true, "Should not have gotten here"); } catch (InvalidOperationException) { diff --git a/Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Timeout.cs b/Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Timeout.cs index bc4327301e..98566da895 100644 --- a/Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Timeout.cs +++ b/Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Timeout.cs @@ -23,7 +23,7 @@ public async Task Timeout_Never() { await en.MoveNextAsync(); - Assert.Fail("MoveNextAsync should have thrown"); + Assert.False(true, "MoveNextAsync should have thrown"); } catch (TimeoutException) { @@ -48,7 +48,7 @@ public async Task Timeout_Double_Never() { await en.MoveNextAsync(); - Assert.Fail("MoveNextAsync should have thrown"); + Assert.False(true, "MoveNextAsync should have thrown"); } catch (TimeoutException) { @@ -77,7 +77,7 @@ public async Task Timeout_Delayed_Main() { await en.MoveNextAsync(); - Assert.Fail("MoveNextAsync should have thrown"); + Assert.False(true, "MoveNextAsync should have thrown"); } catch (TimeoutException) { @@ -115,7 +115,7 @@ public async Task Timeout_Delayed_Main_Canceled() { await en.MoveNextAsync(); - Assert.Fail("MoveNextAsync should have thrown"); + Assert.False(true, "MoveNextAsync should have thrown"); } catch (TimeoutException) { diff --git a/Ix.NET/Source/System.Interactive.Async.Tests/TaskExtTests.cs b/Ix.NET/Source/System.Interactive.Async.Tests/TaskExtTests.cs index 4c61d215ea..2ed1a22d8c 100644 --- a/Ix.NET/Source/System.Interactive.Async.Tests/TaskExtTests.cs +++ b/Ix.NET/Source/System.Interactive.Async.Tests/TaskExtTests.cs @@ -22,7 +22,7 @@ public async Task ExceptionHandling_ShouldThrowUnwrappedException() } catch (AggregateException) { - Assert.Fail("AggregateException has been thrown instead of InvalidOperationException"); + Assert.True(false, "AggregateException has been thrown instead of InvalidOperationException"); } catch (InvalidOperationException) { @@ -45,7 +45,7 @@ public async Task ExceptionHandling_ShouldThrowUnwrappedException2() } catch (AggregateException) { - Assert.Fail("AggregateException has been thrown instead of InvalidOperationException"); + Assert.True(false, "AggregateException has been thrown instead of InvalidOperationException"); } catch (InvalidOperationException) { diff --git a/Ix.NET/Source/System.Interactive.Tests/System.Interactive.Tests.csproj b/Ix.NET/Source/System.Interactive.Tests/System.Interactive.Tests.csproj index f87e150383..634d28bdb4 100644 --- a/Ix.NET/Source/System.Interactive.Tests/System.Interactive.Tests.csproj +++ b/Ix.NET/Source/System.Interactive.Tests/System.Interactive.Tests.csproj @@ -22,12 +22,9 @@ - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + diff --git a/Ix.NET/Source/System.Linq.Async.Queryable.Tests/System.Linq.Async.Queryable.Tests.csproj b/Ix.NET/Source/System.Linq.Async.Queryable.Tests/System.Linq.Async.Queryable.Tests.csproj index 218a22bfd0..b5a0dc04d1 100644 --- a/Ix.NET/Source/System.Linq.Async.Queryable.Tests/System.Linq.Async.Queryable.Tests.csproj +++ b/Ix.NET/Source/System.Linq.Async.Queryable.Tests/System.Linq.Async.Queryable.Tests.csproj @@ -18,12 +18,9 @@ - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + diff --git a/Ix.NET/Source/System.Linq.Async.Tests/System.Linq.Async.Tests.csproj b/Ix.NET/Source/System.Linq.Async.Tests/System.Linq.Async.Tests.csproj index 17e64f6cb5..ed1c232efc 100644 --- a/Ix.NET/Source/System.Linq.Async.Tests/System.Linq.Async.Tests.csproj +++ b/Ix.NET/Source/System.Linq.Async.Tests/System.Linq.Async.Tests.csproj @@ -46,12 +46,9 @@ - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + diff --git a/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Range.cs b/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Range.cs index e6a76d0463..1b27d1ed01 100644 --- a/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Range.cs +++ b/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Range.cs @@ -63,9 +63,8 @@ public async Task Range_Simple_IAsyncPartition() Assert.Equal(2, await xs.Take(1024).FirstAsync()); Assert.Equal(6, await xs.Take(1024).LastAsync()); - int[] expected = [2, 3, 4, 5, 6]; - Assert.Equal(expected, await xs.ToArrayAsync()); - Assert.Equal(expected, await xs.ToListAsync()); + Assert.Equal([2, 3, 4, 5, 6], await xs.ToArrayAsync()); + Assert.Equal(new[] { 2, 3, 4, 5, 6 }, await xs.ToListAsync()); } [Fact] diff --git a/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Reverse.cs b/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Reverse.cs index cf09f8935e..aacf431da1 100644 --- a/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Reverse.cs +++ b/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Reverse.cs @@ -68,7 +68,7 @@ public async Task Reverse5() var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); var ys = xs.Reverse(); - Assert.Equal((int[])[3, 2, 1], await ys.ToArrayAsync()); + Assert.Equal([3, 2, 1], await ys.ToArrayAsync()); } [Fact] @@ -104,7 +104,7 @@ public async Task Reverse9() var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable(); var ys = xs.Reverse().Prepend(4); // to trigger onlyIfCheap - Assert.Equal((int[])[4, 3, 2, 1], await ys.ToArrayAsync()); + Assert.Equal([4, 3, 2, 1], await ys.ToArrayAsync()); } } } diff --git a/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Select.cs b/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Select.cs index b54d9d7f2e..65db9e8de8 100644 --- a/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Select.cs +++ b/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Select.cs @@ -278,7 +278,7 @@ public async Task Select_Sync_IList_ToArray() var xs = ToAsyncEnumerableIList([1, 2, 3, 4, 5]); var ys = xs.Select(x => x * 2); - Assert.Equal((int[])[2, 4, 6, 8, 10], await ys.ToArrayAsync()); + Assert.Equal([2, 4, 6, 8, 10], await ys.ToArrayAsync()); } [Fact] @@ -545,7 +545,7 @@ public async Task SelectAwait_IList_ToArray() var xs = ToAsyncEnumerableIList([1, 2, 3, 4, 5]); var ys = xs.SelectAwait(x => new ValueTask(x * 2)); - Assert.Equal((int[])[2, 4, 6, 8, 10], await ys.ToArrayAsync()); + Assert.Equal([2, 4, 6, 8, 10], await ys.ToArrayAsync()); } #if !NO_DEEP_CANCELLATION @@ -814,7 +814,7 @@ public async Task SelectAwaitWithCancellation_IList_ToArray() var xs = ToAsyncEnumerableIList([1, 2, 3, 4, 5]); var ys = xs.SelectAwaitWithCancellation((int x, CancellationToken ct) => new ValueTask(x * 2)); - Assert.Equal((int[])[2, 4, 6, 8, 10], await ys.ToArrayAsync()); + Assert.Equal([2, 4, 6, 8, 10], await ys.ToArrayAsync()); } #endif diff --git a/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Skip.cs b/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Skip.cs index 557162f2a1..3a358fa074 100644 --- a/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Skip.cs +++ b/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Skip.cs @@ -123,9 +123,8 @@ public async Task Skip_IAsyncPartition_NonEmpty_Skip() Assert.Equal(3, await ys.ElementAtAsync(0)); Assert.Equal(4, await ys.ElementAtAsync(1)); - int[] expected = [3, 4]; - Assert.Equal(expected, await ys.ToArrayAsync()); - Assert.Equal(expected, await ys.ToListAsync()); + Assert.Equal([3, 4], await ys.ToArrayAsync()); + Assert.Equal(new[] { 3, 4 }, await ys.ToListAsync()); } [Fact] @@ -142,9 +141,8 @@ public async Task Skip_IAsyncPartition_NonEmpty_SkipSkip() Assert.Equal(3, await ys.ElementAtAsync(0)); Assert.Equal(4, await ys.ElementAtAsync(1)); - int[] expected = [3, 4]; - Assert.Equal(expected, await ys.ToArrayAsync()); - Assert.Equal(expected, await ys.ToListAsync()); + Assert.Equal([3, 4], await ys.ToArrayAsync()); + Assert.Equal(new[] { 3, 4 }, await ys.ToListAsync()); } [Fact] @@ -161,9 +159,8 @@ public async Task Skip_IAsyncPartition_NonEmpty_SkipTake() Assert.Equal(3, await ys.ElementAtAsync(0)); Assert.Equal(4, await ys.ElementAtAsync(1)); - int[] expected = [3, 4]; - Assert.Equal(expected, await ys.ToArrayAsync()); - Assert.Equal(expected, await ys.ToListAsync()); + Assert.Equal([3, 4], await ys.ToArrayAsync()); + Assert.Equal(new[] { 3, 4 }, await ys.ToListAsync()); } [Fact] @@ -216,9 +213,8 @@ public async Task Skip_IAsyncPartition_IList_NonEmpty_Skip() Assert.Equal(3, await ys.ElementAtAsync(0)); Assert.Equal(4, await ys.ElementAtAsync(1)); - int[] expected = [3, 4]; - Assert.Equal(expected, await ys.ToArrayAsync()); - Assert.Equal(expected, await ys.ToListAsync()); + Assert.Equal([3, 4], await ys.ToArrayAsync()); + Assert.Equal(new[] { 3, 4 }, await ys.ToListAsync()); } [Fact] @@ -235,9 +231,8 @@ public async Task Skip_IAsyncPartition_IList_NonEmpty_SkipSkip() Assert.Equal(3, await ys.ElementAtAsync(0)); Assert.Equal(4, await ys.ElementAtAsync(1)); - int[] expected = [3, 4]; - Assert.Equal(expected, await ys.ToArrayAsync()); - Assert.Equal(expected, await ys.ToListAsync()); + Assert.Equal([3, 4], await ys.ToArrayAsync()); + Assert.Equal(new[] { 3, 4 }, await ys.ToListAsync()); } [Fact] @@ -254,9 +249,8 @@ public async Task Skip_IAsyncPartition_IList_NonEmpty_SkipTake() Assert.Equal(3, await ys.ElementAtAsync(0)); Assert.Equal(4, await ys.ElementAtAsync(1)); - int[] expected = [3, 4]; - Assert.Equal(expected, await ys.ToArrayAsync()); - Assert.Equal(expected, await ys.ToListAsync()); + Assert.Equal([3, 4], await ys.ToArrayAsync()); + Assert.Equal(new[] { 3, 4 }, await ys.ToListAsync()); } [Fact] diff --git a/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Take.cs b/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Take.cs index 8c4365eb4e..451fbcece0 100644 --- a/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Take.cs +++ b/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Take.cs @@ -143,9 +143,8 @@ public async Task Take_IAsyncPartition_NonEmpty_Take() Assert.Equal(1, await ys.ElementAtAsync(0)); Assert.Equal(2, await ys.ElementAtAsync(1)); - int[] expected = [1, 2]; - Assert.Equal(expected, await ys.ToArrayAsync()); - Assert.Equal(expected, await ys.ToListAsync()); + Assert.Equal([1, 2], await ys.ToArrayAsync()); + Assert.Equal(new[] { 1, 2 }, await ys.ToListAsync()); } [Fact] @@ -162,9 +161,8 @@ public async Task Take_IAsyncPartition_NonEmpty_TakeTake() Assert.Equal(1, await ys.ElementAtAsync(0)); Assert.Equal(2, await ys.ElementAtAsync(1)); - int[] expected = [1, 2]; - Assert.Equal(expected, await ys.ToArrayAsync()); - Assert.Equal(expected, await ys.ToListAsync()); + Assert.Equal([1, 2], await ys.ToArrayAsync()); + Assert.Equal(new[] { 1, 2 }, await ys.ToListAsync()); } [Fact] @@ -181,9 +179,8 @@ public async Task Take_IAsyncPartition_NonEmpty_TakeSkip() Assert.Equal(3, await ys.ElementAtAsync(0)); Assert.Equal(4, await ys.ElementAtAsync(1)); - int[] expected = [3, 4]; - Assert.Equal(expected, await ys.ToArrayAsync()); - Assert.Equal(expected, await ys.ToListAsync()); + Assert.Equal([3, 4], await ys.ToArrayAsync()); + Assert.Equal(new[] { 3, 4 }, await ys.ToListAsync()); } [Fact] @@ -236,9 +233,8 @@ public async Task Take_IAsyncPartition_IList_NonEmpty_Take() Assert.Equal(1, await ys.ElementAtAsync(0)); Assert.Equal(2, await ys.ElementAtAsync(1)); - int[] expected = [1, 2]; - Assert.Equal(expected, await ys.ToArrayAsync()); - Assert.Equal(expected, await ys.ToListAsync()); + Assert.Equal([1, 2], await ys.ToArrayAsync()); + Assert.Equal(new[] { 1, 2 }, await ys.ToListAsync()); } [Fact] @@ -255,9 +251,8 @@ public async Task Take_IAsyncPartition_IList_NonEmpty_TakeTake() Assert.Equal(1, await ys.ElementAtAsync(0)); Assert.Equal(2, await ys.ElementAtAsync(1)); - int[] expected = [1, 2]; - Assert.Equal(expected, await ys.ToArrayAsync()); - Assert.Equal(expected, await ys.ToListAsync()); + Assert.Equal([1, 2], await ys.ToArrayAsync()); + Assert.Equal(new[] { 1, 2 }, await ys.ToListAsync()); } [Fact] @@ -274,9 +269,8 @@ public async Task Take_IAsyncPartition_IList_NonEmpty_TakeSkip() Assert.Equal(3, await ys.ElementAtAsync(0)); Assert.Equal(4, await ys.ElementAtAsync(1)); - int[] expected = [3, 4]; - Assert.Equal(expected, await ys.ToArrayAsync()); - Assert.Equal(expected, await ys.ToListAsync()); + Assert.Equal([3, 4], await ys.ToArrayAsync()); + Assert.Equal(new[] { 3, 4 }, await ys.ToListAsync()); } [Fact] diff --git a/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/ToAsyncEnumerable.cs b/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/ToAsyncEnumerable.cs index 2e3e10e898..30afcbb78e 100644 --- a/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/ToAsyncEnumerable.cs +++ b/Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/ToAsyncEnumerable.cs @@ -189,7 +189,7 @@ public void ToAsyncEnumerable_Enumerable_HashSet_ICollection() xc.CopyTo(arr, 0); Assert.True(arr.SequenceEqual(xc)); xc.Clear(); - Assert.Empty(xc); + Assert.Equal(0, xc.Count); } [Fact] @@ -223,7 +223,7 @@ public void ToAsyncEnumerable_Enumerable_List_IList() xl.CopyTo(arr, 0); Assert.True(arr.SequenceEqual(xl)); xl.Clear(); - Assert.Empty(xl); + Assert.Equal(0, xl.Count); } [Fact] @@ -314,7 +314,7 @@ public async Task ToAsyncEnumerable_Observable_Dispose() } await e.DisposeAsync(); - await Task.Run(stop.WaitOne); + stop.WaitOne(); } [Fact] @@ -352,7 +352,7 @@ public async Task ToAsyncEnumerable_Observable_Zip() } await e.DisposeAsync(); - await Task.Run(stop.WaitOne); + stop.WaitOne(); Assert.Equal(2, subCount); } @@ -390,17 +390,7 @@ public async Task ToAsyncEnumerable_Observable_Cancel() } c.Cancel(); - - // Note that the continuation for the await of HasNextAsync will - // typically occur synchronously inside the source's call to OnNext. - // Older versions of xUnit ran tests in a synchronization context - // that would cause that await to run the continuation via a Post, - // but newer versions don't do that, and so that call to OnNext is - // above us in the call stack, and so the call to stop.Set can't - // run until we return. So that's why we kick off a separate task - // here - it enables this thread to return back up to the source, - // giving the stop.Set a chance to run. - await Task.Run(stop.WaitOne); + stop.WaitOne(); } [Fact] @@ -463,7 +453,7 @@ public async Task ToAsyncEnumerable_Observable6_Async() } await e.DisposeAsync(); - await Task.Run(stop.WaitOne); + stop.WaitOne(); } // TODO: Add more tests for Observable conversion. diff --git a/Ix.NET/Source/System.Linq.Async.Tests/ValueTaskHelpers.cs b/Ix.NET/Source/System.Linq.Async.Tests/ValueTaskHelpers.cs index 7364707956..45bb73371b 100644 --- a/Ix.NET/Source/System.Linq.Async.Tests/ValueTaskHelpers.cs +++ b/Ix.NET/Source/System.Linq.Async.Tests/ValueTaskHelpers.cs @@ -97,10 +97,10 @@ private static Exception Throws(Type exceptionType, Exception exception) } if (exception == null) - throw ThrowsException.ForNoException(exceptionType); + throw new ThrowsException(exceptionType); if (!exceptionType.Equals(exception.GetType())) - throw ThrowsException.ForIncorrectExceptionType(exceptionType, exception); + throw new ThrowsException(exceptionType, exception); return exception; } diff --git a/Ix.NET/Source/Tests.System.Interactive.ApiApprovals/Tests.System.Interactive.ApiApprovals.csproj b/Ix.NET/Source/Tests.System.Interactive.ApiApprovals/Tests.System.Interactive.ApiApprovals.csproj index 59b00568b2..a6022437c3 100644 --- a/Ix.NET/Source/Tests.System.Interactive.ApiApprovals/Tests.System.Interactive.ApiApprovals.csproj +++ b/Ix.NET/Source/Tests.System.Interactive.ApiApprovals/Tests.System.Interactive.ApiApprovals.csproj @@ -17,11 +17,11 @@ - + - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive