Merge branch 'release/2.1' into dev
This commit is contained in:
commit
9f0b52562c
|
|
@ -724,7 +724,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.FunctionalTests
|
|||
}
|
||||
|
||||
[ConditionalFact]
|
||||
[OSSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, WindowsVersions.Win2008R2, SkipReason = "No WebSockets Client for this platform")]
|
||||
[WebSocketsSupportedCondition]
|
||||
public async Task WebSocketOptionsAreApplied()
|
||||
{
|
||||
using (StartLog(out var loggerFactory, $"{nameof(WebSocketOptionsAreApplied)}"))
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using Microsoft.AspNetCore.Testing.xunit;
|
||||
|
||||
namespace Microsoft.AspNetCore.SignalR.Tests
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly, AllowMultiple = true)]
|
||||
public class WebSocketsSupportedConditionAttribute : Attribute, ITestCondition
|
||||
{
|
||||
public bool IsMet
|
||||
{
|
||||
get
|
||||
{
|
||||
#if NETCOREAPP2_1
|
||||
// .NET Core 2.1 and greater has sockets
|
||||
return true;
|
||||
#else
|
||||
// Non-Windows platforms have sockets
|
||||
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Windows 8 and greater has sockets
|
||||
if (Environment.Version >= new Version(6, 2))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
public string SkipReason => "No WebSockets Client for this platform";
|
||||
}
|
||||
}
|
||||
|
|
@ -46,7 +46,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
[InlineData(TransportType.WebSockets, typeof(WebSocketsTransport))]
|
||||
[InlineData(TransportType.ServerSentEvents, typeof(ServerSentEventsTransport))]
|
||||
[InlineData(TransportType.LongPolling, typeof(LongPollingTransport))]
|
||||
[OSSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, WindowsVersions.Win2008R2, SkipReason = "No WebSockets Client for this platform")]
|
||||
[WebSocketsSupportedCondition]
|
||||
public void DefaultTransportFactoryCreatesRequestedTransportIfAvailable(TransportType requestedTransport, Type expectedTransportType)
|
||||
{
|
||||
var transportFactory = new DefaultTransportFactory(requestedTransport, loggerFactory: null, httpClient: new HttpClient(), httpOptions: null);
|
||||
|
|
@ -70,7 +70,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
}
|
||||
|
||||
[ConditionalFact]
|
||||
[OSSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, WindowsVersions.Win2008R2, SkipReason = "No WebSockets Client for this platform")]
|
||||
[WebSocketsSupportedCondition]
|
||||
public void DefaultTransportFactoryCreatesWebSocketsTransportIfAvailable()
|
||||
{
|
||||
Assert.IsType<WebSocketsTransport>(
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
}
|
||||
|
||||
[ConditionalFact]
|
||||
[OSSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, WindowsVersions.Win2008R2, SkipReason = "No WebSockets Client for this platform")]
|
||||
[WebSocketsSupportedCondition]
|
||||
public async Task WebSocketsTest()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
|
|
@ -118,7 +118,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
}
|
||||
|
||||
[ConditionalFact]
|
||||
[OSSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, WindowsVersions.Win2008R2, SkipReason = "No WebSockets Client for this platform")]
|
||||
[WebSocketsSupportedCondition]
|
||||
public async Task HTTPRequestsNotSentWhenWebSocketsTransportRequested()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
|
|
@ -251,7 +251,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
}
|
||||
|
||||
[ConditionalTheory]
|
||||
[OSSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, WindowsVersions.Win2008R2, SkipReason = "No WebSockets Client for this platform")]
|
||||
[WebSocketsSupportedCondition]
|
||||
[MemberData(nameof(MessageSizesData))]
|
||||
public async Task ConnectionCanSendAndReceiveDifferentMessageSizesWebSocketsTransport(string message)
|
||||
{
|
||||
|
|
@ -303,7 +303,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
}
|
||||
|
||||
[ConditionalFact]
|
||||
[OSSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, WindowsVersions.Win2008R2, SkipReason = "No WebSockets Client for this platform")]
|
||||
[WebSocketsSupportedCondition]
|
||||
public async Task ServerClosesConnectionWithErrorIfHubCannotBeCreated_WebSocket()
|
||||
{
|
||||
try
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
}
|
||||
|
||||
[ConditionalFact]
|
||||
[OSSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, WindowsVersions.Win2008R2, SkipReason = "No WebSockets Client for this platform")]
|
||||
[WebSocketsSupportedCondition]
|
||||
public void HttpOptionsSetOntoWebSocketOptions()
|
||||
{
|
||||
ClientWebSocketOptions webSocketsOptions = null;
|
||||
|
|
@ -69,7 +69,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
}
|
||||
|
||||
[ConditionalFact]
|
||||
[OSSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, WindowsVersions.Win2008R2, SkipReason = "No WebSockets Client for this platform")]
|
||||
[WebSocketsSupportedCondition]
|
||||
public async Task WebSocketsTransportStopsSendAndReceiveLoopsWhenTransportIsStopped()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
|
|
@ -84,7 +84,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
}
|
||||
|
||||
[ConditionalFact(Skip = "Issue in ClientWebSocket prevents user-agent being set - https://github.com/dotnet/corefx/issues/26627")]
|
||||
[OSSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, WindowsVersions.Win2008R2, SkipReason = "No WebSockets Client for this platform")]
|
||||
[WebSocketsSupportedCondition]
|
||||
public async Task WebSocketsTransportSendsUserAgent()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
|
|
@ -113,7 +113,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
}
|
||||
|
||||
[ConditionalFact]
|
||||
[OSSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, WindowsVersions.Win2008R2, SkipReason = "No WebSockets Client for this platform")]
|
||||
[WebSocketsSupportedCondition]
|
||||
public async Task WebSocketsTransportStopsWhenConnectionChannelClosed()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
|
|
@ -128,7 +128,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
}
|
||||
|
||||
[ConditionalTheory]
|
||||
[OSSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, WindowsVersions.Win2008R2, SkipReason = "No WebSockets Client for this platform")]
|
||||
[WebSocketsSupportedCondition]
|
||||
[InlineData(TransferFormat.Text)]
|
||||
[InlineData(TransferFormat.Binary)]
|
||||
public async Task WebSocketsTransportStopsWhenConnectionClosedByTheServer(TransferFormat transferFormat)
|
||||
|
|
@ -151,7 +151,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
}
|
||||
|
||||
[ConditionalTheory]
|
||||
[OSSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, WindowsVersions.Win2008R2, SkipReason = "No WebSockets Client for this platform")]
|
||||
[WebSocketsSupportedCondition]
|
||||
[InlineData(TransferFormat.Text)]
|
||||
[InlineData(TransferFormat.Binary)]
|
||||
public async Task WebSocketsTransportSetsTransferFormat(TransferFormat transferFormat)
|
||||
|
|
@ -172,7 +172,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
[ConditionalTheory]
|
||||
[InlineData(TransferFormat.Text | TransferFormat.Binary)] // Multiple values not allowed
|
||||
[InlineData((TransferFormat)42)] // Unexpected value
|
||||
[OSSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, WindowsVersions.Win2008R2, SkipReason = "No WebSockets Client for this platform")]
|
||||
[WebSocketsSupportedCondition]
|
||||
public async Task WebSocketsTransportThrowsForInvalidTransferFormat(TransferFormat transferFormat)
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ using Microsoft.AspNetCore.Builder;
|
|||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Hosting.Server.Features;
|
||||
using Microsoft.AspNetCore.Connections;
|
||||
using Microsoft.AspNetCore.SignalR.Tests;
|
||||
using Microsoft.AspNetCore.Testing.xunit;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
|
@ -68,7 +69,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
|
|||
}
|
||||
|
||||
[ConditionalFact]
|
||||
[OSSkipCondition(OperatingSystems.Windows, WindowsVersions.Win7, WindowsVersions.Win2008R2, SkipReason = "No WebSockets Client for this platform")]
|
||||
[WebSocketsSupportedCondition]
|
||||
public async Task MapConnectionHandlerWithWebSocketSubProtocolSetsProtocol()
|
||||
{
|
||||
var host = BuildWebHost<MyConnectionHandler>("/socket",
|
||||
|
|
|
|||
Loading…
Reference in New Issue