Merge branch 'release/2.2'
This commit is contained in:
commit
2e68c99cc1
|
|
@ -327,31 +327,23 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task SSEWontStartIfSuccessfulConnectionIsNotEstablished()
|
public async Task SSEWontStartIfSuccessfulConnectionIsNotEstablished()
|
||||||
{
|
{
|
||||||
bool ExpectedErrors(WriteContext writeContext)
|
// TODO: Add logging https://github.com/aspnet/SignalR/issues/2879
|
||||||
{
|
var httpHandler = new TestHttpMessageHandler();
|
||||||
return writeContext.LoggerName == typeof(HttpConnection).FullName &&
|
|
||||||
writeContext.EventId.Name == "ErrorStartingTransport";
|
|
||||||
}
|
|
||||||
|
|
||||||
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]
|
[Fact]
|
||||||
|
|
|
||||||
|
|
@ -165,12 +165,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task SSETransportStopsWithErrorIfSendingMessageFails()
|
public async Task SSETransportStopsWithErrorIfSendingMessageFails()
|
||||||
{
|
{
|
||||||
bool ExpectedErrors(WriteContext writeContext)
|
// TODO: Add logging https://github.com/aspnet/SignalR/issues/2879
|
||||||
{
|
|
||||||
return writeContext.LoggerName == typeof(ServerSentEventsTransport).FullName &&
|
|
||||||
writeContext.EventId.Name == "ErrorSending";
|
|
||||||
}
|
|
||||||
|
|
||||||
var eventStreamTcs = new TaskCompletionSource<object>();
|
var eventStreamTcs = new TaskCompletionSource<object>();
|
||||||
var copyToAsyncTcs = new TaskCompletionSource<int>();
|
var copyToAsyncTcs = new TaskCompletionSource<int>();
|
||||||
|
|
||||||
|
|
@ -199,9 +194,8 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
|
||||||
});
|
});
|
||||||
|
|
||||||
using (var httpClient = new HttpClient(mockHttpHandler.Object))
|
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(
|
await sseTransport.StartAsync(
|
||||||
new Uri("http://fakeuri.org"), TransferFormat.Text).OrTimeout();
|
new Uri("http://fakeuri.org"), TransferFormat.Text).OrTimeout();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue