Add VerifyNoErrorsScope (#1972)
This commit is contained in:
parent
b9e7113c01
commit
ddc905c219
|
|
@ -26,13 +26,13 @@ namespace Microsoft.AspNetCore.Http.Connections.Client.Internal
|
|||
|
||||
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
|
||||
{
|
||||
Log.SendingHttpRequest(_logger, request.RequestUri);
|
||||
Log.SendingHttpRequest(_logger, request.Method, request.RequestUri);
|
||||
|
||||
var response = await base.SendAsync(request, cancellationToken);
|
||||
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
Log.UnsuccessfulHttpResponse(_logger, request.RequestUri, response.StatusCode);
|
||||
Log.UnsuccessfulHttpResponse(_logger, response.StatusCode, request.Method, request.RequestUri);
|
||||
}
|
||||
|
||||
return response;
|
||||
|
|
@ -40,19 +40,19 @@ namespace Microsoft.AspNetCore.Http.Connections.Client.Internal
|
|||
|
||||
private static class Log
|
||||
{
|
||||
private static readonly Action<ILogger, Uri, Exception> _sendingHttpRequest =
|
||||
LoggerMessage.Define<Uri>(LogLevel.Trace, new EventId(1, "SendingHttpRequest"), "Sending HTTP request to '{RequestUrl}'.");
|
||||
private static readonly Action<ILogger, HttpMethod, Uri, Exception> _sendingHttpRequest =
|
||||
LoggerMessage.Define<HttpMethod, Uri>(LogLevel.Trace, new EventId(1, "SendingHttpRequest"), "Sending HTTP request {RequestMethod} '{RequestUrl}'.");
|
||||
|
||||
private static readonly Action<ILogger, Uri, HttpStatusCode, Exception> _unsuccessfulHttpResponse =
|
||||
LoggerMessage.Define<Uri, HttpStatusCode>(LogLevel.Warning, new EventId(2, "UnsuccessfulHttpResponse"), "Unsuccessful HTTP response status code of {StatusCode} return from '{RequestUrl}'.");
|
||||
private static readonly Action<ILogger, HttpStatusCode, HttpMethod, Uri, Exception> _unsuccessfulHttpResponse =
|
||||
LoggerMessage.Define<HttpStatusCode, HttpMethod, Uri>(LogLevel.Warning, new EventId(2, "UnsuccessfulHttpResponse"), "Unsuccessful HTTP response status code of {StatusCode} return from {RequestMethod} '{RequestUrl}'.");
|
||||
|
||||
public static void SendingHttpRequest(ILogger logger, Uri requestUrl)
|
||||
public static void SendingHttpRequest(ILogger logger, HttpMethod requestMethod, Uri requestUrl)
|
||||
{
|
||||
_sendingHttpRequest(logger, requestUrl, null);
|
||||
_sendingHttpRequest(logger, requestMethod, requestUrl, null);
|
||||
}
|
||||
public static void UnsuccessfulHttpResponse(ILogger logger, Uri requestUrl, HttpStatusCode statusCode)
|
||||
public static void UnsuccessfulHttpResponse(ILogger logger, HttpStatusCode statusCode, HttpMethod requestMethod, Uri requestUrl)
|
||||
{
|
||||
_unsuccessfulHttpResponse(logger, requestUrl, statusCode, null);
|
||||
_unsuccessfulHttpResponse(logger, statusCode, requestMethod, requestUrl, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,6 +149,13 @@ namespace Microsoft.AspNetCore.Http.Connections.Client.Internal
|
|||
// just want to start a new poll.
|
||||
continue;
|
||||
}
|
||||
catch (WebException ex) when (ex.Status == WebExceptionStatus.RequestCanceled)
|
||||
{
|
||||
// SendAsync on .NET Framework doesn't reliably throw OperationCanceledException.
|
||||
// Catch the WebException and test it.
|
||||
// https://github.com/dotnet/corefx/issues/26335
|
||||
continue;
|
||||
}
|
||||
|
||||
Log.PollResponseReceived(_logger, response);
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ using Microsoft.AspNetCore.Connections.Features;
|
|||
using Microsoft.AspNetCore.Http.Connections.Internal;
|
||||
using Microsoft.AspNetCore.Http.Features;
|
||||
using Microsoft.AspNetCore.Http.Internal;
|
||||
using Microsoft.AspNetCore.SignalR.Tests;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Logging.Testing;
|
||||
|
|
@ -31,7 +32,7 @@ using Xunit.Abstractions;
|
|||
|
||||
namespace Microsoft.AspNetCore.Http.Connections.Tests
|
||||
{
|
||||
public class HttpConnectionDispatcherTests : LoggedTest
|
||||
public class HttpConnectionDispatcherTests : VerifiableLoggedTest
|
||||
{
|
||||
public HttpConnectionDispatcherTests(ITestOutputHelper output) : base(output)
|
||||
{
|
||||
|
|
@ -40,7 +41,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[Fact]
|
||||
public async Task NegotiateReservesConnectionIdAndReturnsIt()
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var dispatcher = new HttpConnectionDispatcher(manager, loggerFactory);
|
||||
|
|
@ -63,7 +64,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[Fact]
|
||||
public async Task CheckThatThresholdValuesAreEnforced()
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var dispatcher = new HttpConnectionDispatcher(manager, loggerFactory);
|
||||
|
|
@ -101,7 +102,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[InlineData(HttpTransportType.ServerSentEvents)]
|
||||
public async Task CheckThatThresholdValuesAreEnforcedWithSends(HttpTransportType transportType)
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var dispatcher = new HttpConnectionDispatcher(manager, loggerFactory);
|
||||
|
|
@ -153,7 +154,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[InlineData(HttpTransportType.LongPolling | HttpTransportType.WebSockets)]
|
||||
public async Task NegotiateReturnsAvailableTransportsAfterFilteringByOptions(HttpTransportType transports)
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var dispatcher = new HttpConnectionDispatcher(manager, loggerFactory);
|
||||
|
|
@ -187,7 +188,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[InlineData(HttpTransportType.LongPolling)]
|
||||
public async Task EndpointsThatAcceptConnectionId404WhenUnknownConnectionIdProvided(HttpTransportType transportType)
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var dispatcher = new HttpConnectionDispatcher(manager, loggerFactory);
|
||||
|
|
@ -224,7 +225,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[Fact]
|
||||
public async Task EndpointsThatAcceptConnectionId404WhenUnknownConnectionIdProvidedForPost()
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var dispatcher = new HttpConnectionDispatcher(manager, loggerFactory);
|
||||
|
|
@ -259,7 +260,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[Fact]
|
||||
public async Task PostNotAllowedForWebSocketConnections()
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var dispatcher = new HttpConnectionDispatcher(manager, loggerFactory);
|
||||
|
|
@ -296,7 +297,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[Fact]
|
||||
public async Task PostReturns404IfConnectionDisposed()
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var dispatcher = new HttpConnectionDispatcher(manager, loggerFactory);
|
||||
|
|
@ -334,7 +335,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[InlineData(HttpTransportType.WebSockets)]
|
||||
public async Task TransportEndingGracefullyWaitsOnApplication(HttpTransportType transportType)
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var dispatcher = new HttpConnectionDispatcher(manager, loggerFactory);
|
||||
|
|
@ -395,7 +396,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[Fact]
|
||||
public async Task TransportEndingGracefullyWaitsOnApplicationLongPolling()
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var dispatcher = new HttpConnectionDispatcher(manager, loggerFactory);
|
||||
|
|
@ -458,7 +459,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[InlineData(HttpTransportType.ServerSentEvents)]
|
||||
public async Task PostSendsToConnection(HttpTransportType transportType)
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var dispatcher = new HttpConnectionDispatcher(manager, loggerFactory);
|
||||
|
|
@ -507,7 +508,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[InlineData(HttpTransportType.ServerSentEvents)]
|
||||
public async Task PostSendsToConnectionInParallel(HttpTransportType transportType)
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var dispatcher = new HttpConnectionDispatcher(manager, loggerFactory);
|
||||
|
|
@ -592,7 +593,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[Fact]
|
||||
public async Task HttpContextFeatureForLongpollingWorksBetweenPolls()
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var dispatcher = new HttpConnectionDispatcher(manager, loggerFactory);
|
||||
|
|
@ -685,7 +686,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[InlineData(HttpTransportType.LongPolling)]
|
||||
public async Task EndpointsThatRequireConnectionId400WhenNoConnectionIdProvided(HttpTransportType transportType)
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var dispatcher = new HttpConnectionDispatcher(manager, loggerFactory);
|
||||
|
|
@ -717,7 +718,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[Fact]
|
||||
public async Task EndpointsThatRequireConnectionId400WhenNoConnectionIdProvidedForPost()
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var dispatcher = new HttpConnectionDispatcher(manager, loggerFactory);
|
||||
|
|
@ -749,7 +750,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[InlineData(HttpTransportType.ServerSentEvents, 404)]
|
||||
public async Task EndPointThatOnlySupportsLongPollingRejectsOtherTransports(HttpTransportType transportType, int status)
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
await CheckTransportSupported(HttpTransportType.LongPolling, transportType, status, loggerFactory);
|
||||
}
|
||||
|
|
@ -761,7 +762,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[InlineData(HttpTransportType.LongPolling, 404)]
|
||||
public async Task EndPointThatOnlySupportsSSERejectsOtherTransports(HttpTransportType transportType, int status)
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
await CheckTransportSupported(HttpTransportType.ServerSentEvents, transportType, status, loggerFactory);
|
||||
}
|
||||
|
|
@ -773,7 +774,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[InlineData(HttpTransportType.LongPolling, 404)]
|
||||
public async Task EndPointThatOnlySupportsWebSockesRejectsOtherTransports(HttpTransportType transportType, int status)
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
await CheckTransportSupported(HttpTransportType.WebSockets, transportType, status, loggerFactory);
|
||||
}
|
||||
|
|
@ -783,7 +784,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[InlineData(HttpTransportType.LongPolling, 404)]
|
||||
public async Task EndPointThatOnlySupportsWebSocketsAndSSERejectsLongPolling(HttpTransportType transportType, int status)
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
await CheckTransportSupported(HttpTransportType.WebSockets | HttpTransportType.ServerSentEvents, transportType, status, loggerFactory);
|
||||
}
|
||||
|
|
@ -792,7 +793,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[Fact]
|
||||
public async Task CompletedEndPointEndsConnection()
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var connection = manager.CreateConnection();
|
||||
|
|
@ -820,7 +821,13 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[Fact]
|
||||
public async Task SynchronusExceptionEndsConnection()
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
bool ExpectedErrors(WriteContext writeContext)
|
||||
{
|
||||
return writeContext.LoggerName == typeof(HttpConnectionManager).FullName &&
|
||||
writeContext.EventId.Name == "FailedDispose";
|
||||
}
|
||||
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug, expectedErrorsFilter: ExpectedErrors))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var connection = manager.CreateConnection();
|
||||
|
|
@ -847,7 +854,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[Fact]
|
||||
public async Task CompletedEndPointEndsLongPollingConnection()
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var connection = manager.CreateConnection();
|
||||
|
|
@ -874,7 +881,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[Fact]
|
||||
public async Task LongPollingTimeoutSets200StatusCode()
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var connection = manager.CreateConnection();
|
||||
|
|
@ -900,7 +907,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[Fact]
|
||||
public async Task WebSocketTransportTimesOutWhenCloseFrameNotReceived()
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Trace))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Trace))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var connection = manager.CreateConnection();
|
||||
|
|
@ -930,7 +937,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[InlineData(HttpTransportType.ServerSentEvents)]
|
||||
public async Task RequestToActiveConnectionId409ForStreamingTransports(HttpTransportType transportType)
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var connection = manager.CreateConnection();
|
||||
|
|
@ -973,7 +980,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[Fact]
|
||||
public async Task RequestToActiveConnectionIdKillsPreviousConnectionLongPolling()
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var connection = manager.CreateConnection();
|
||||
|
|
@ -1011,7 +1018,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[InlineData(HttpTransportType.LongPolling)]
|
||||
public async Task RequestToDisposedConnectionIdReturns404(HttpTransportType transportType)
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var connection = manager.CreateConnection();
|
||||
|
|
@ -1039,7 +1046,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[Fact]
|
||||
public async Task ConnectionStateSetToInactiveAfterPoll()
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var connection = manager.CreateConnection();
|
||||
|
|
@ -1074,7 +1081,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[Fact]
|
||||
public async Task BlockingConnectionWorksWithStreamingConnections()
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var connection = manager.CreateConnection();
|
||||
|
|
@ -1109,7 +1116,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[Fact]
|
||||
public async Task BlockingConnectionWorksWithLongPollingConnection()
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var connection = manager.CreateConnection();
|
||||
|
|
@ -1143,7 +1150,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[Fact]
|
||||
public async Task AttemptingToPollWhileAlreadyPollingReplacesTheCurrentPoll()
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var connection = manager.CreateConnection();
|
||||
|
|
@ -1185,7 +1192,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[InlineData(HttpTransportType.WebSockets, TransferFormat.Binary | TransferFormat.Text)]
|
||||
public async Task TransferModeSet(HttpTransportType transportType, TransferFormat? expectedTransferFormats)
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var connection = manager.CreateConnection();
|
||||
|
|
@ -1217,7 +1224,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[Fact]
|
||||
public async Task UnauthorizedConnectionFailsToStartEndPoint()
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var connection = manager.CreateConnection();
|
||||
|
|
@ -1263,7 +1270,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[Fact]
|
||||
public async Task AuthenticatedUserWithoutPermissionCausesForbidden()
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var connection = manager.CreateConnection();
|
||||
|
|
@ -1311,7 +1318,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[Fact]
|
||||
public async Task AuthorizedConnectionCanConnectToEndPoint()
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var connection = manager.CreateConnection();
|
||||
|
|
@ -1368,7 +1375,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[Fact]
|
||||
public async Task AllPoliciesRequiredForAuthorizedEndPoint()
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var connection = manager.CreateConnection();
|
||||
|
|
@ -1450,7 +1457,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[Fact]
|
||||
public async Task AuthorizedConnectionWithAcceptedSchemesCanConnectToEndPoint()
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var connection = manager.CreateConnection();
|
||||
|
|
@ -1508,7 +1515,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[Fact]
|
||||
public async Task AuthorizedConnectionWithRejectedSchemesFailsToConnectToEndPoint()
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var connection = manager.CreateConnection();
|
||||
|
|
@ -1562,7 +1569,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[Fact]
|
||||
public async Task SetsInherentKeepAliveFeatureOnFirstLongPollingRequest()
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var connection = manager.CreateConnection();
|
||||
|
|
@ -1594,7 +1601,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[InlineData(HttpTransportType.WebSockets)]
|
||||
public async Task DeleteEndpointRejectsRequestToTerminateNonLongPollingTransport(HttpTransportType transportType)
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var connection = manager.CreateConnection();
|
||||
|
|
@ -1635,7 +1642,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[Fact]
|
||||
public async Task DeleteEndpointGracefullyTerminatesLongPolling()
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var connection = manager.CreateConnection();
|
||||
|
|
@ -1682,7 +1689,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[Fact]
|
||||
public async Task DeleteEndpointGracefullyTerminatesLongPollingEvenWhenBetweenPolls()
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var connection = manager.CreateConnection();
|
||||
|
|
@ -1730,7 +1737,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[Fact]
|
||||
public async Task NegotiateDoesNotReturnWebSocketsWhenNotAvailable()
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var manager = CreateConnectionManager(loggerFactory);
|
||||
var dispatcher = new HttpConnectionDispatcher(manager, loggerFactory);
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ using Microsoft.AspNetCore.Connections;
|
|||
using Microsoft.AspNetCore.Http.Connections.Internal;
|
||||
using Microsoft.AspNetCore.Http.Connections.Internal.Transports;
|
||||
using Microsoft.AspNetCore.Http.Features;
|
||||
using Microsoft.AspNetCore.SignalR.Tests;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Logging.Testing;
|
||||
using Microsoft.Net.Http.Headers;
|
||||
|
|
@ -21,7 +22,7 @@ using Xunit.Abstractions;
|
|||
|
||||
namespace Microsoft.AspNetCore.Http.Connections.Tests
|
||||
{
|
||||
public class WebSocketsTests : LoggedTest
|
||||
public class WebSocketsTests : VerifiableLoggedTest
|
||||
{
|
||||
public WebSocketsTests(ITestOutputHelper output)
|
||||
: base(output)
|
||||
|
|
@ -34,7 +35,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[InlineData(nameof(WebSocketMessageType.Binary))]
|
||||
public async Task ReceivedFramesAreWrittenToChannel(string webSocketMessageType)
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var pair = DuplexPipe.CreateConnectionPair(PipeOptions.Default, PipeOptions.Default);
|
||||
var connection = new HttpConnectionContext("foo", pair.Transport, pair.Application);
|
||||
|
|
@ -82,7 +83,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[InlineData(TransferFormat.Binary, nameof(WebSocketMessageType.Binary))]
|
||||
public async Task WebSocketTransportSetsMessageTypeBasedOnTransferFormatFeature(TransferFormat transferFormat, string expectedMessageType)
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var pair = DuplexPipe.CreateConnectionPair(PipeOptions.Default, PipeOptions.Default);
|
||||
var connection = new HttpConnectionContext("foo", pair.Transport, pair.Application);
|
||||
|
|
@ -119,7 +120,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[Fact]
|
||||
public async Task TransportCommunicatesErrorToApplicationWhenClientDisconnectsAbnormally()
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var pair = DuplexPipe.CreateConnectionPair(PipeOptions.Default, PipeOptions.Default);
|
||||
var connection = new HttpConnectionContext("foo", pair.Transport, pair.Application);
|
||||
|
|
@ -172,7 +173,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[Fact]
|
||||
public async Task ClientReceivesInternalServerErrorWhenTheApplicationFails()
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var pair = DuplexPipe.CreateConnectionPair(PipeOptions.Default, PipeOptions.Default);
|
||||
var connection = new HttpConnectionContext("foo", pair.Transport, pair.Application);
|
||||
|
|
@ -204,7 +205,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[Fact]
|
||||
public async Task TransportClosesOnCloseTimeoutIfClientDoesNotSendCloseFrame()
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var pair = DuplexPipe.CreateConnectionPair(PipeOptions.Default, PipeOptions.Default);
|
||||
var connection = new HttpConnectionContext("foo", pair.Transport, pair.Application);
|
||||
|
|
@ -239,7 +240,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[Fact]
|
||||
public async Task TransportFailsOnTimeoutWithErrorWhenApplicationFailsAndClientDoesNotSendCloseFrame()
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var pair = DuplexPipe.CreateConnectionPair(PipeOptions.Default, PipeOptions.Default);
|
||||
var connection = new HttpConnectionContext("foo", pair.Transport, pair.Application);
|
||||
|
|
@ -274,7 +275,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[Fact]
|
||||
public async Task ServerGracefullyClosesWhenApplicationEndsThenClientSendsCloseFrame()
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var pair = DuplexPipe.CreateConnectionPair(PipeOptions.Default, PipeOptions.Default);
|
||||
var connection = new HttpConnectionContext("foo", pair.Transport, pair.Application);
|
||||
|
|
@ -314,7 +315,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
[Fact]
|
||||
public async Task ServerGracefullyClosesWhenClientSendsCloseFrameThenApplicationEnds()
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var pair = DuplexPipe.CreateConnectionPair(PipeOptions.Default, PipeOptions.Default);
|
||||
var connection = new HttpConnectionContext("foo", pair.Transport, pair.Application);
|
||||
|
|
@ -357,7 +358,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Tests
|
|||
const string ExpectedSubProtocol = "expected";
|
||||
var providedSubProtocols = new[] {"provided1", "provided2"};
|
||||
|
||||
using (StartLog(out var loggerFactory, LogLevel.Debug))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Debug))
|
||||
{
|
||||
var pair = DuplexPipe.CreateConnectionPair(PipeOptions.Default, PipeOptions.Default);
|
||||
var connection = new HttpConnectionContext("foo", pair.Transport, pair.Application);
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Channels;
|
||||
using System.Threading.Tasks;
|
||||
|
|
@ -29,7 +30,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.FunctionalTests
|
|||
}
|
||||
|
||||
[Collection(HubConnectionTestsCollection.Name)]
|
||||
public class HubConnectionTests : LoggedTest
|
||||
public class HubConnectionTests : VerifiableLoggedTest
|
||||
{
|
||||
private readonly ServerFixture<Startup> _serverFixture;
|
||||
public HubConnectionTests(ServerFixture<Startup> serverFixture, ITestOutputHelper output)
|
||||
|
|
@ -76,7 +77,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.FunctionalTests
|
|||
public async Task CheckFixedMessage(string protocolName, HttpTransportType transportType, string path)
|
||||
{
|
||||
var protocol = HubProtocols[protocolName];
|
||||
using (StartLog(out var loggerFactory, $"{nameof(CheckFixedMessage)}_{protocol.Name}_{transportType}_{path.TrimStart('/')}"))
|
||||
using (StartVerifableLog(out var loggerFactory, $"{nameof(CheckFixedMessage)}_{protocol.Name}_{transportType}_{path.TrimStart('/')}"))
|
||||
{
|
||||
var connectionBuilder = new HubConnectionBuilder()
|
||||
.WithLoggerFactory(loggerFactory)
|
||||
|
|
@ -110,7 +111,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.FunctionalTests
|
|||
public async Task CanSendAndReceiveMessage(string protocolName, HttpTransportType transportType, string path)
|
||||
{
|
||||
var protocol = HubProtocols[protocolName];
|
||||
using (StartLog(out var loggerFactory, $"{nameof(CanSendAndReceiveMessage)}_{protocol.Name}_{transportType}_{path.TrimStart('/')}"))
|
||||
using (StartVerifableLog(out var loggerFactory, $"{nameof(CanSendAndReceiveMessage)}_{protocol.Name}_{transportType}_{path.TrimStart('/')}"))
|
||||
{
|
||||
const string originalMessage = "SignalR";
|
||||
var connection = CreateHubConnection(path, transportType, protocol, loggerFactory);
|
||||
|
|
@ -139,7 +140,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.FunctionalTests
|
|||
public async Task CanStopAndStartConnection(string protocolName, HttpTransportType transportType, string path)
|
||||
{
|
||||
var protocol = HubProtocols[protocolName];
|
||||
using (StartLog(out var loggerFactory, LogLevel.Trace, $"{nameof(CanStopAndStartConnection)}_{protocol.Name}_{transportType}_{path.TrimStart('/')}"))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Trace, $"{nameof(CanStopAndStartConnection)}_{protocol.Name}_{transportType}_{path.TrimStart('/')}"))
|
||||
{
|
||||
const string originalMessage = "SignalR";
|
||||
var connection = CreateHubConnection(path, transportType, protocol, loggerFactory);
|
||||
|
|
@ -170,7 +171,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.FunctionalTests
|
|||
public async Task CanStartConnectionFromClosedEvent(string protocolName, HttpTransportType transportType, string path)
|
||||
{
|
||||
var protocol = HubProtocols[protocolName];
|
||||
using (StartLog(out var loggerFactory, LogLevel.Trace, $"{nameof(CanStartConnectionFromClosedEvent)}_{protocol.Name}_{transportType}_{path.TrimStart('/')}"))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Trace, $"{nameof(CanStartConnectionFromClosedEvent)}_{protocol.Name}_{transportType}_{path.TrimStart('/')}"))
|
||||
{
|
||||
var logger = loggerFactory.CreateLogger<HubConnectionTests>();
|
||||
const string originalMessage = "SignalR";
|
||||
|
|
@ -232,7 +233,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.FunctionalTests
|
|||
public async Task MethodsAreCaseInsensitive(string protocolName, HttpTransportType transportType, string path)
|
||||
{
|
||||
var protocol = HubProtocols[protocolName];
|
||||
using (StartLog(out var loggerFactory, $"{nameof(MethodsAreCaseInsensitive)}_{protocol.Name}_{transportType}_{path.TrimStart('/')}"))
|
||||
using (StartVerifableLog(out var loggerFactory, $"{nameof(MethodsAreCaseInsensitive)}_{protocol.Name}_{transportType}_{path.TrimStart('/')}"))
|
||||
{
|
||||
const string originalMessage = "SignalR";
|
||||
var connection = CreateHubConnection(path, transportType, protocol, loggerFactory);
|
||||
|
|
@ -261,7 +262,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.FunctionalTests
|
|||
public async Task CanInvokeClientMethodFromServer(string protocolName, HttpTransportType transportType, string path)
|
||||
{
|
||||
var protocol = HubProtocols[protocolName];
|
||||
using (StartLog(out var loggerFactory, LogLevel.Trace, $"{nameof(CanInvokeClientMethodFromServer)}_{protocol.Name}_{transportType}_{path.TrimStart('/')}"))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Trace, $"{nameof(CanInvokeClientMethodFromServer)}_{protocol.Name}_{transportType}_{path.TrimStart('/')}"))
|
||||
{
|
||||
const string originalMessage = "SignalR";
|
||||
|
||||
|
|
@ -294,7 +295,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.FunctionalTests
|
|||
public async Task InvokeNonExistantClientMethodFromServer(string protocolName, HttpTransportType transportType, string path)
|
||||
{
|
||||
var protocol = HubProtocols[protocolName];
|
||||
using (StartLog(out var loggerFactory, LogLevel.Trace, $"{nameof(InvokeNonExistantClientMethodFromServer)}_{protocol.Name}_{transportType}_{path.TrimStart('/')}"))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Trace, $"{nameof(InvokeNonExistantClientMethodFromServer)}_{protocol.Name}_{transportType}_{path.TrimStart('/')}"))
|
||||
{
|
||||
var connection = CreateHubConnection(path, transportType, protocol, loggerFactory);
|
||||
var closeTcs = new TaskCompletionSource<object>();
|
||||
|
|
@ -335,7 +336,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.FunctionalTests
|
|||
public async Task CanStreamClientMethodFromServer(string protocolName, HttpTransportType transportType, string path)
|
||||
{
|
||||
var protocol = HubProtocols[protocolName];
|
||||
using (StartLog(out var loggerFactory, LogLevel.Trace, $"{nameof(CanStreamClientMethodFromServer)}_{protocol.Name}_{transportType}_{path.TrimStart('/')}"))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Trace, $"{nameof(CanStreamClientMethodFromServer)}_{protocol.Name}_{transportType}_{path.TrimStart('/')}"))
|
||||
{
|
||||
var connection = CreateHubConnection(path, transportType, protocol, loggerFactory);
|
||||
try
|
||||
|
|
@ -364,7 +365,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.FunctionalTests
|
|||
public async Task CanCloseStreamMethodEarly(string protocolName, HttpTransportType transportType, string path)
|
||||
{
|
||||
var protocol = HubProtocols[protocolName];
|
||||
using (StartLog(out var loggerFactory, $"{nameof(CanCloseStreamMethodEarly)}_{protocol.Name}_{transportType}_{path.TrimStart('/')}"))
|
||||
using (StartVerifableLog(out var loggerFactory, $"{nameof(CanCloseStreamMethodEarly)}_{protocol.Name}_{transportType}_{path.TrimStart('/')}"))
|
||||
{
|
||||
var connection = CreateHubConnection(path, transportType, protocol, loggerFactory);
|
||||
try
|
||||
|
|
@ -404,7 +405,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.FunctionalTests
|
|||
public async Task StreamDoesNotStartIfTokenAlreadyCanceled(string protocolName, HttpTransportType transportType, string path)
|
||||
{
|
||||
var protocol = HubProtocols[protocolName];
|
||||
using (StartLog(out var loggerFactory, LogLevel.Trace, $"{nameof(StreamDoesNotStartIfTokenAlreadyCanceled)}_{protocol.Name}_{transportType}_{path.TrimStart('/')}"))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Trace, $"{nameof(StreamDoesNotStartIfTokenAlreadyCanceled)}_{protocol.Name}_{transportType}_{path.TrimStart('/')}"))
|
||||
{
|
||||
var connection = CreateHubConnection(path, transportType, protocol, loggerFactory);
|
||||
try
|
||||
|
|
@ -436,7 +437,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.FunctionalTests
|
|||
public async Task ExceptionFromStreamingSentToClient(string protocolName, HttpTransportType transportType, string path)
|
||||
{
|
||||
var protocol = HubProtocols[protocolName];
|
||||
using (StartLog(out var loggerFactory, $"{nameof(ExceptionFromStreamingSentToClient)}_{protocol.Name}_{transportType}_{path.TrimStart('/')}"))
|
||||
using (StartVerifableLog(out var loggerFactory, $"{nameof(ExceptionFromStreamingSentToClient)}_{protocol.Name}_{transportType}_{path.TrimStart('/')}"))
|
||||
{
|
||||
var connection = CreateHubConnection(path, transportType, protocol, loggerFactory);
|
||||
try
|
||||
|
|
@ -464,7 +465,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.FunctionalTests
|
|||
public async Task ServerThrowsHubExceptionIfHubMethodCannotBeResolved(string hubProtocolName, HttpTransportType transportType, string hubPath)
|
||||
{
|
||||
var hubProtocol = HubProtocols[hubProtocolName];
|
||||
using (StartLog(out var loggerFactory, $"{nameof(ServerThrowsHubExceptionIfHubMethodCannotBeResolved)}_{hubProtocol.Name}_{transportType}_{hubPath.TrimStart('/')}"))
|
||||
using (StartVerifableLog(out var loggerFactory, $"{nameof(ServerThrowsHubExceptionIfHubMethodCannotBeResolved)}_{hubProtocol.Name}_{transportType}_{hubPath.TrimStart('/')}"))
|
||||
{
|
||||
var connection = CreateHubConnection(hubPath, transportType, hubProtocol, loggerFactory);
|
||||
try
|
||||
|
|
@ -491,7 +492,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.FunctionalTests
|
|||
public async Task ServerThrowsHubExceptionOnHubMethodArgumentCountMismatch(string hubProtocolName, HttpTransportType transportType, string hubPath)
|
||||
{
|
||||
var hubProtocol = HubProtocols[hubProtocolName];
|
||||
using (StartLog(out var loggerFactory, $"{nameof(ServerThrowsHubExceptionOnHubMethodArgumentCountMismatch)}_{hubProtocol.Name}_{transportType}_{hubPath.TrimStart('/')}"))
|
||||
using (StartVerifableLog(out var loggerFactory, $"{nameof(ServerThrowsHubExceptionOnHubMethodArgumentCountMismatch)}_{hubProtocol.Name}_{transportType}_{hubPath.TrimStart('/')}"))
|
||||
{
|
||||
var connection = CreateHubConnection(hubPath, transportType, hubProtocol, loggerFactory);
|
||||
try
|
||||
|
|
@ -518,7 +519,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.FunctionalTests
|
|||
public async Task ServerThrowsHubExceptionOnHubMethodArgumentTypeMismatch(string hubProtocolName, HttpTransportType transportType, string hubPath)
|
||||
{
|
||||
var hubProtocol = HubProtocols[hubProtocolName];
|
||||
using (StartLog(out var loggerFactory, $"{nameof(ServerThrowsHubExceptionOnHubMethodArgumentTypeMismatch)}_{hubProtocol.Name}_{transportType}_{hubPath.TrimStart('/')}"))
|
||||
using (StartVerifableLog(out var loggerFactory, $"{nameof(ServerThrowsHubExceptionOnHubMethodArgumentTypeMismatch)}_{hubProtocol.Name}_{transportType}_{hubPath.TrimStart('/')}"))
|
||||
{
|
||||
var connection = CreateHubConnection(hubPath, transportType, hubProtocol, loggerFactory);
|
||||
try
|
||||
|
|
@ -545,7 +546,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.FunctionalTests
|
|||
public async Task ServerThrowsHubExceptionIfStreamingHubMethodCannotBeResolved(string hubProtocolName, HttpTransportType transportType, string hubPath)
|
||||
{
|
||||
var hubProtocol = HubProtocols[hubProtocolName];
|
||||
using (StartLog(out var loggerFactory, $"{nameof(ServerThrowsHubExceptionIfStreamingHubMethodCannotBeResolved)}_{hubProtocol.Name}_{transportType}_{hubPath.TrimStart('/')}"))
|
||||
using (StartVerifableLog(out var loggerFactory, $"{nameof(ServerThrowsHubExceptionIfStreamingHubMethodCannotBeResolved)}_{hubProtocol.Name}_{transportType}_{hubPath.TrimStart('/')}"))
|
||||
{
|
||||
var connection = CreateHubConnection(hubPath, transportType, hubProtocol, loggerFactory);
|
||||
try
|
||||
|
|
@ -573,7 +574,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.FunctionalTests
|
|||
public async Task ServerThrowsHubExceptionOnStreamingHubMethodArgumentCountMismatch(string hubProtocolName, HttpTransportType transportType, string hubPath)
|
||||
{
|
||||
var hubProtocol = HubProtocols[hubProtocolName];
|
||||
using (StartLog(out var loggerFactory, $"{nameof(ServerThrowsHubExceptionOnStreamingHubMethodArgumentCountMismatch)}_{hubProtocol.Name}_{transportType}_{hubPath.TrimStart('/')}"))
|
||||
using (StartVerifableLog(out var loggerFactory, $"{nameof(ServerThrowsHubExceptionOnStreamingHubMethodArgumentCountMismatch)}_{hubProtocol.Name}_{transportType}_{hubPath.TrimStart('/')}"))
|
||||
{
|
||||
loggerFactory.AddConsole(LogLevel.Trace);
|
||||
var connection = CreateHubConnection(hubPath, transportType, hubProtocol, loggerFactory);
|
||||
|
|
@ -602,7 +603,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.FunctionalTests
|
|||
public async Task ServerThrowsHubExceptionOnStreamingHubMethodArgumentTypeMismatch(string hubProtocolName, HttpTransportType transportType, string hubPath)
|
||||
{
|
||||
var hubProtocol = HubProtocols[hubProtocolName];
|
||||
using (StartLog(out var loggerFactory, $"{nameof(ServerThrowsHubExceptionOnStreamingHubMethodArgumentTypeMismatch)}_{hubProtocol.Name}_{transportType}_{hubPath.TrimStart('/')}"))
|
||||
using (StartVerifableLog(out var loggerFactory, $"{nameof(ServerThrowsHubExceptionOnStreamingHubMethodArgumentTypeMismatch)}_{hubProtocol.Name}_{transportType}_{hubPath.TrimStart('/')}"))
|
||||
{
|
||||
var connection = CreateHubConnection(hubPath, transportType, hubProtocol, loggerFactory);
|
||||
try
|
||||
|
|
@ -630,7 +631,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.FunctionalTests
|
|||
public async Task ServerThrowsHubExceptionIfNonStreamMethodInvokedWithStreamAsync(string hubProtocolName, HttpTransportType transportType, string hubPath)
|
||||
{
|
||||
var hubProtocol = HubProtocols[hubProtocolName];
|
||||
using (StartLog(out var loggerFactory, $"{nameof(ServerThrowsHubExceptionIfNonStreamMethodInvokedWithStreamAsync)}_{hubProtocol.Name}_{transportType}_{hubPath.TrimStart('/')}"))
|
||||
using (StartVerifableLog(out var loggerFactory, $"{nameof(ServerThrowsHubExceptionIfNonStreamMethodInvokedWithStreamAsync)}_{hubProtocol.Name}_{transportType}_{hubPath.TrimStart('/')}"))
|
||||
{
|
||||
var connection = CreateHubConnection(hubPath, transportType, hubProtocol, loggerFactory);
|
||||
try
|
||||
|
|
@ -657,7 +658,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.FunctionalTests
|
|||
public async Task ServerThrowsHubExceptionIfStreamMethodInvokedWithInvoke(string hubProtocolName, HttpTransportType transportType, string hubPath)
|
||||
{
|
||||
var hubProtocol = HubProtocols[hubProtocolName];
|
||||
using (StartLog(out var loggerFactory, $"{nameof(ServerThrowsHubExceptionIfStreamMethodInvokedWithInvoke)}_{hubProtocol.Name}_{transportType}_{hubPath.TrimStart('/')}"))
|
||||
using (StartVerifableLog(out var loggerFactory, $"{nameof(ServerThrowsHubExceptionIfStreamMethodInvokedWithInvoke)}_{hubProtocol.Name}_{transportType}_{hubPath.TrimStart('/')}"))
|
||||
{
|
||||
var connection = CreateHubConnection(hubPath, transportType, hubProtocol, loggerFactory);
|
||||
try
|
||||
|
|
@ -684,7 +685,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.FunctionalTests
|
|||
public async Task ServerThrowsHubExceptionIfBuildingAsyncEnumeratorIsNotPossible(string hubProtocolName, HttpTransportType transportType, string hubPath)
|
||||
{
|
||||
var hubProtocol = HubProtocols[hubProtocolName];
|
||||
using (StartLog(out var loggerFactory, $"{nameof(ServerThrowsHubExceptionIfBuildingAsyncEnumeratorIsNotPossible)}_{hubProtocol.Name}_{transportType}_{hubPath.TrimStart('/')}"))
|
||||
using (StartVerifableLog(out var loggerFactory, $"{nameof(ServerThrowsHubExceptionIfBuildingAsyncEnumeratorIsNotPossible)}_{hubProtocol.Name}_{transportType}_{hubPath.TrimStart('/')}"))
|
||||
{
|
||||
var connection = CreateHubConnection(hubPath, transportType, hubProtocol, loggerFactory);
|
||||
try
|
||||
|
|
@ -710,7 +711,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.FunctionalTests
|
|||
[MemberData(nameof(TransportTypes))]
|
||||
public async Task ClientCanUseJwtBearerTokenForAuthentication(HttpTransportType transportType)
|
||||
{
|
||||
using (StartLog(out var loggerFactory, $"{nameof(ClientCanUseJwtBearerTokenForAuthentication)}_{transportType}"))
|
||||
using (StartVerifableLog(out var loggerFactory, $"{nameof(ClientCanUseJwtBearerTokenForAuthentication)}_{transportType}"))
|
||||
{
|
||||
async Task<string> AccessTokenProvider()
|
||||
{
|
||||
|
|
@ -748,7 +749,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.FunctionalTests
|
|||
[MemberData(nameof(TransportTypes))]
|
||||
public async Task ClientCanSendHeaders(HttpTransportType transportType)
|
||||
{
|
||||
using (StartLog(out var loggerFactory, $"{nameof(ClientCanSendHeaders)}_{transportType}"))
|
||||
using (StartVerifableLog(out var loggerFactory, $"{nameof(ClientCanSendHeaders)}_{transportType}"))
|
||||
{
|
||||
var hubConnection = new HubConnectionBuilder()
|
||||
.WithLoggerFactory(loggerFactory)
|
||||
|
|
@ -780,7 +781,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.FunctionalTests
|
|||
[WebSocketsSupportedCondition]
|
||||
public async Task WebSocketOptionsAreApplied()
|
||||
{
|
||||
using (StartLog(out var loggerFactory, $"{nameof(WebSocketOptionsAreApplied)}"))
|
||||
using (StartVerifableLog(out var loggerFactory, $"{nameof(WebSocketOptionsAreApplied)}"))
|
||||
{
|
||||
// System.Net has a HttpTransportType type which means we need to fully-qualify this rather than 'use' the namespace
|
||||
var cookieJar = new System.Net.CookieContainer();
|
||||
|
|
@ -815,7 +816,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.FunctionalTests
|
|||
[MemberData(nameof(TransportTypes))]
|
||||
public async Task CheckHttpConnectionFeatures(HttpTransportType transportType)
|
||||
{
|
||||
using (StartLog(out var loggerFactory, $"{nameof(CheckHttpConnectionFeatures)}_{transportType}"))
|
||||
using (StartVerifableLog(out var loggerFactory, $"{nameof(CheckHttpConnectionFeatures)}_{transportType}"))
|
||||
{
|
||||
var hubConnection = new HubConnectionBuilder()
|
||||
.WithLoggerFactory(loggerFactory)
|
||||
|
|
@ -851,7 +852,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.FunctionalTests
|
|||
[Fact]
|
||||
public async Task NegotiationSkipsServerSentEventsWhenUsingBinaryProtocol()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
using (StartVerifableLog(out var loggerFactory))
|
||||
{
|
||||
var hubConnectionBuilder = new HubConnectionBuilder()
|
||||
.WithLoggerFactory(loggerFactory)
|
||||
|
|
@ -881,7 +882,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.FunctionalTests
|
|||
[Fact]
|
||||
public async Task StopCausesPollToReturnImmediately()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
using (StartVerifableLog(out var loggerFactory))
|
||||
{
|
||||
PollTrackingMessageHandler pollTracker = null;
|
||||
var hubConnection = new HubConnectionBuilder()
|
||||
|
|
|
|||
|
|
@ -19,9 +19,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
|
|||
{
|
||||
public partial class HttpConnectionTests
|
||||
{
|
||||
private static readonly Version Windows8Version = new Version(6, 2);
|
||||
|
||||
public class ConnectionLifecycle : LoggedTest
|
||||
public class ConnectionLifecycle : VerifiableLoggedTest
|
||||
{
|
||||
public ConnectionLifecycle(ITestOutputHelper output) : base(output)
|
||||
{
|
||||
|
|
@ -30,7 +28,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
|
|||
[Fact]
|
||||
public async Task CanStartStartedConnection()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
using (StartVerifableLog(out var loggerFactory))
|
||||
{
|
||||
await WithConnectionAsync(CreateConnection(loggerFactory: loggerFactory), async (connection) =>
|
||||
{
|
||||
|
|
@ -43,7 +41,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
|
|||
[Fact]
|
||||
public async Task CanStartStartingConnection()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
using (StartVerifableLog(out var loggerFactory))
|
||||
{
|
||||
await WithConnectionAsync(
|
||||
CreateConnection(loggerFactory: loggerFactory, transport: new TestTransport(onTransportStart: SyncPoint.Create(out var syncPoint))),
|
||||
|
|
@ -63,7 +61,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
|
|||
[Fact]
|
||||
public async Task CannotStartConnectionOnceDisposed()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
using (StartVerifableLog(out var loggerFactory))
|
||||
{
|
||||
await WithConnectionAsync(
|
||||
CreateConnection(loggerFactory: loggerFactory),
|
||||
|
|
@ -85,7 +83,13 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
|
|||
[InlineData(3)]
|
||||
public async Task TransportThatFailsToStartFallsBack(int passThreshold)
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
bool ExpectedErrors(WriteContext writeContext)
|
||||
{
|
||||
return writeContext.LoggerName == typeof(HttpConnection).FullName &&
|
||||
writeContext.EventId.Name == "ErrorStartingTransport";
|
||||
}
|
||||
|
||||
using (StartVerifableLog(out var loggerFactory, expectedErrorsFilter: ExpectedErrors))
|
||||
{
|
||||
var startCounter = 0;
|
||||
var expected = new Exception("Transport failed to start");
|
||||
|
|
@ -130,7 +134,13 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
|
|||
[Fact]
|
||||
public async Task StartThrowsAfterAllTransportsFail()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
bool ExpectedErrors(WriteContext writeContext)
|
||||
{
|
||||
return writeContext.LoggerName == typeof(HttpConnection).FullName &&
|
||||
writeContext.EventId.Name == "ErrorStartingTransport";
|
||||
}
|
||||
|
||||
using (StartVerifableLog(out var loggerFactory, expectedErrorsFilter: ExpectedErrors))
|
||||
{
|
||||
var startCounter = 0;
|
||||
var availableTransports = 3;
|
||||
|
|
@ -165,7 +175,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
|
|||
[Fact]
|
||||
public async Task CanDisposeUnstartedConnection()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
using (StartVerifableLog(out var loggerFactory))
|
||||
{
|
||||
await WithConnectionAsync(
|
||||
CreateConnection(loggerFactory: loggerFactory),
|
||||
|
|
@ -180,7 +190,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
|
|||
[Fact]
|
||||
public async Task CanDisposeStartingConnection()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
using (StartVerifableLog(out var loggerFactory))
|
||||
{
|
||||
await WithConnectionAsync(
|
||||
CreateConnection(
|
||||
|
|
@ -214,7 +224,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
|
|||
[Fact]
|
||||
public async Task CanDisposeDisposingConnection()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
using (StartVerifableLog(out var loggerFactory))
|
||||
{
|
||||
await WithConnectionAsync(
|
||||
CreateConnection(
|
||||
|
|
@ -273,7 +283,13 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
|
|||
[Fact]
|
||||
public async Task TransportPipeIsCompletedWhenErrorOccursInTransport()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
bool ExpectedErrors(WriteContext writeContext)
|
||||
{
|
||||
return writeContext.LoggerName == typeof(LongPollingTransport).FullName &&
|
||||
writeContext.EventId.Name == "ErrorSending";
|
||||
}
|
||||
|
||||
using (StartVerifableLog(out var loggerFactory, expectedErrorsFilter: ExpectedErrors))
|
||||
{
|
||||
var httpHandler = new TestHttpMessageHandler();
|
||||
|
||||
|
|
@ -286,6 +302,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
|
|||
});
|
||||
return longPollResult.Task;
|
||||
});
|
||||
httpHandler.OnLongPollDelete(cancellationToken => ResponseUtils.CreateResponse(HttpStatusCode.NoContent));
|
||||
|
||||
httpHandler.OnSocketSend((data, _) =>
|
||||
{
|
||||
|
|
@ -309,7 +326,13 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
|
|||
[Fact]
|
||||
public async Task SSEWontStartIfSuccessfulConnectionIsNotEstablished()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
bool ExpectedErrors(WriteContext writeContext)
|
||||
{
|
||||
return writeContext.LoggerName == typeof(HttpConnection).FullName &&
|
||||
writeContext.EventId.Name == "ErrorStartingTransport";
|
||||
}
|
||||
|
||||
using (StartVerifableLog(out var loggerFactory, expectedErrorsFilter: ExpectedErrors))
|
||||
{
|
||||
var httpHandler = new TestHttpMessageHandler();
|
||||
|
||||
|
|
@ -333,7 +356,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
|
|||
[Fact]
|
||||
public async Task SSEWaitsForResponseToStart()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
using (StartVerifableLog(out var loggerFactory))
|
||||
{
|
||||
var httpHandler = new TestHttpMessageHandler();
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ using Microsoft.AspNetCore.Connections;
|
|||
using Microsoft.AspNetCore.Http.Connections;
|
||||
using Microsoft.AspNetCore.Http.Connections.Client;
|
||||
using Microsoft.AspNetCore.Http.Connections.Client.Internal;
|
||||
using Microsoft.AspNetCore.SignalR.Tests;
|
||||
using Moq;
|
||||
using Newtonsoft.Json;
|
||||
using Xunit;
|
||||
|
|
@ -60,6 +61,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
|
|||
|
||||
var negotiateUrlTcs = new TaskCompletionSource<string>();
|
||||
testHttpHandler.OnLongPoll(cancellationToken => ResponseUtils.CreateResponse(HttpStatusCode.NoContent));
|
||||
testHttpHandler.OnLongPollDelete(cancellationToken => ResponseUtils.CreateResponse(HttpStatusCode.NoContent));
|
||||
testHttpHandler.OnNegotiate((request, cancellationToken) =>
|
||||
{
|
||||
negotiateUrlTcs.TrySetResult(request.RequestUri.ToString());
|
||||
|
|
@ -67,12 +69,15 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
|
|||
ResponseUtils.CreateNegotiationContent());
|
||||
});
|
||||
|
||||
await WithConnectionAsync(
|
||||
CreateConnection(testHttpHandler, url: requestedUrl),
|
||||
async (connection) =>
|
||||
{
|
||||
await connection.StartAsync(TransferFormat.Text).OrTimeout();
|
||||
});
|
||||
using (var noErrorScope = new VerifyNoErrorsScope())
|
||||
{
|
||||
await WithConnectionAsync(
|
||||
CreateConnection(testHttpHandler, url: requestedUrl, loggerFactory: noErrorScope.LoggerFactory),
|
||||
async (connection) =>
|
||||
{
|
||||
await connection.StartAsync(TransferFormat.Text).OrTimeout();
|
||||
});
|
||||
}
|
||||
|
||||
Assert.Equal(expectedNegotiate, await negotiateUrlTcs.Task.OrTimeout());
|
||||
}
|
||||
|
|
@ -115,12 +120,15 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
|
|||
transportFactory.Setup(t => t.CreateTransport(HttpTransportType.LongPolling))
|
||||
.Returns(new TestTransport(transferFormat: TransferFormat.Text | TransferFormat.Binary));
|
||||
|
||||
await WithConnectionAsync(
|
||||
CreateConnection(testHttpHandler, transportFactory: transportFactory.Object),
|
||||
async (connection) =>
|
||||
{
|
||||
await connection.StartAsync(TransferFormat.Binary).OrTimeout();
|
||||
});
|
||||
using (var noErrorScope = new VerifyNoErrorsScope())
|
||||
{
|
||||
await WithConnectionAsync(
|
||||
CreateConnection(testHttpHandler, transportFactory: transportFactory.Object, loggerFactory: noErrorScope.LoggerFactory),
|
||||
async (connection) =>
|
||||
{
|
||||
await connection.StartAsync(TransferFormat.Binary).OrTimeout();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ using System.Threading.Tasks;
|
|||
using Microsoft.AspNetCore.Connections;
|
||||
using Microsoft.AspNetCore.Http.Connections;
|
||||
using Microsoft.AspNetCore.Http.Connections.Client;
|
||||
using Microsoft.AspNetCore.SignalR.Tests;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using Microsoft.Extensions.Logging.Testing;
|
||||
|
|
@ -19,7 +20,7 @@ using Xunit.Abstractions;
|
|||
|
||||
namespace Microsoft.AspNetCore.SignalR.Client.Tests
|
||||
{
|
||||
public partial class HttpConnectionTests : LoggedTest
|
||||
public partial class HttpConnectionTests : VerifiableLoggedTest
|
||||
{
|
||||
public HttpConnectionTests(ITestOutputHelper output) : base(output)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ using Xunit.Abstractions;
|
|||
|
||||
namespace Microsoft.AspNetCore.SignalR.Client.Tests
|
||||
{
|
||||
public partial class HubConnectionTests : LoggedTest
|
||||
public partial class HubConnectionTests : VerifiableLoggedTest
|
||||
{
|
||||
public HubConnectionTests(ITestOutputHelper output)
|
||||
: base(output)
|
||||
|
|
@ -120,7 +120,13 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
|
|||
[Fact]
|
||||
public async Task PendingInvocationsAreTerminatedIfServerTimeoutIntervalElapsesWithNoMessages()
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Trace))
|
||||
bool ExpectedErrors(WriteContext writeContext)
|
||||
{
|
||||
return writeContext.LoggerName == typeof(HubConnection).FullName &&
|
||||
writeContext.EventId.Name == "ShutdownWithError";
|
||||
}
|
||||
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Trace, expectedErrorsFilter: ExpectedErrors))
|
||||
{
|
||||
var hubConnection = CreateHubConnection(new TestConnection(), loggerFactory: loggerFactory);
|
||||
hubConnection.ServerTimeout = TimeSpan.FromMilliseconds(2000);
|
||||
|
|
|
|||
|
|
@ -43,6 +43,12 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
|
|||
(request.RequestUri.PathAndQuery.Contains("?id=") || request.RequestUri.PathAndQuery.Contains("&id="));
|
||||
}
|
||||
|
||||
public static bool IsLongPollDeleteRequest(HttpRequestMessage request)
|
||||
{
|
||||
return request.Method == HttpMethod.Delete &&
|
||||
(request.RequestUri.PathAndQuery.Contains("?id=") || request.RequestUri.PathAndQuery.Contains("&id="));
|
||||
}
|
||||
|
||||
public static bool IsSocketSendRequest(HttpRequestMessage request)
|
||||
{
|
||||
return request.Method == HttpMethod.Post &&
|
||||
|
|
|
|||
|
|
@ -124,6 +124,23 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
|
|||
});
|
||||
}
|
||||
|
||||
public void OnLongPollDelete(Func<CancellationToken, HttpResponseMessage> handler) => OnLongPollDelete((cancellationToken) => Task.FromResult(handler(cancellationToken)));
|
||||
|
||||
public void OnLongPollDelete(Func<CancellationToken, Task<HttpResponseMessage>> handler)
|
||||
{
|
||||
OnRequest((request, next, cancellationToken) =>
|
||||
{
|
||||
if (ResponseUtils.IsLongPollDeleteRequest(request))
|
||||
{
|
||||
return handler(cancellationToken);
|
||||
}
|
||||
else
|
||||
{
|
||||
return next();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void OnLongPoll(Func<CancellationToken, HttpResponseMessage> handler) => OnLongPoll(cancellationToken => Task.FromResult(handler(cancellationToken)));
|
||||
|
||||
public void OnLongPoll(Func<CancellationToken, Task<HttpResponseMessage>> handler)
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ namespace Microsoft.AspNetCore.SignalR.Redis.Tests
|
|||
}
|
||||
|
||||
[Collection(EndToEndTestsCollection.Name)]
|
||||
public class RedisEndToEndTests : LoggedTest
|
||||
public class RedisEndToEndTests : VerifiableLoggedTest
|
||||
{
|
||||
private readonly RedisServerFixture<Startup> _serverFixture;
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ namespace Microsoft.AspNetCore.SignalR.Redis.Tests
|
|||
[MemberData(nameof(TransportTypesAndProtocolTypes))]
|
||||
public async Task HubConnectionCanSendAndReceiveMessages(HttpTransportType transportType, string protocolName)
|
||||
{
|
||||
using (StartLog(out var loggerFactory, testName:
|
||||
using (StartVerifableLog(out var loggerFactory, testName:
|
||||
$"{nameof(HubConnectionCanSendAndReceiveMessages)}_{transportType.ToString()}_{protocolName}"))
|
||||
{
|
||||
var protocol = HubProtocolHelpers.GetHubProtocol(protocolName);
|
||||
|
|
@ -64,7 +64,7 @@ namespace Microsoft.AspNetCore.SignalR.Redis.Tests
|
|||
[MemberData(nameof(TransportTypesAndProtocolTypes))]
|
||||
public async Task HubConnectionCanSendAndReceiveGroupMessages(HttpTransportType transportType, string protocolName)
|
||||
{
|
||||
using (StartLog(out var loggerFactory, testName:
|
||||
using (StartVerifableLog(out var loggerFactory, testName:
|
||||
$"{nameof(HubConnectionCanSendAndReceiveGroupMessages)}_{transportType.ToString()}_{protocolName}"))
|
||||
{
|
||||
var protocol = HubProtocolHelpers.GetHubProtocol(protocolName);
|
||||
|
|
|
|||
|
|
@ -144,65 +144,66 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
return _loggerFactory.CreateLogger(categoryName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TestSink doesn't seem to be thread-safe :(.
|
||||
private class LogSinkProvider : ILoggerProvider
|
||||
// TestSink doesn't seem to be thread-safe :(.
|
||||
internal class LogSinkProvider : ILoggerProvider
|
||||
{
|
||||
private readonly ConcurrentQueue<LogRecord> _logs = new ConcurrentQueue<LogRecord>();
|
||||
|
||||
public ILogger CreateLogger(string categoryName)
|
||||
{
|
||||
private readonly ConcurrentQueue<LogRecord> _logs = new ConcurrentQueue<LogRecord>();
|
||||
return new LogSinkLogger(categoryName, this);
|
||||
}
|
||||
|
||||
public ILogger CreateLogger(string categoryName)
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
public IList<LogRecord> GetLogs() => _logs.ToList();
|
||||
|
||||
public void Log<TState>(string categoryName, LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
|
||||
{
|
||||
var record = new LogRecord(
|
||||
DateTime.Now,
|
||||
new WriteContext()
|
||||
{
|
||||
LoggerName = categoryName,
|
||||
LogLevel = logLevel,
|
||||
EventId = eventId,
|
||||
State = state,
|
||||
Exception = exception,
|
||||
Formatter = (o, e) => formatter((TState)o, e),
|
||||
});
|
||||
_logs.Enqueue(record);
|
||||
}
|
||||
|
||||
private class LogSinkLogger : ILogger
|
||||
{
|
||||
private readonly string _categoryName;
|
||||
private readonly LogSinkProvider _logSinkProvider;
|
||||
|
||||
public LogSinkLogger(string categoryName, LogSinkProvider logSinkProvider)
|
||||
{
|
||||
return new LogSinkLogger(categoryName, this);
|
||||
_categoryName = categoryName;
|
||||
_logSinkProvider = logSinkProvider;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
public IDisposable BeginScope<TState>(TState state)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public IList<LogRecord> GetLogs() => _logs.ToList();
|
||||
|
||||
public void Log<TState>(string categoryName, LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
|
||||
public bool IsEnabled(LogLevel logLevel)
|
||||
{
|
||||
var record = new LogRecord(
|
||||
DateTime.Now,
|
||||
new WriteContext()
|
||||
{
|
||||
LoggerName = categoryName,
|
||||
LogLevel = logLevel,
|
||||
EventId = eventId,
|
||||
State = state,
|
||||
Exception = exception,
|
||||
Formatter = (o, e) => formatter((TState)o, e),
|
||||
});
|
||||
_logs.Enqueue(record);
|
||||
return true;
|
||||
}
|
||||
|
||||
private class LogSinkLogger : ILogger
|
||||
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
|
||||
{
|
||||
private readonly string _categoryName;
|
||||
private readonly LogSinkProvider _logSinkProvider;
|
||||
|
||||
public LogSinkLogger(string categoryName, LogSinkProvider logSinkProvider)
|
||||
{
|
||||
_categoryName = categoryName;
|
||||
_logSinkProvider = logSinkProvider;
|
||||
}
|
||||
|
||||
public IDisposable BeginScope<TState>(TState state)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool IsEnabled(LogLevel logLevel)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
|
||||
{
|
||||
_logSinkProvider.Log(_categoryName, logLevel, eventId, state, exception, formatter);
|
||||
}
|
||||
_logSinkProvider.Log(_categoryName, logLevel, eventId, state, exception, formatter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Logging.Testing;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace Microsoft.AspNetCore.SignalR.Tests
|
||||
{
|
||||
public class VerifiableLoggedTest : LoggedTest
|
||||
{
|
||||
public VerifiableLoggedTest(ITestOutputHelper output) : base(output)
|
||||
{
|
||||
}
|
||||
|
||||
public IDisposable StartVerifableLog(out ILoggerFactory loggerFactory, [CallerMemberName] string testName = null, Func<WriteContext, bool> expectedErrorsFilter = null)
|
||||
{
|
||||
var disposable = StartLog(out loggerFactory, testName);
|
||||
|
||||
return new VerifyNoErrorsScope(loggerFactory, disposable, expectedErrorsFilter);
|
||||
}
|
||||
|
||||
public IDisposable StartVerifableLog(out ILoggerFactory loggerFactory, LogLevel minLogLevel, [CallerMemberName] string testName = null, Func<WriteContext, bool> expectedErrorsFilter = null)
|
||||
{
|
||||
var disposable = StartLog(out loggerFactory, minLogLevel, testName);
|
||||
|
||||
return new VerifyNoErrorsScope(loggerFactory, disposable, expectedErrorsFilter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Logging.Testing;
|
||||
|
||||
namespace Microsoft.AspNetCore.SignalR.Tests
|
||||
{
|
||||
public class VerifyNoErrorsScope : IDisposable
|
||||
{
|
||||
private readonly IDisposable _wrappedDisposable;
|
||||
private readonly Func<WriteContext, bool> _expectedErrorsFilter;
|
||||
private readonly LogSinkProvider _sink;
|
||||
|
||||
public ILoggerFactory LoggerFactory { get; }
|
||||
|
||||
public VerifyNoErrorsScope(ILoggerFactory loggerFactory = null, IDisposable wrappedDisposable = null, Func<WriteContext, bool> expectedErrorsFilter = null)
|
||||
{
|
||||
_wrappedDisposable = wrappedDisposable;
|
||||
_expectedErrorsFilter = expectedErrorsFilter;
|
||||
_sink = new LogSinkProvider();
|
||||
|
||||
LoggerFactory = loggerFactory ?? new LoggerFactory();
|
||||
LoggerFactory.AddProvider(_sink);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_wrappedDisposable?.Dispose();
|
||||
|
||||
var results = _sink.GetLogs().Where(w => w.Write.LogLevel >= LogLevel.Error).ToList();
|
||||
|
||||
if (_expectedErrorsFilter != null)
|
||||
{
|
||||
results = results.Where(w => !_expectedErrorsFilter(w.Write)).ToList();
|
||||
}
|
||||
|
||||
if (results.Count > 0)
|
||||
{
|
||||
string errorMessage = $"{results.Count} error(s) logged.";
|
||||
errorMessage += Environment.NewLine;
|
||||
errorMessage += string.Join(Environment.NewLine, results.Select(record =>
|
||||
{
|
||||
var r = record.Write;
|
||||
|
||||
string lineMessage = r.LoggerName + " - " + r.EventId.ToString() + " - " + r.Formatter(r.State, r.Exception);
|
||||
if (r.Exception != null)
|
||||
{
|
||||
lineMessage += Environment.NewLine;
|
||||
lineMessage += "===================";
|
||||
lineMessage += Environment.NewLine;
|
||||
lineMessage += r.Exception;
|
||||
lineMessage += Environment.NewLine;
|
||||
lineMessage += "===================";
|
||||
}
|
||||
return lineMessage;
|
||||
}));
|
||||
|
||||
throw new Exception(errorMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -34,7 +34,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
}
|
||||
|
||||
[Collection(EndToEndTestsCollection.Name)]
|
||||
public class EndToEndTests : LoggedTest
|
||||
public class EndToEndTests : VerifiableLoggedTest
|
||||
{
|
||||
private readonly ServerFixture<Startup> _serverFixture;
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
[MemberData(nameof(TransportTypes))]
|
||||
public async Task CanStartAndStopConnectionUsingGivenTransport(HttpTransportType transportType)
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
using (StartVerifableLog(out var loggerFactory))
|
||||
{
|
||||
var url = _serverFixture.Url + "/echo";
|
||||
var connection = new HttpConnection(new Uri(url), transportType, loggerFactory);
|
||||
|
|
@ -89,7 +89,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
[WebSocketsSupportedCondition]
|
||||
public async Task WebSocketsTest()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
using (StartVerifableLog(out var loggerFactory))
|
||||
{
|
||||
var logger = loggerFactory.CreateLogger<EndToEndTests>();
|
||||
|
||||
|
|
@ -126,7 +126,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
[WebSocketsSupportedCondition]
|
||||
public async Task WebSocketsReceivesAndSendsPartialFramesTest()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
using (StartVerifableLog(out var loggerFactory))
|
||||
{
|
||||
var logger = loggerFactory.CreateLogger<EndToEndTests>();
|
||||
|
||||
|
|
@ -164,7 +164,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
[WebSocketsSupportedCondition]
|
||||
public async Task HttpRequestsNotSentWhenWebSocketsTransportRequested()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
using (StartVerifableLog(out var loggerFactory))
|
||||
{
|
||||
var logger = loggerFactory.CreateLogger<EndToEndTests>();
|
||||
var url = _serverFixture.Url + "/echo";
|
||||
|
|
@ -212,7 +212,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
[MemberData(nameof(TransportTypesAndTransferFormats))]
|
||||
public async Task ConnectionCanSendAndReceiveMessages(HttpTransportType transportType, TransferFormat requestedTransferFormat)
|
||||
{
|
||||
using (StartLog(out var loggerFactory, minLogLevel: LogLevel.Trace, testName: $"ConnectionCanSendAndReceiveMessages_{transportType.ToString()}_{requestedTransferFormat.ToString()}"))
|
||||
using (StartVerifableLog(out var loggerFactory, minLogLevel: LogLevel.Trace, testName: $"ConnectionCanSendAndReceiveMessages_{transportType.ToString()}_{requestedTransferFormat.ToString()}"))
|
||||
{
|
||||
var logger = loggerFactory.CreateLogger<EndToEndTests>();
|
||||
|
||||
|
|
@ -276,7 +276,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
[MemberData(nameof(MessageSizesData))]
|
||||
public async Task ConnectionCanSendAndReceiveDifferentMessageSizesWebSocketsTransport(string message)
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Trace, testName: $"ConnectionCanSendAndReceiveDifferentMessageSizesWebSocketsTransport_{message.Length}"))
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Trace, testName: $"ConnectionCanSendAndReceiveDifferentMessageSizesWebSocketsTransport_{message.Length}"))
|
||||
{
|
||||
var logger = loggerFactory.CreateLogger<EndToEndTests>();
|
||||
|
||||
|
|
@ -318,7 +318,13 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
[WebSocketsSupportedCondition]
|
||||
public async Task UnauthorizedWebSocketsConnectionDoesNotConnect()
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Trace))
|
||||
bool ExpectedErrors(WriteContext writeContext)
|
||||
{
|
||||
return writeContext.LoggerName == typeof(HttpConnection).FullName &&
|
||||
writeContext.EventId.Name == "ErrorStartingTransport";
|
||||
}
|
||||
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Trace, expectedErrorsFilter: ExpectedErrors))
|
||||
{
|
||||
var logger = loggerFactory.CreateLogger<EndToEndTests>();
|
||||
|
||||
|
|
@ -351,7 +357,13 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
[InlineData(HttpTransportType.ServerSentEvents)]
|
||||
public async Task UnauthorizedConnectionDoesNotConnect(HttpTransportType transportType)
|
||||
{
|
||||
using (StartLog(out var loggerFactory, LogLevel.Trace, testName: $"{nameof(UnauthorizedConnectionDoesNotConnect)}_{transportType}"))
|
||||
bool ExpectedErrors(WriteContext writeContext)
|
||||
{
|
||||
return writeContext.LoggerName == typeof(HttpConnection).FullName &&
|
||||
writeContext.EventId.Name == "ErrorWithNegotiation";
|
||||
}
|
||||
|
||||
using (StartVerifableLog(out var loggerFactory, LogLevel.Trace, testName: $"{nameof(UnauthorizedConnectionDoesNotConnect)}_{transportType}", expectedErrorsFilter: ExpectedErrors))
|
||||
{
|
||||
var logger = loggerFactory.CreateLogger<EndToEndTests>();
|
||||
|
||||
|
|
@ -408,7 +420,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
|
||||
private async Task ServerClosesConnectionWithErrorIfHubCannotBeCreated(HttpTransportType transportType)
|
||||
{
|
||||
using (StartLog(out var loggerFactory, testName: $"ConnectionCanSendAndReceiveMessages_{transportType.ToString()}"))
|
||||
using (StartVerifableLog(out var loggerFactory, testName: $"ConnectionCanSendAndReceiveMessages_{transportType.ToString()}"))
|
||||
{
|
||||
var logger = loggerFactory.CreateLogger<EndToEndTests>();
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ using Xunit.Abstractions;
|
|||
namespace Microsoft.AspNetCore.SignalR.Tests
|
||||
{
|
||||
[Collection(EndToEndTestsCollection.Name)]
|
||||
public class WebSocketsTransportTests : LoggedTest
|
||||
public class WebSocketsTransportTests : VerifiableLoggedTest
|
||||
{
|
||||
private readonly ServerFixture<Startup> _serverFixture;
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
[WebSocketsSupportedCondition]
|
||||
public async Task WebSocketsTransportStopsSendAndReceiveLoopsWhenTransportIsStopped()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
using (StartVerifableLog(out var loggerFactory))
|
||||
{
|
||||
var webSocketsTransport = new WebSocketsTransport(httpConnectionOptions: null, loggerFactory: loggerFactory);
|
||||
await webSocketsTransport.StartAsync(new Uri(_serverFixture.WebSocketsUrl + "/echo"),
|
||||
|
|
@ -81,7 +81,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
[WebSocketsSupportedCondition]
|
||||
public async Task WebSocketsTransportSendsUserAgent()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
using (StartVerifableLog(out var loggerFactory))
|
||||
{
|
||||
var webSocketsTransport = new WebSocketsTransport(httpConnectionOptions: null, loggerFactory: loggerFactory);
|
||||
await webSocketsTransport.StartAsync(new Uri(_serverFixture.WebSocketsUrl + "/httpheader"),
|
||||
|
|
@ -109,7 +109,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
[WebSocketsSupportedCondition]
|
||||
public async Task WebSocketsTransportSendsXRequestedWithHeader()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
using (StartVerifableLog(out var loggerFactory))
|
||||
{
|
||||
var webSocketsTransport = new WebSocketsTransport(httpConnectionOptions: null, loggerFactory: loggerFactory);
|
||||
await webSocketsTransport.StartAsync(new Uri(_serverFixture.WebSocketsUrl + "/httpheader"),
|
||||
|
|
@ -132,7 +132,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
[WebSocketsSupportedCondition]
|
||||
public async Task WebSocketsTransportStopsWhenConnectionChannelClosed()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
using (StartVerifableLog(out var loggerFactory))
|
||||
{
|
||||
var webSocketsTransport = new WebSocketsTransport(httpConnectionOptions: null, loggerFactory: loggerFactory);
|
||||
await webSocketsTransport.StartAsync(new Uri(_serverFixture.WebSocketsUrl + "/echo"),
|
||||
|
|
@ -148,7 +148,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
[InlineData(TransferFormat.Binary)]
|
||||
public async Task WebSocketsTransportStopsWhenConnectionClosedByTheServer(TransferFormat transferFormat)
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
using (StartVerifableLog(out var loggerFactory))
|
||||
{
|
||||
var webSocketsTransport = new WebSocketsTransport(httpConnectionOptions: null, loggerFactory: loggerFactory);
|
||||
await webSocketsTransport.StartAsync(new Uri(_serverFixture.WebSocketsUrl + "/echoAndClose"), transferFormat);
|
||||
|
|
@ -170,7 +170,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
[InlineData(TransferFormat.Binary)]
|
||||
public async Task WebSocketsTransportSetsTransferFormat(TransferFormat transferFormat)
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
using (StartVerifableLog(out var loggerFactory))
|
||||
{
|
||||
var webSocketsTransport = new WebSocketsTransport(httpConnectionOptions: null, loggerFactory: loggerFactory);
|
||||
|
||||
|
|
@ -188,7 +188,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
[WebSocketsSupportedCondition]
|
||||
public async Task WebSocketsTransportThrowsForInvalidTransferFormat(TransferFormat transferFormat)
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
using (StartVerifableLog(out var loggerFactory))
|
||||
{
|
||||
var webSocketsTransport = new WebSocketsTransport(httpConnectionOptions: null, loggerFactory: loggerFactory);
|
||||
var exception = await Assert.ThrowsAsync<ArgumentException>(() =>
|
||||
|
|
|
|||
Loading…
Reference in New Issue