Skip to content

Commit 7cb47fd

Browse files
Fixed tests.
1 parent 9245b48 commit 7cb47fd

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

Open.ChannelExtensions.ComparisonTests/Program.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static async Task Main()
3636
{
3737
Console.WriteLine("Standard Channel filter test...");
3838
System.Collections.Generic.IEnumerable<ValueTask<int>> source = Enumerable
39-
.Repeat((Func<int, ValueTask<int>>)Delay, repeat)
39+
.Repeat(Delay, repeat)
4040
.Select((t, i) => t(i));
4141

4242
var sw = Stopwatch.StartNew();
@@ -68,7 +68,7 @@ static async Task Main()
6868
Console.WriteLine("Concurrent Channel operation test...");
6969
var sw = Stopwatch.StartNew();
7070
await Enumerable
71-
.Repeat((Func<int, ValueTask<int>>)Delay, repeat)
71+
.Repeat(Delay, repeat)
7272
.Select((t, i) => t(i))
7373
.ToChannelAsync(singleReader: false, maxConcurrency: concurrency)
7474
.ReadAllConcurrently(4, Dummy).ConfigureAwait(false);
@@ -81,7 +81,7 @@ await Enumerable
8181
Console.WriteLine("Pipe operation test...");
8282
var sw = Stopwatch.StartNew();
8383
long total = await Enumerable
84-
.Repeat((Func<int, ValueTask<int>>)Delay, repeat)
84+
.Repeat(Delay, repeat)
8585
.Select((t, i) => t(i))
8686
.ToChannelAsync()
8787
.Pipe(i => i * 2)
@@ -96,7 +96,7 @@ await Enumerable
9696
Console.WriteLine("Transform operation test...");
9797
var sw = Stopwatch.StartNew();
9898
await Enumerable
99-
.Repeat((Func<int, ValueTask<int>>)Delay, repeat)
99+
.Repeat(Delay, repeat)
100100
.Select((t, i) => t(i))
101101
.ToChannelAsync()
102102
.Transform(i => i * 2L)
@@ -110,16 +110,18 @@ await Enumerable
110110
Console.WriteLine("Async Enumerable test...");
111111
var sw = Stopwatch.StartNew();
112112
await foreach (var e in Enumerable
113-
.Repeat((Func<int, ValueTask<int>>)Delay, repeat)
113+
.Repeat(Delay, repeat)
114114
.Select((t, i) => t(i))
115115
.ToChannelAsync()
116-
.ReadAllAsync())
116+
.ReadAllAsync().ConfigureAwait(false))
117+
{
117118
Dummy(e);
119+
}
120+
118121
sw.Stop();
119122
Console.WriteLine(sw.Elapsed);
120123
Console.WriteLine();
121124
}
122-
123125
}
124126

125127
static void Dummy(int i)

Open.ChannelExtensions.Tests/PipelineExceptionTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public static async Task Regular(int elementToThrow)
3232
channel.Writer.Complete();
3333

3434
await Assert.ThrowsAsync<AggregateException>(async () => await task);
35+
await Assert.ThrowsAsync<ChannelClosedException>(async () => await channel.CompleteAsync());
3536
}
3637

3738
[Theory]
@@ -63,5 +64,6 @@ public static async Task Batched(int elementToThrow)
6364
channel.Writer.Complete();
6465

6566
await Assert.ThrowsAsync<AggregateException>(async () => await task);
67+
await Assert.ThrowsAsync<ChannelClosedException>(async () => await channel.CompleteAsync());
6668
}
6769
}

0 commit comments

Comments
 (0)