Fix request stream tests.

This commit is contained in:
Chris Ross 2014-09-15 14:20:56 -07:00
parent 0139bea6d2
commit 5f7c06d0ec
1 changed files with 3 additions and 3 deletions

View File

@ -258,7 +258,7 @@ namespace Microsoft.Net.Http.Server
var readTask = context.Request.Body.ReadAsync(input, 0, input.Length, cts.Token); var readTask = context.Request.Body.ReadAsync(input, 0, input.Length, cts.Token);
Assert.False(readTask.IsCanceled); Assert.False(readTask.IsCanceled);
cts.Cancel(); cts.Cancel();
await Assert.ThrowsAsync<WebListenerException>(async () => await readTask); await Assert.ThrowsAsync<IOException>(async () => await readTask);
content.Block.Release(); content.Block.Release();
context.Dispose(); context.Dispose();
@ -283,7 +283,7 @@ namespace Microsoft.Net.Http.Server
cts.CancelAfter(TimeSpan.FromMilliseconds(100)); cts.CancelAfter(TimeSpan.FromMilliseconds(100));
var readTask = context.Request.Body.ReadAsync(input, 0, input.Length, cts.Token); var readTask = context.Request.Body.ReadAsync(input, 0, input.Length, cts.Token);
Assert.False(readTask.IsCanceled); Assert.False(readTask.IsCanceled);
await Assert.ThrowsAsync<WebListenerException>(async () => await readTask); await Assert.ThrowsAsync<IOException>(async () => await readTask);
content.Block.Release(); content.Block.Release();
context.Dispose(); context.Dispose();
@ -308,7 +308,7 @@ namespace Microsoft.Net.Http.Server
int read = await context.Request.Body.ReadAsync(input, 0, input.Length, context.DisconnectToken); int read = await context.Request.Body.ReadAsync(input, 0, input.Length, context.DisconnectToken);
Assert.False(context.DisconnectToken.IsCancellationRequested); Assert.False(context.DisconnectToken.IsCancellationRequested);
// The client should timeout and disconnect, making this read fail. // The client should timeout and disconnect, making this read fail.
var assertTask = Assert.ThrowsAsync<WebListenerException>(async () => await context.Request.Body.ReadAsync(input, 0, input.Length, context.DisconnectToken)); var assertTask = Assert.ThrowsAsync<IOException>(async () => await context.Request.Body.ReadAsync(input, 0, input.Length, context.DisconnectToken));
client.CancelPendingRequests(); client.CancelPendingRequests();
await assertTask; await assertTask;
content.Block.Release(); content.Block.Release();