Merge branch 'release/2.2'

This commit is contained in:
BrennanConroy 2018-08-28 16:05:43 -07:00
commit 2e68c99cc1
2 changed files with 14 additions and 28 deletions

View File

@ -327,31 +327,23 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
[Fact]
public async Task SSEWontStartIfSuccessfulConnectionIsNotEstablished()
{
bool ExpectedErrors(WriteContext writeContext)
{
return writeContext.LoggerName == typeof(HttpConnection).FullName &&
writeContext.EventId.Name == "ErrorStartingTransport";
}
// TODO: Add logging https://github.com/aspnet/SignalR/issues/2879
var httpHandler = new TestHttpMessageHandler();
using (StartVerifiableLog(out var loggerFactory, LogLevel.Trace, expectedErrorsFilter: ExpectedErrors))
httpHandler.OnGet("/?id=00000000-0000-0000-0000-000000000000", (_, __) =>
{
var httpHandler = new TestHttpMessageHandler(loggerFactory);
return Task.FromResult(ResponseUtils.CreateResponse(HttpStatusCode.InternalServerError));
});
httpHandler.OnGet("/?id=00000000-0000-0000-0000-000000000000", (_, __) =>
var sse = new ServerSentEventsTransport(new HttpClient(httpHandler));
await WithConnectionAsync(
CreateConnection(httpHandler, transport: sse),
async (connection) =>
{
return Task.FromResult(ResponseUtils.CreateResponse(HttpStatusCode.InternalServerError));
await Assert.ThrowsAsync<InvalidOperationException>(
() => connection.StartAsync(TransferFormat.Text).OrTimeout());
});
var sse = new ServerSentEventsTransport(new HttpClient(httpHandler), loggerFactory);
await WithConnectionAsync(
CreateConnection(httpHandler, loggerFactory: loggerFactory, transport: sse),
async (connection) =>
{
await Assert.ThrowsAsync<InvalidOperationException>(
() => connection.StartAsync(TransferFormat.Text).OrTimeout());
});
}
}
[Fact]

View File

@ -165,12 +165,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
[Fact]
public async Task SSETransportStopsWithErrorIfSendingMessageFails()
{
bool ExpectedErrors(WriteContext writeContext)
{
return writeContext.LoggerName == typeof(ServerSentEventsTransport).FullName &&
writeContext.EventId.Name == "ErrorSending";
}
// TODO: Add logging https://github.com/aspnet/SignalR/issues/2879
var eventStreamTcs = new TaskCompletionSource<object>();
var copyToAsyncTcs = new TaskCompletionSource<int>();
@ -199,9 +194,8 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
});
using (var httpClient = new HttpClient(mockHttpHandler.Object))
using (StartVerifiableLog(out var loggerFactory, LogLevel.Trace, expectedErrorsFilter: ExpectedErrors))
{
var sseTransport = new ServerSentEventsTransport(httpClient, loggerFactory);
var sseTransport = new ServerSentEventsTransport(httpClient);
await sseTransport.StartAsync(
new Uri("http://fakeuri.org"), TransferFormat.Text).OrTimeout();