-
Notifications
You must be signed in to change notification settings - Fork 344
Conversation
Pipe.Writer.WriteAsync(new byte[] {}); | ||
Pipe.Reader.CancelPendingRead(); | ||
|
||
Assert.True(awaitable.IsCompleted); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why isn't this assert in the other test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No reason
awaitable.OnCompleted(() => {}); | ||
|
||
Pipe.Reader.Advance(Pipe.Reader.ReadAsync().GetResult().Buffer.End); | ||
Pipe.Writer.CancelPendingFlush(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes sense to test flipping the order of the above two lines to verify Advance won't clobber the canceled state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I would have loved actually awaiting instead of faking it by calling IsCompleted/OnCompleted manually, this was a pretty clever way to avoid mocking an IScheduler.
@@ -215,6 +215,44 @@ public void FlushAsyncCompletedAfterPreCancellation() | |||
} | |||
|
|||
[Fact] | |||
public void FlushAsyncReturnsIsCancelOnCancelPendingFlushBeforeGetResult() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: ReturnsIsCancelled
No description provided.