Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add an explanatory comment to the test.
  • Loading branch information
bartonjs committed Sep 14, 2022
commit f314ed04daefea335d3f9990d9d790eb16ce0471
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ public async Task ComputeHashAsync_SupportsCancellation()
using (PositionValueStream stream = new SelfCancellingStream(10000, cancellationSource))
using (HashAlgorithm hash = new SummingTestHashAlgorithm())
{
// The stream has a length longer than ComputeHashAsync's read buffer,
// so ReadAsync will get called multiple times.
// The first call succeeds, but moves the cancellation source to canceled,
// and the second call then fails with an OperationCanceledException, cancelling the
// whole operation.
await Assert.ThrowsAnyAsync<OperationCanceledException>(
() => hash.ComputeHashAsync(stream, cancellationSource.Token));

Expand Down