Fix some skipped SignalR tests (#19070)
This commit is contained in:
parent
4498058343
commit
4ac890983e
|
|
@ -36,8 +36,14 @@ namespace Microsoft.AspNetCore.Http.Connections.Client.Internal
|
|||
{
|
||||
_webSocket = new ClientWebSocket();
|
||||
|
||||
// Issue in ClientWebSocket prevents user-agent being set - https://github.com/dotnet/corefx/issues/26627
|
||||
//_webSocket.Options.SetRequestHeader("User-Agent", Constants.UserAgentHeader.ToString());
|
||||
// Full Framework will throw when trying to set the User-Agent header
|
||||
// So avoid setting it in netstandard2.0 and only set it in netstandard2.1 and higher
|
||||
#if !NETSTANDARD2_0
|
||||
_webSocket.Options.SetRequestHeader("User-Agent", Constants.UserAgentHeader.ToString());
|
||||
#else
|
||||
// Set an alternative user agent header on Full framework
|
||||
_webSocket.Options.SetRequestHeader("X-SignalR-User-Agent", Constants.UserAgentHeader.ToString());
|
||||
#endif
|
||||
|
||||
if (httpConnectionOptions != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
|
||||
public Task ProtocolError()
|
||||
{
|
||||
return Clients.Caller.SendAsync("Send", new string('x', 3000), new SelfRef());
|
||||
return Clients.Caller.SendAsync("Send", new SelfRef());
|
||||
}
|
||||
|
||||
public void InvalidArgument(CancellationToken token)
|
||||
|
|
@ -196,7 +196,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
Self = this;
|
||||
}
|
||||
|
||||
public SelfRef Self;
|
||||
public SelfRef Self { get; set; }
|
||||
}
|
||||
|
||||
public async Task<string> StreamingConcat(ChannelReader<string> source)
|
||||
|
|
|
|||
|
|
@ -3210,7 +3210,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
}
|
||||
}
|
||||
|
||||
[Fact(Skip = "Object not supported yet")]
|
||||
[Fact]
|
||||
public async Task UploadStreamedObjects()
|
||||
{
|
||||
var serviceProvider = HubConnectionHandlerTestUtils.CreateServiceProvider();
|
||||
|
|
@ -3274,7 +3274,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
}
|
||||
}
|
||||
|
||||
[Fact(Skip = "Cyclic parsing is not supported yet")]
|
||||
[Fact]
|
||||
public async Task ConnectionAbortedIfSendFailsWithProtocolError()
|
||||
{
|
||||
using (StartVerifiableLog())
|
||||
|
|
@ -3290,8 +3290,6 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
var connectionHandlerTask = await client.ConnectAsync(connectionHandler).OrTimeout();
|
||||
|
||||
await client.SendInvocationAsync(nameof(MethodHub.ProtocolError)).OrTimeout();
|
||||
|
||||
await client.Connected.OrTimeout();
|
||||
await connectionHandlerTask.OrTimeout();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
}
|
||||
}
|
||||
|
||||
[ConditionalFact(Skip = "Issue in ClientWebSocket prevents user-agent being set - https://github.com/dotnet/corefx/issues/26627")]
|
||||
[ConditionalFact]
|
||||
[WebSocketsSupportedCondition]
|
||||
public async Task WebSocketsTransportSendsUserAgent()
|
||||
{
|
||||
|
|
@ -86,7 +86,10 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
.Assembly
|
||||
.GetCustomAttribute<AssemblyInformationalVersionAttribute>();
|
||||
|
||||
Assert.Equal("Microsoft.AspNetCore.Http.Connections.Client/" + assemblyVersion.InformationalVersion, userAgent);
|
||||
var majorVersion = typeof(HttpConnection).Assembly.GetName().Version.Major;
|
||||
var minorVersion = typeof(HttpConnection).Assembly.GetName().Version.Minor;
|
||||
|
||||
Assert.StartsWith($"Microsoft SignalR/{majorVersion}.{minorVersion} ({assemblyVersion.InformationalVersion}; ", userAgent);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue