Remove params from message ctors (#1931)

This commit is contained in:
James Newton-King 2018-04-11 12:11:13 +12:00 committed by GitHub
parent 13f7981010
commit c83baf2b76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 107 additions and 113 deletions

View File

@ -166,67 +166,67 @@ namespace Microsoft.AspNetCore.SignalR.Microbenchmarks
[Benchmark] [Benchmark]
public Task Invocation() public Task Invocation()
{ {
return _dispatcher.DispatchMessageAsync(_connectionContext, new InvocationMessage("123", "Invocation", null)); return _dispatcher.DispatchMessageAsync(_connectionContext, new InvocationMessage("123", "Invocation", null, Array.Empty<object>()));
} }
[Benchmark] [Benchmark]
public Task InvocationAsync() public Task InvocationAsync()
{ {
return _dispatcher.DispatchMessageAsync(_connectionContext, new InvocationMessage("123", "InvocationAsync", null)); return _dispatcher.DispatchMessageAsync(_connectionContext, new InvocationMessage("123", "InvocationAsync", null, Array.Empty<object>()));
} }
[Benchmark] [Benchmark]
public Task InvocationReturnValue() public Task InvocationReturnValue()
{ {
return _dispatcher.DispatchMessageAsync(_connectionContext, new InvocationMessage("123", "InvocationReturnValue", null)); return _dispatcher.DispatchMessageAsync(_connectionContext, new InvocationMessage("123", "InvocationReturnValue", null, Array.Empty<object>()));
} }
[Benchmark] [Benchmark]
public Task InvocationReturnAsync() public Task InvocationReturnAsync()
{ {
return _dispatcher.DispatchMessageAsync(_connectionContext, new InvocationMessage("123", "InvocationReturnAsync", null)); return _dispatcher.DispatchMessageAsync(_connectionContext, new InvocationMessage("123", "InvocationReturnAsync", null, Array.Empty<object>()));
} }
[Benchmark] [Benchmark]
public Task InvocationValueTaskAsync() public Task InvocationValueTaskAsync()
{ {
return _dispatcher.DispatchMessageAsync(_connectionContext, new InvocationMessage("123", "InvocationValueTaskAsync", null)); return _dispatcher.DispatchMessageAsync(_connectionContext, new InvocationMessage("123", "InvocationValueTaskAsync", null, Array.Empty<object>()));
} }
[Benchmark] [Benchmark]
public Task StreamChannelReader() public Task StreamChannelReader()
{ {
return _dispatcher.DispatchMessageAsync(_connectionContext, new StreamInvocationMessage("123", "StreamChannelReader", null)); return _dispatcher.DispatchMessageAsync(_connectionContext, new StreamInvocationMessage("123", "StreamChannelReader", null, Array.Empty<object>()));
} }
[Benchmark] [Benchmark]
public Task StreamChannelReaderAsync() public Task StreamChannelReaderAsync()
{ {
return _dispatcher.DispatchMessageAsync(_connectionContext, new StreamInvocationMessage("123", "StreamChannelReaderAsync", null)); return _dispatcher.DispatchMessageAsync(_connectionContext, new StreamInvocationMessage("123", "StreamChannelReaderAsync", null, Array.Empty<object>()));
} }
[Benchmark] [Benchmark]
public Task StreamChannelReaderValueTaskAsync() public Task StreamChannelReaderValueTaskAsync()
{ {
return _dispatcher.DispatchMessageAsync(_connectionContext, new StreamInvocationMessage("123", "StreamChannelReaderValueTaskAsync", null)); return _dispatcher.DispatchMessageAsync(_connectionContext, new StreamInvocationMessage("123", "StreamChannelReaderValueTaskAsync", null, Array.Empty<object>()));
} }
[Benchmark] [Benchmark]
public Task StreamChannelReaderCount_Zero() public Task StreamChannelReaderCount_Zero()
{ {
return _dispatcher.DispatchMessageAsync(_connectionContext, new StreamInvocationMessage("123", "StreamChannelReaderCount", argumentBindingException: null, new object[] { 0 })); return _dispatcher.DispatchMessageAsync(_connectionContext, new StreamInvocationMessage("123", "StreamChannelReaderCount", null, new object[] { 0 }));
} }
[Benchmark] [Benchmark]
public Task StreamChannelReaderCount_One() public Task StreamChannelReaderCount_One()
{ {
return _dispatcher.DispatchMessageAsync(_connectionContext, new StreamInvocationMessage("123", "StreamChannelReaderCount", argumentBindingException: null, new object[] { 1 })); return _dispatcher.DispatchMessageAsync(_connectionContext, new StreamInvocationMessage("123", "StreamChannelReaderCount", null, new object[] { 1 }));
} }
[Benchmark] [Benchmark]
public Task StreamChannelReaderCount_Thousand() public Task StreamChannelReaderCount_Thousand()
{ {
return _dispatcher.DispatchMessageAsync(_connectionContext, new StreamInvocationMessage("123", "StreamChannelReaderCount", argumentBindingException: null, new object[] { 1000 })); return _dispatcher.DispatchMessageAsync(_connectionContext, new StreamInvocationMessage("123", "StreamChannelReaderCount", null, new object[] { 1000 }));
} }
} }
} }

View File

@ -37,16 +37,16 @@ namespace Microsoft.AspNetCore.SignalR.Microbenchmarks
switch (Input) switch (Input)
{ {
case Message.NoArguments: case Message.NoArguments:
_hubMessage = new InvocationMessage(target: "Target", argumentBindingException: null); _hubMessage = new InvocationMessage("Target", null, Array.Empty<object>());
break; break;
case Message.FewArguments: case Message.FewArguments:
_hubMessage = new InvocationMessage(target: "Target", argumentBindingException: null, 1, "Foo", 2.0f); _hubMessage = new InvocationMessage("Target", null, new object[] { 1, "Foo", 2.0f });
break; break;
case Message.ManyArguments: case Message.ManyArguments:
_hubMessage = new InvocationMessage(target: "Target", argumentBindingException: null, 1, "string", 2.0f, true, (byte)9, new byte[] { 5, 4, 3, 2, 1 }, 'c', 123456789101112L); _hubMessage = new InvocationMessage("Target", null, new object[] { 1, "string", 2.0f, true, (byte)9, new byte[] { 5, 4, 3, 2, 1 }, 'c', 123456789101112L });
break; break;
case Message.LargeArguments: case Message.LargeArguments:
_hubMessage = new InvocationMessage(target: "Target", argumentBindingException: null, new string('F', 10240), new byte[10240]); _hubMessage = new InvocationMessage("Target", null, new object[] { new string('F', 10240), new byte[10240] });
break; break;
} }

View File

@ -25,16 +25,16 @@ namespace Microsoft.AspNetCore.SignalR.Microbenchmarks
switch (Input) switch (Input)
{ {
case Message.NoArguments: case Message.NoArguments:
hubMessage = new InvocationMessage(target: "Target", argumentBindingException: null); hubMessage = new InvocationMessage("Target", null, Array.Empty<object>());
break; break;
case Message.FewArguments: case Message.FewArguments:
hubMessage = new InvocationMessage(target: "Target", argumentBindingException: null, 1, "Foo", 2.0f); hubMessage = new InvocationMessage("Target", null, new object[] { 1, "Foo", 2.0f });
break; break;
case Message.ManyArguments: case Message.ManyArguments:
hubMessage = new InvocationMessage(target: "Target", argumentBindingException: null, 1, "string", 2.0f, true, (byte)9, new[] { 5, 4, 3, 2, 1 }, 'c', 123456789101112L); hubMessage = new InvocationMessage("Target", null, new object[] { 1, "string", 2.0f, true, (byte)9, new[] { 5, 4, 3, 2, 1 }, 'c', 123456789101112L });
break; break;
case Message.LargeArguments: case Message.LargeArguments:
hubMessage = new InvocationMessage(target: "Target", argumentBindingException: null, new string('F', 10240), new string('B', 10240)); hubMessage = new InvocationMessage("Target", null, new object[] { new string('F', 10240), new string('B', 10240) });
break; break;
} }

View File

@ -294,8 +294,7 @@ namespace Microsoft.AspNetCore.SignalR.Client
Log.PreparingBlockingInvocation(_logger, irq.InvocationId, methodName, irq.ResultType.FullName, args.Length); Log.PreparingBlockingInvocation(_logger, irq.InvocationId, methodName, irq.ResultType.FullName, args.Length);
// Client invocations are always blocking // Client invocations are always blocking
var invocationMessage = new InvocationMessage(irq.InvocationId, target: methodName, var invocationMessage = new InvocationMessage(irq.InvocationId, methodName, null, args);
argumentBindingException: null, arguments: args);
Log.RegisteringInvocation(_logger, invocationMessage.InvocationId); Log.RegisteringInvocation(_logger, invocationMessage.InvocationId);
@ -322,8 +321,7 @@ namespace Microsoft.AspNetCore.SignalR.Client
Log.PreparingStreamingInvocation(_logger, irq.InvocationId, methodName, irq.ResultType.FullName, args.Length); Log.PreparingStreamingInvocation(_logger, irq.InvocationId, methodName, irq.ResultType.FullName, args.Length);
var invocationMessage = new StreamInvocationMessage(irq.InvocationId, methodName, var invocationMessage = new StreamInvocationMessage(irq.InvocationId, methodName, null, args);
argumentBindingException: null, arguments: args);
// I just want an excuse to use 'irq' as a variable name... // I just want an excuse to use 'irq' as a variable name...
Log.RegisteringInvocation(_logger, invocationMessage.InvocationId); Log.RegisteringInvocation(_logger, invocationMessage.InvocationId);
@ -371,8 +369,7 @@ namespace Microsoft.AspNetCore.SignalR.Client
Log.PreparingNonBlockingInvocation(_logger, methodName, args.Length); Log.PreparingNonBlockingInvocation(_logger, methodName, args.Length);
var invocationMessage = new InvocationMessage(null, target: methodName, var invocationMessage = new InvocationMessage(null, methodName, null, args);
argumentBindingException: null, arguments: args);
await SendHubMessage(invocationMessage, cancellationToken); await SendHubMessage(invocationMessage, cancellationToken);
} }

View File

@ -50,12 +50,12 @@ namespace Microsoft.AspNetCore.SignalR.Internal.Protocol
public class InvocationMessage : HubMethodInvocationMessage public class InvocationMessage : HubMethodInvocationMessage
{ {
public InvocationMessage(string target, ExceptionDispatchInfo argumentBindingException, params object[] arguments) public InvocationMessage(string target, ExceptionDispatchInfo argumentBindingException, object[] arguments)
: this(invocationId: null, target, argumentBindingException, arguments) : this(null, target, argumentBindingException, arguments)
{ {
} }
public InvocationMessage(string invocationId, string target, ExceptionDispatchInfo argumentBindingException, params object[] arguments) public InvocationMessage(string invocationId, string target, ExceptionDispatchInfo argumentBindingException, object[] arguments)
: base(invocationId, target, argumentBindingException, arguments) : base(invocationId, target, argumentBindingException, arguments)
{ {
} }
@ -77,7 +77,7 @@ namespace Microsoft.AspNetCore.SignalR.Internal.Protocol
public class StreamInvocationMessage : HubMethodInvocationMessage public class StreamInvocationMessage : HubMethodInvocationMessage
{ {
public StreamInvocationMessage(string invocationId, string target, ExceptionDispatchInfo argumentBindingException, params object[] arguments) public StreamInvocationMessage(string invocationId, string target, ExceptionDispatchInfo argumentBindingException, object[] arguments)
: base(invocationId, target, argumentBindingException, arguments) : base(invocationId, target, argumentBindingException, arguments)
{ {
if (string.IsNullOrEmpty(invocationId)) if (string.IsNullOrEmpty(invocationId))

View File

@ -250,7 +250,7 @@ namespace Microsoft.AspNetCore.SignalR
private HubMessage CreateInvocationMessage(string methodName, object[] args) private HubMessage CreateInvocationMessage(string methodName, object[] args)
{ {
return new InvocationMessage(target: methodName, argumentBindingException: null, arguments: args); return new InvocationMessage(methodName, null, args);
} }
public override Task SendUserAsync(string userId, string methodName, object[] args) public override Task SendUserAsync(string userId, string methodName, object[] args)

View File

@ -557,7 +557,7 @@ namespace Microsoft.AspNetCore.SignalR.Internal.Protocol
throw new InvalidDataException($"Missing required property '{TargetPropertyName}'."); throw new InvalidDataException($"Missing required property '{TargetPropertyName}'.");
} }
return new StreamInvocationMessage(invocationId, target, argumentBindingException: argumentBindingException, arguments: arguments); return new StreamInvocationMessage(invocationId, target, argumentBindingException, arguments);
} }
private HubMessage BindInvocationMessage(string invocationId, string target, ExceptionDispatchInfo argumentBindingException, object[] arguments, bool hasArguments, IInvocationBinder binder) private HubMessage BindInvocationMessage(string invocationId, string target, ExceptionDispatchInfo argumentBindingException, object[] arguments, bool hasArguments, IInvocationBinder binder)
@ -572,7 +572,7 @@ namespace Microsoft.AspNetCore.SignalR.Internal.Protocol
throw new InvalidDataException($"Missing required property '{ArgumentsPropertyName}'."); throw new InvalidDataException($"Missing required property '{ArgumentsPropertyName}'.");
} }
return new InvocationMessage(invocationId, target, argumentBindingException: argumentBindingException, arguments: arguments); return new InvocationMessage(invocationId, target, argumentBindingException, arguments);
} }
private object[] BindArguments(JsonTextReader reader, IReadOnlyList<Type> paramTypes) private object[] BindArguments(JsonTextReader reader, IReadOnlyList<Type> paramTypes)

View File

@ -148,11 +148,11 @@ namespace Microsoft.AspNetCore.SignalR.Internal.Protocol
try try
{ {
var arguments = BindArguments(input, ref offset, parameterTypes, resolver); var arguments = BindArguments(input, ref offset, parameterTypes, resolver);
return ApplyHeaders(headers, new InvocationMessage(invocationId, target, argumentBindingException: null, arguments: arguments)); return ApplyHeaders(headers, new InvocationMessage(invocationId, target, null, arguments));
} }
catch (Exception ex) catch (Exception ex)
{ {
return ApplyHeaders(headers, new InvocationMessage(invocationId, target, ExceptionDispatchInfo.Capture(ex))); return ApplyHeaders(headers, new InvocationMessage(invocationId, target, ExceptionDispatchInfo.Capture(ex), null));
} }
} }
@ -166,11 +166,11 @@ namespace Microsoft.AspNetCore.SignalR.Internal.Protocol
try try
{ {
var arguments = BindArguments(input, ref offset, parameterTypes, resolver); var arguments = BindArguments(input, ref offset, parameterTypes, resolver);
return ApplyHeaders(headers, new StreamInvocationMessage(invocationId, target, argumentBindingException: null, arguments: arguments)); return ApplyHeaders(headers, new StreamInvocationMessage(invocationId, target, null, arguments));
} }
catch (Exception ex) catch (Exception ex)
{ {
return ApplyHeaders(headers, new StreamInvocationMessage(invocationId, target, ExceptionDispatchInfo.Capture(ex))); return ApplyHeaders(headers, new StreamInvocationMessage(invocationId, target, ExceptionDispatchInfo.Capture(ex), null));
} }
} }

View File

@ -26,7 +26,7 @@ namespace Microsoft.AspNetCore.SignalR.Redis.Internal
public static RedisInvocation Create(string target, object[] arguments, IReadOnlyList<string> excludedIds = null) public static RedisInvocation Create(string target, object[] arguments, IReadOnlyList<string> excludedIds = null)
{ {
return new RedisInvocation( return new RedisInvocation(
new SerializedHubMessage(new InvocationMessage(target, argumentBindingException: null, arguments)), new SerializedHubMessage(new InvocationMessage(target, null, arguments)),
excludedIds); excludedIds);
} }
} }

View File

@ -57,7 +57,7 @@ namespace Microsoft.AspNetCore.SignalR.Redis.Internal
writer.WriteVarInt(0); writer.WriteVarInt(0);
} }
SerializedHubMessage.WriteAllSerializedVersions(writer, new InvocationMessage(methodName, argumentBindingException: null, args), _protocols); SerializedHubMessage.WriteAllSerializedVersions(writer, new InvocationMessage(methodName, null, args), _protocols);
return stream.ToArray(); return stream.ToArray();
} }
} }

View File

@ -130,7 +130,7 @@ namespace Microsoft.AspNetCore.SignalR.Redis
var connection = _connections[connectionId]; var connection = _connections[connectionId];
if (connection != null) if (connection != null)
{ {
return connection.WriteAsync(new InvocationMessage(methodName, argumentBindingException: null, args)).AsTask(); return connection.WriteAsync(new InvocationMessage(methodName, null, args)).AsTask();
} }
var message = _protocol.WriteInvocation(methodName, args); var message = _protocol.WriteInvocation(methodName, args);

View File

@ -33,17 +33,17 @@ namespace Microsoft.AspNetCore.SignalR.Common.Tests.Internal.Protocol
public static IDictionary<string, JsonProtocolTestData> ProtocolTestData => new[] public static IDictionary<string, JsonProtocolTestData> ProtocolTestData => new[]
{ {
new JsonProtocolTestData("InvocationMessage_HasInvocationId", new InvocationMessage("123", "Target", null, 1, "Foo", 2.0f), true, NullValueHandling.Ignore, "{\"type\":1,\"invocationId\":\"123\",\"target\":\"Target\",\"arguments\":[1,\"Foo\",2.0]}"), new JsonProtocolTestData("InvocationMessage_HasInvocationId", new InvocationMessage("123", "Target", null, new object[] { 1, "Foo", 2.0f }), true, NullValueHandling.Ignore, "{\"type\":1,\"invocationId\":\"123\",\"target\":\"Target\",\"arguments\":[1,\"Foo\",2.0]}"),
new JsonProtocolTestData("InvocationMessage_HasFloatArgument", new InvocationMessage(null, "Target", null, 1, "Foo", 2.0f), true, NullValueHandling.Ignore, "{\"type\":1,\"target\":\"Target\",\"arguments\":[1,\"Foo\",2.0]}"), new JsonProtocolTestData("InvocationMessage_HasFloatArgument", new InvocationMessage(null, "Target", null, new object[] { 1, "Foo", 2.0f }), true, NullValueHandling.Ignore, "{\"type\":1,\"target\":\"Target\",\"arguments\":[1,\"Foo\",2.0]}"),
new JsonProtocolTestData("InvocationMessage_HasBoolArgument", new InvocationMessage(null, "Target", null, true), true, NullValueHandling.Ignore, "{\"type\":1,\"target\":\"Target\",\"arguments\":[true]}"), new JsonProtocolTestData("InvocationMessage_HasBoolArgument", new InvocationMessage(null, "Target", null, new object[] { true }), true, NullValueHandling.Ignore, "{\"type\":1,\"target\":\"Target\",\"arguments\":[true]}"),
new JsonProtocolTestData("InvocationMessage_HasNullArgument", new InvocationMessage(null, "Target", null, new object[] { null }), true, NullValueHandling.Ignore, "{\"type\":1,\"target\":\"Target\",\"arguments\":[null]}"), new JsonProtocolTestData("InvocationMessage_HasNullArgument", new InvocationMessage(null, "Target", null, new object[] { null }), true, NullValueHandling.Ignore, "{\"type\":1,\"target\":\"Target\",\"arguments\":[null]}"),
new JsonProtocolTestData("InvocationMessage_HasCustomArgumentWithNoCamelCase", new InvocationMessage(null, "Target", null, new CustomObject()), false, NullValueHandling.Ignore, "{\"type\":1,\"target\":\"Target\",\"arguments\":[{\"StringProp\":\"SignalR!\",\"DoubleProp\":6.2831853071,\"IntProp\":42,\"DateTimeProp\":\"2017-04-11T00:00:00Z\",\"ByteArrProp\":\"AQID\"}]}"), new JsonProtocolTestData("InvocationMessage_HasCustomArgumentWithNoCamelCase", new InvocationMessage(null, "Target", null, new object[] { new CustomObject() }), false, NullValueHandling.Ignore, "{\"type\":1,\"target\":\"Target\",\"arguments\":[{\"StringProp\":\"SignalR!\",\"DoubleProp\":6.2831853071,\"IntProp\":42,\"DateTimeProp\":\"2017-04-11T00:00:00Z\",\"ByteArrProp\":\"AQID\"}]}"),
new JsonProtocolTestData("InvocationMessage_HasCustomArgumentWithNullValueIgnore", new InvocationMessage(null, "Target", null, new CustomObject()), true, NullValueHandling.Ignore, "{\"type\":1,\"target\":\"Target\",\"arguments\":[{\"stringProp\":\"SignalR!\",\"doubleProp\":6.2831853071,\"intProp\":42,\"dateTimeProp\":\"2017-04-11T00:00:00Z\",\"byteArrProp\":\"AQID\"}]}"), new JsonProtocolTestData("InvocationMessage_HasCustomArgumentWithNullValueIgnore", new InvocationMessage(null, "Target", null, new object[] { new CustomObject() }), true, NullValueHandling.Ignore, "{\"type\":1,\"target\":\"Target\",\"arguments\":[{\"stringProp\":\"SignalR!\",\"doubleProp\":6.2831853071,\"intProp\":42,\"dateTimeProp\":\"2017-04-11T00:00:00Z\",\"byteArrProp\":\"AQID\"}]}"),
new JsonProtocolTestData("InvocationMessage_HasCustomArgumentWithNullValueIgnoreAndNoCamelCase", new InvocationMessage(null, "Target", null, new CustomObject()), false, NullValueHandling.Include, "{\"type\":1,\"target\":\"Target\",\"arguments\":[{\"StringProp\":\"SignalR!\",\"DoubleProp\":6.2831853071,\"IntProp\":42,\"DateTimeProp\":\"2017-04-11T00:00:00Z\",\"NullProp\":null,\"ByteArrProp\":\"AQID\"}]}"), new JsonProtocolTestData("InvocationMessage_HasCustomArgumentWithNullValueIgnoreAndNoCamelCase", new InvocationMessage(null, "Target", null, new object[] { new CustomObject() }), false, NullValueHandling.Include, "{\"type\":1,\"target\":\"Target\",\"arguments\":[{\"StringProp\":\"SignalR!\",\"DoubleProp\":6.2831853071,\"IntProp\":42,\"DateTimeProp\":\"2017-04-11T00:00:00Z\",\"NullProp\":null,\"ByteArrProp\":\"AQID\"}]}"),
new JsonProtocolTestData("InvocationMessage_HasCustomArgumentWithNullValueInclude", new InvocationMessage(null, "Target", null, new CustomObject()), true, NullValueHandling.Include, "{\"type\":1,\"target\":\"Target\",\"arguments\":[{\"stringProp\":\"SignalR!\",\"doubleProp\":6.2831853071,\"intProp\":42,\"dateTimeProp\":\"2017-04-11T00:00:00Z\",\"nullProp\":null,\"byteArrProp\":\"AQID\"}]}"), new JsonProtocolTestData("InvocationMessage_HasCustomArgumentWithNullValueInclude", new InvocationMessage(null, "Target", null, new object[] { new CustomObject() }), true, NullValueHandling.Include, "{\"type\":1,\"target\":\"Target\",\"arguments\":[{\"stringProp\":\"SignalR!\",\"doubleProp\":6.2831853071,\"intProp\":42,\"dateTimeProp\":\"2017-04-11T00:00:00Z\",\"nullProp\":null,\"byteArrProp\":\"AQID\"}]}"),
new JsonProtocolTestData("InvocationMessage_HasHeaders", AddHeaders(TestHeaders, new InvocationMessage("123", "Target", null, 1, "Foo", 2.0f)), true, NullValueHandling.Ignore, "{\"type\":1," + SerializedHeaders + ",\"invocationId\":\"123\",\"target\":\"Target\",\"arguments\":[1,\"Foo\",2.0]}"), new JsonProtocolTestData("InvocationMessage_HasHeaders", AddHeaders(TestHeaders, new InvocationMessage("123", "Target", null, new object[] { 1, "Foo", 2.0f })), true, NullValueHandling.Ignore, "{\"type\":1," + SerializedHeaders + ",\"invocationId\":\"123\",\"target\":\"Target\",\"arguments\":[1,\"Foo\",2.0]}"),
new JsonProtocolTestData("InvocationMessage_StringIsoDateArgument", new InvocationMessage("Method", null, "2016-05-10T13:51:20+12:34"), true, NullValueHandling.Ignore, "{\"type\":1,\"target\":\"Method\",\"arguments\":[\"2016-05-10T13:51:20+12:34\"]}"), new JsonProtocolTestData("InvocationMessage_StringIsoDateArgument", new InvocationMessage("Method", null, new object[] { "2016-05-10T13:51:20+12:34" }), true, NullValueHandling.Ignore, "{\"type\":1,\"target\":\"Method\",\"arguments\":[\"2016-05-10T13:51:20+12:34\"]}"),
new JsonProtocolTestData("InvocationMessage_DateTimeOffsetArgument", new InvocationMessage("Method", null, DateTimeOffset.Parse("2016-05-10T13:51:20+12:34")), true, NullValueHandling.Ignore, "{\"type\":1,\"target\":\"Method\",\"arguments\":[\"2016-05-10T13:51:20+12:34\"]}"), new JsonProtocolTestData("InvocationMessage_DateTimeOffsetArgument", new InvocationMessage("Method", null, new object[] { DateTimeOffset.Parse("2016-05-10T13:51:20+12:34") }), true, NullValueHandling.Ignore, "{\"type\":1,\"target\":\"Method\",\"arguments\":[\"2016-05-10T13:51:20+12:34\"]}"),
new JsonProtocolTestData("StreamItemMessage_HasIntegerItem", new StreamItemMessage("123", 1), true, NullValueHandling.Ignore, "{\"type\":2,\"invocationId\":\"123\",\"item\":1}"), new JsonProtocolTestData("StreamItemMessage_HasIntegerItem", new StreamItemMessage("123", 1), true, NullValueHandling.Ignore, "{\"type\":2,\"invocationId\":\"123\",\"item\":1}"),
new JsonProtocolTestData("StreamItemMessage_HasStringItem", new StreamItemMessage("123", "Foo"), true, NullValueHandling.Ignore, "{\"type\":2,\"invocationId\":\"123\",\"item\":\"Foo\"}"), new JsonProtocolTestData("StreamItemMessage_HasStringItem", new StreamItemMessage("123", "Foo"), true, NullValueHandling.Ignore, "{\"type\":2,\"invocationId\":\"123\",\"item\":\"Foo\"}"),
@ -71,15 +71,15 @@ namespace Microsoft.AspNetCore.SignalR.Common.Tests.Internal.Protocol
new JsonProtocolTestData("CompletionMessage_HasErrorAndCamelCase", CompletionMessage.Empty("123"), true, NullValueHandling.Ignore, "{\"type\":3,\"invocationId\":\"123\"}"), new JsonProtocolTestData("CompletionMessage_HasErrorAndCamelCase", CompletionMessage.Empty("123"), true, NullValueHandling.Ignore, "{\"type\":3,\"invocationId\":\"123\"}"),
new JsonProtocolTestData("CompletionMessage_HasErrorAndHeadersAndCamelCase", AddHeaders(TestHeaders, CompletionMessage.Empty("123")), true, NullValueHandling.Ignore, "{\"type\":3," + SerializedHeaders + ",\"invocationId\":\"123\"}"), new JsonProtocolTestData("CompletionMessage_HasErrorAndHeadersAndCamelCase", AddHeaders(TestHeaders, CompletionMessage.Empty("123")), true, NullValueHandling.Ignore, "{\"type\":3," + SerializedHeaders + ",\"invocationId\":\"123\"}"),
new JsonProtocolTestData("StreamInvocationMessage_HasInvocationId", new StreamInvocationMessage("123", "Target", null, 1, "Foo", 2.0f), true, NullValueHandling.Ignore, "{\"type\":4,\"invocationId\":\"123\",\"target\":\"Target\",\"arguments\":[1,\"Foo\",2.0]}"), new JsonProtocolTestData("StreamInvocationMessage_HasInvocationId", new StreamInvocationMessage("123", "Target", null, new object[] { 1, "Foo", 2.0f }), true, NullValueHandling.Ignore, "{\"type\":4,\"invocationId\":\"123\",\"target\":\"Target\",\"arguments\":[1,\"Foo\",2.0]}"),
new JsonProtocolTestData("StreamInvocationMessage_HasFloatArgument", new StreamInvocationMessage("123", "Target", null, 1, "Foo", 2.0f), true, NullValueHandling.Ignore, "{\"type\":4,\"invocationId\":\"123\",\"target\":\"Target\",\"arguments\":[1,\"Foo\",2.0]}"), new JsonProtocolTestData("StreamInvocationMessage_HasFloatArgument", new StreamInvocationMessage("123", "Target", null, new object[] { 1, "Foo", 2.0f }), true, NullValueHandling.Ignore, "{\"type\":4,\"invocationId\":\"123\",\"target\":\"Target\",\"arguments\":[1,\"Foo\",2.0]}"),
new JsonProtocolTestData("StreamInvocationMessage_HasBoolArgument", new StreamInvocationMessage("123", "Target", null, true), true, NullValueHandling.Ignore, "{\"type\":4,\"invocationId\":\"123\",\"target\":\"Target\",\"arguments\":[true]}"), new JsonProtocolTestData("StreamInvocationMessage_HasBoolArgument", new StreamInvocationMessage("123", "Target", null, new object[] { true }), true, NullValueHandling.Ignore, "{\"type\":4,\"invocationId\":\"123\",\"target\":\"Target\",\"arguments\":[true]}"),
new JsonProtocolTestData("StreamInvocationMessage_HasNullArgument", new StreamInvocationMessage("123", "Target", null, new object[] { null }), true, NullValueHandling.Ignore, "{\"type\":4,\"invocationId\":\"123\",\"target\":\"Target\",\"arguments\":[null]}"), new JsonProtocolTestData("StreamInvocationMessage_HasNullArgument", new StreamInvocationMessage("123", "Target", null, new object[] { null }), true, NullValueHandling.Ignore, "{\"type\":4,\"invocationId\":\"123\",\"target\":\"Target\",\"arguments\":[null]}"),
new JsonProtocolTestData("StreamInvocationMessage_HasCustomArgumentWithNoCamelCase", new StreamInvocationMessage("123", "Target", null, new CustomObject()), false, NullValueHandling.Ignore, "{\"type\":4,\"invocationId\":\"123\",\"target\":\"Target\",\"arguments\":[{\"StringProp\":\"SignalR!\",\"DoubleProp\":6.2831853071,\"IntProp\":42,\"DateTimeProp\":\"2017-04-11T00:00:00Z\",\"ByteArrProp\":\"AQID\"}]}"), new JsonProtocolTestData("StreamInvocationMessage_HasCustomArgumentWithNoCamelCase", new StreamInvocationMessage("123", "Target", null, new object[] { new CustomObject() }), false, NullValueHandling.Ignore, "{\"type\":4,\"invocationId\":\"123\",\"target\":\"Target\",\"arguments\":[{\"StringProp\":\"SignalR!\",\"DoubleProp\":6.2831853071,\"IntProp\":42,\"DateTimeProp\":\"2017-04-11T00:00:00Z\",\"ByteArrProp\":\"AQID\"}]}"),
new JsonProtocolTestData("StreamInvocationMessage_HasCustomArgumentWithNullValueIgnore", new StreamInvocationMessage("123", "Target", null, new CustomObject()), true, NullValueHandling.Ignore, "{\"type\":4,\"invocationId\":\"123\",\"target\":\"Target\",\"arguments\":[{\"stringProp\":\"SignalR!\",\"doubleProp\":6.2831853071,\"intProp\":42,\"dateTimeProp\":\"2017-04-11T00:00:00Z\",\"byteArrProp\":\"AQID\"}]}"), new JsonProtocolTestData("StreamInvocationMessage_HasCustomArgumentWithNullValueIgnore", new StreamInvocationMessage("123", "Target", null, new object[] { new CustomObject() }), true, NullValueHandling.Ignore, "{\"type\":4,\"invocationId\":\"123\",\"target\":\"Target\",\"arguments\":[{\"stringProp\":\"SignalR!\",\"doubleProp\":6.2831853071,\"intProp\":42,\"dateTimeProp\":\"2017-04-11T00:00:00Z\",\"byteArrProp\":\"AQID\"}]}"),
new JsonProtocolTestData("StreamInvocationMessage_HasCustomArgumentWithNullValueIgnoreAndNoCamelCase", new StreamInvocationMessage("123", "Target", null, new CustomObject()), false, NullValueHandling.Include, "{\"type\":4,\"invocationId\":\"123\",\"target\":\"Target\",\"arguments\":[{\"StringProp\":\"SignalR!\",\"DoubleProp\":6.2831853071,\"IntProp\":42,\"DateTimeProp\":\"2017-04-11T00:00:00Z\",\"NullProp\":null,\"ByteArrProp\":\"AQID\"}]}"), new JsonProtocolTestData("StreamInvocationMessage_HasCustomArgumentWithNullValueIgnoreAndNoCamelCase", new StreamInvocationMessage("123", "Target", null, new object[] { new CustomObject() }), false, NullValueHandling.Include, "{\"type\":4,\"invocationId\":\"123\",\"target\":\"Target\",\"arguments\":[{\"StringProp\":\"SignalR!\",\"DoubleProp\":6.2831853071,\"IntProp\":42,\"DateTimeProp\":\"2017-04-11T00:00:00Z\",\"NullProp\":null,\"ByteArrProp\":\"AQID\"}]}"),
new JsonProtocolTestData("StreamInvocationMessage_HasCustomArgumentWithNullValueInclude", new StreamInvocationMessage("123", "Target", null, new CustomObject()), true, NullValueHandling.Include, "{\"type\":4,\"invocationId\":\"123\",\"target\":\"Target\",\"arguments\":[{\"stringProp\":\"SignalR!\",\"doubleProp\":6.2831853071,\"intProp\":42,\"dateTimeProp\":\"2017-04-11T00:00:00Z\",\"nullProp\":null,\"byteArrProp\":\"AQID\"}]}"), new JsonProtocolTestData("StreamInvocationMessage_HasCustomArgumentWithNullValueInclude", new StreamInvocationMessage("123", "Target", null, new object[] { new CustomObject() }), true, NullValueHandling.Include, "{\"type\":4,\"invocationId\":\"123\",\"target\":\"Target\",\"arguments\":[{\"stringProp\":\"SignalR!\",\"doubleProp\":6.2831853071,\"intProp\":42,\"dateTimeProp\":\"2017-04-11T00:00:00Z\",\"nullProp\":null,\"byteArrProp\":\"AQID\"}]}"),
new JsonProtocolTestData("StreamInvocationMessage_HasHeaders", AddHeaders(TestHeaders, new StreamInvocationMessage("123", "Target", null, new CustomObject())), true, NullValueHandling.Include, "{\"type\":4," + SerializedHeaders + ",\"invocationId\":\"123\",\"target\":\"Target\",\"arguments\":[{\"stringProp\":\"SignalR!\",\"doubleProp\":6.2831853071,\"intProp\":42,\"dateTimeProp\":\"2017-04-11T00:00:00Z\",\"nullProp\":null,\"byteArrProp\":\"AQID\"}]}"), new JsonProtocolTestData("StreamInvocationMessage_HasHeaders", AddHeaders(TestHeaders, new StreamInvocationMessage("123", "Target", null, new object[] { new CustomObject() })), true, NullValueHandling.Include, "{\"type\":4," + SerializedHeaders + ",\"invocationId\":\"123\",\"target\":\"Target\",\"arguments\":[{\"stringProp\":\"SignalR!\",\"doubleProp\":6.2831853071,\"intProp\":42,\"dateTimeProp\":\"2017-04-11T00:00:00Z\",\"nullProp\":null,\"byteArrProp\":\"AQID\"}]}"),
new JsonProtocolTestData("CancelInvocationMessage_HasInvocationId", new CancelInvocationMessage("123"), true, NullValueHandling.Ignore, "{\"type\":5,\"invocationId\":\"123\"}"), new JsonProtocolTestData("CancelInvocationMessage_HasInvocationId", new CancelInvocationMessage("123"), true, NullValueHandling.Ignore, "{\"type\":5,\"invocationId\":\"123\"}"),
new JsonProtocolTestData("CancelInvocationMessage_HasHeaders", AddHeaders(TestHeaders, new CancelInvocationMessage("123")), true, NullValueHandling.Ignore, "{\"type\":5," + SerializedHeaders + ",\"invocationId\":\"123\"}"), new JsonProtocolTestData("CancelInvocationMessage_HasHeaders", AddHeaders(TestHeaders, new CancelInvocationMessage("123")), true, NullValueHandling.Ignore, "{\"type\":5," + SerializedHeaders + ",\"invocationId\":\"123\"}"),
@ -96,10 +96,10 @@ namespace Microsoft.AspNetCore.SignalR.Common.Tests.Internal.Protocol
public static IDictionary<string, JsonProtocolTestData> OutOfOrderJsonTestData => new[] public static IDictionary<string, JsonProtocolTestData> OutOfOrderJsonTestData => new[]
{ {
new JsonProtocolTestData("InvocationMessage_StringIsoDateArgumentFirst", new InvocationMessage("Method", argumentBindingException: null, "2016-05-10T13:51:20+12:34"), false, NullValueHandling.Ignore, "{ \"arguments\": [\"2016-05-10T13:51:20+12:34\"], \"type\":1, \"target\": \"Method\" }"), new JsonProtocolTestData("InvocationMessage_StringIsoDateArgumentFirst", new InvocationMessage("Method", null, new object[] { "2016-05-10T13:51:20+12:34" }), false, NullValueHandling.Ignore, "{ \"arguments\": [\"2016-05-10T13:51:20+12:34\"], \"type\":1, \"target\": \"Method\" }"),
new JsonProtocolTestData("InvocationMessage_DateTimeOffsetArgumentFirst", new InvocationMessage("Method", argumentBindingException: null, DateTimeOffset.Parse("2016-05-10T13:51:20+12:34")), false, NullValueHandling.Ignore, "{ \"arguments\": [\"2016-05-10T13:51:20+12:34\"], \"type\":1, \"target\": \"Method\" }"), new JsonProtocolTestData("InvocationMessage_DateTimeOffsetArgumentFirst", new InvocationMessage("Method", null, new object[] { DateTimeOffset.Parse("2016-05-10T13:51:20+12:34") }), false, NullValueHandling.Ignore, "{ \"arguments\": [\"2016-05-10T13:51:20+12:34\"], \"type\":1, \"target\": \"Method\" }"),
new JsonProtocolTestData("InvocationMessage_IntegerArrayArgumentFirst", new InvocationMessage("Method", argumentBindingException: null, 1, 2), false, NullValueHandling.Ignore, "{ \"arguments\": [1,2], \"type\":1, \"target\": \"Method\" }"), new JsonProtocolTestData("InvocationMessage_IntegerArrayArgumentFirst", new InvocationMessage("Method", null, new object[] { 1, 2 }), false, NullValueHandling.Ignore, "{ \"arguments\": [1,2], \"type\":1, \"target\": \"Method\" }"),
new JsonProtocolTestData("StreamInvocationMessage_IntegerArrayArgumentFirst", new StreamInvocationMessage("3", "Method", argumentBindingException: null, 1, 2), false, NullValueHandling.Ignore, "{ \"type\":4, \"arguments\": [1,2], \"target\": \"Method\", \"invocationId\": \"3\" }"), new JsonProtocolTestData("StreamInvocationMessage_IntegerArrayArgumentFirst", new StreamInvocationMessage("3", "Method", null, new object[] { 1, 2 }), false, NullValueHandling.Ignore, "{ \"type\":4, \"arguments\": [1,2], \"target\": \"Method\", \"invocationId\": \"3\" }"),
new JsonProtocolTestData("CompletionMessage_ResultFirst", new CompletionMessage("15", null, 10, hasResult: true), false, NullValueHandling.Ignore, "{ \"type\":3, \"result\": 10, \"invocationId\": \"15\" }"), new JsonProtocolTestData("CompletionMessage_ResultFirst", new CompletionMessage("15", null, 10, hasResult: true), false, NullValueHandling.Ignore, "{ \"type\":3, \"result\": 10, \"invocationId\": \"15\" }"),
new JsonProtocolTestData("StreamItemMessage_ItemFirst", new StreamItemMessage("1a", "foo"), false, NullValueHandling.Ignore, "{ \"item\": \"foo\", \"invocationId\": \"1a\", \"type\":2 }") new JsonProtocolTestData("StreamItemMessage_ItemFirst", new StreamItemMessage("1a", "foo"), false, NullValueHandling.Ignore, "{ \"item\": \"foo\", \"invocationId\": \"1a\", \"type\":2 }")
}.ToDictionary(t => t.Name); }.ToDictionary(t => t.Name);

View File

@ -58,175 +58,175 @@ namespace Microsoft.AspNetCore.SignalR.Common.Tests.Internal.Protocol
// Invocation messages // Invocation messages
new ProtocolTestData( new ProtocolTestData(
name: "InvocationWithNoHeadersAndNoArgs", name: "InvocationWithNoHeadersAndNoArgs",
message: new InvocationMessage(invocationId: "xyz", target: "method", argumentBindingException: null), message: new InvocationMessage("xyz", "method", null, Array.Empty<object>()),
binary: "lQGAo3h5eqZtZXRob2SQ"), binary: "lQGAo3h5eqZtZXRob2SQ"),
new ProtocolTestData( new ProtocolTestData(
name: "InvocationWithNoHeadersNoIdAndNoArgs", name: "InvocationWithNoHeadersNoIdAndNoArgs",
message: new InvocationMessage(target: "method", argumentBindingException: null), message: new InvocationMessage("method", null, Array.Empty<object>()),
binary: "lQGAwKZtZXRob2SQ"), binary: "lQGAwKZtZXRob2SQ"),
new ProtocolTestData( new ProtocolTestData(
name: "InvocationWithNoHeadersNoIdAndSingleNullArg", name: "InvocationWithNoHeadersNoIdAndSingleNullArg",
message: new InvocationMessage(target: "method", argumentBindingException: null, new object[] { null }), message: new InvocationMessage("method", null, new object[] { null }),
binary: "lQGAwKZtZXRob2SRwA=="), binary: "lQGAwKZtZXRob2SRwA=="),
new ProtocolTestData( new ProtocolTestData(
name: "InvocationWithNoHeadersNoIdAndSingleIntArg", name: "InvocationWithNoHeadersNoIdAndSingleIntArg",
message: new InvocationMessage(target: "method", argumentBindingException: null, 42), message: new InvocationMessage("method", null, new object[] { 42 }),
binary: "lQGAwKZtZXRob2SRKg=="), binary: "lQGAwKZtZXRob2SRKg=="),
new ProtocolTestData( new ProtocolTestData(
name: "InvocationWithNoHeadersNoIdIntAndStringArgs", name: "InvocationWithNoHeadersNoIdIntAndStringArgs",
message: new InvocationMessage(target: "method", argumentBindingException: null, 42, "string"), message: new InvocationMessage("method", null, new object[] { 42, "string" }),
binary: "lQGAwKZtZXRob2SSKqZzdHJpbmc="), binary: "lQGAwKZtZXRob2SSKqZzdHJpbmc="),
new ProtocolTestData( new ProtocolTestData(
name: "InvocationWithNoHeadersNoIdIntAndEnumArgs", name: "InvocationWithNoHeadersNoIdIntAndEnumArgs",
message: new InvocationMessage(target: "method", argumentBindingException: null, 42, TestEnum.One), message: new InvocationMessage("method", null, new object[] { 42, TestEnum.One }),
binary: "lQGAwKZtZXRob2SSKqNPbmU="), binary: "lQGAwKZtZXRob2SSKqNPbmU="),
new ProtocolTestData( new ProtocolTestData(
name: "InvocationWithNoHeadersNoIdAndCustomObjectArg", name: "InvocationWithNoHeadersNoIdAndCustomObjectArg",
message: new InvocationMessage(target: "method", argumentBindingException: null, 42, "string", new CustomObject()), message: new InvocationMessage("method", null, new object[] { 42, "string", new CustomObject() }),
binary: "lQGAwKZtZXRob2STKqZzdHJpbmeGqlN0cmluZ1Byb3CoU2lnbmFsUiGqRG91YmxlUHJvcMtAGSH7VELPEqdJbnRQcm9wKqxEYXRlVGltZVByb3DW/1jsHICoTnVsbFByb3DAq0J5dGVBcnJQcm9wxAMBAgM="), binary: "lQGAwKZtZXRob2STKqZzdHJpbmeGqlN0cmluZ1Byb3CoU2lnbmFsUiGqRG91YmxlUHJvcMtAGSH7VELPEqdJbnRQcm9wKqxEYXRlVGltZVByb3DW/1jsHICoTnVsbFByb3DAq0J5dGVBcnJQcm9wxAMBAgM="),
new ProtocolTestData( new ProtocolTestData(
name: "InvocationWithNoHeadersNoIdAndArrayOfCustomObjectArgs", name: "InvocationWithNoHeadersNoIdAndArrayOfCustomObjectArgs",
message: new InvocationMessage(target: "method", argumentBindingException: null, new[] { new CustomObject(), new CustomObject() }), message: new InvocationMessage("method", null, new object[] { new CustomObject(), new CustomObject() }),
binary: "lQGAwKZtZXRob2SShqpTdHJpbmdQcm9wqFNpZ25hbFIhqkRvdWJsZVByb3DLQBkh+1RCzxKnSW50UHJvcCqsRGF0ZVRpbWVQcm9w1v9Y7ByAqE51bGxQcm9wwKtCeXRlQXJyUHJvcMQDAQIDhqpTdHJpbmdQcm9wqFNpZ25hbFIhqkRvdWJsZVByb3DLQBkh+1RCzxKnSW50UHJvcCqsRGF0ZVRpbWVQcm9w1v9Y7ByAqE51bGxQcm9wwKtCeXRlQXJyUHJvcMQDAQID"), binary: "lQGAwKZtZXRob2SShqpTdHJpbmdQcm9wqFNpZ25hbFIhqkRvdWJsZVByb3DLQBkh+1RCzxKnSW50UHJvcCqsRGF0ZVRpbWVQcm9w1v9Y7ByAqE51bGxQcm9wwKtCeXRlQXJyUHJvcMQDAQIDhqpTdHJpbmdQcm9wqFNpZ25hbFIhqkRvdWJsZVByb3DLQBkh+1RCzxKnSW50UHJvcCqsRGF0ZVRpbWVQcm9w1v9Y7ByAqE51bGxQcm9wwKtCeXRlQXJyUHJvcMQDAQID"),
new ProtocolTestData( new ProtocolTestData(
name: "InvocationWithHeadersNoIdAndArrayOfCustomObjectArgs", name: "InvocationWithHeadersNoIdAndArrayOfCustomObjectArgs",
message: AddHeaders(TestHeaders, new InvocationMessage(target: "method", argumentBindingException: null, new[] { new CustomObject(), new CustomObject() })), message: AddHeaders(TestHeaders, new InvocationMessage("method", null, new object[] { new CustomObject(), new CustomObject() })),
binary: "lQGDo0Zvb6NCYXKyS2V5V2l0aApOZXcNCkxpbmVzq1N0aWxsIFdvcmtzsVZhbHVlV2l0aE5ld0xpbmVzsEFsc28KV29ya3MNCkZpbmXApm1ldGhvZJKGqlN0cmluZ1Byb3CoU2lnbmFsUiGqRG91YmxlUHJvcMtAGSH7VELPEqdJbnRQcm9wKqxEYXRlVGltZVByb3DW/1jsHICoTnVsbFByb3DAq0J5dGVBcnJQcm9wxAMBAgOGqlN0cmluZ1Byb3CoU2lnbmFsUiGqRG91YmxlUHJvcMtAGSH7VELPEqdJbnRQcm9wKqxEYXRlVGltZVByb3DW/1jsHICoTnVsbFByb3DAq0J5dGVBcnJQcm9wxAMBAgM="), binary: "lQGDo0Zvb6NCYXKyS2V5V2l0aApOZXcNCkxpbmVzq1N0aWxsIFdvcmtzsVZhbHVlV2l0aE5ld0xpbmVzsEFsc28KV29ya3MNCkZpbmXApm1ldGhvZJKGqlN0cmluZ1Byb3CoU2lnbmFsUiGqRG91YmxlUHJvcMtAGSH7VELPEqdJbnRQcm9wKqxEYXRlVGltZVByb3DW/1jsHICoTnVsbFByb3DAq0J5dGVBcnJQcm9wxAMBAgOGqlN0cmluZ1Byb3CoU2lnbmFsUiGqRG91YmxlUHJvcMtAGSH7VELPEqdJbnRQcm9wKqxEYXRlVGltZVByb3DW/1jsHICoTnVsbFByb3DAq0J5dGVBcnJQcm9wxAMBAgM="),
// StreamItem Messages // StreamItem Messages
new ProtocolTestData( new ProtocolTestData(
name: "StreamItemWithNoHeadersAndNullItem", name: "StreamItemWithNoHeadersAndNullItem",
message: new StreamItemMessage(invocationId: "xyz", item: null), message: new StreamItemMessage("xyz", item: null),
binary: "lAKAo3h5esA="), binary: "lAKAo3h5esA="),
new ProtocolTestData( new ProtocolTestData(
name: "StreamItemWithNoHeadersAndIntItem", name: "StreamItemWithNoHeadersAndIntItem",
message: new StreamItemMessage(invocationId: "xyz", item: 42), message: new StreamItemMessage("xyz", item: 42),
binary: "lAKAo3h5eio="), binary: "lAKAo3h5eio="),
new ProtocolTestData( new ProtocolTestData(
name: "StreamItemWithNoHeadersAndFloatItem", name: "StreamItemWithNoHeadersAndFloatItem",
message: new StreamItemMessage(invocationId: "xyz", item: 42.0f), message: new StreamItemMessage("xyz", item: 42.0f),
binary: "lAKAo3h5espCKAAA"), binary: "lAKAo3h5espCKAAA"),
new ProtocolTestData( new ProtocolTestData(
name: "StreamItemWithNoHeadersAndStringItem", name: "StreamItemWithNoHeadersAndStringItem",
message: new StreamItemMessage(invocationId: "xyz", item: "string"), message: new StreamItemMessage("xyz", item: "string"),
binary: "lAKAo3h5eqZzdHJpbmc="), binary: "lAKAo3h5eqZzdHJpbmc="),
new ProtocolTestData( new ProtocolTestData(
name: "StreamItemWithNoHeadersAndBoolItem", name: "StreamItemWithNoHeadersAndBoolItem",
message: new StreamItemMessage(invocationId: "xyz", item: true), message: new StreamItemMessage("xyz", item: true),
binary: "lAKAo3h5esM="), binary: "lAKAo3h5esM="),
new ProtocolTestData( new ProtocolTestData(
name: "StreamItemWithNoHeadersAndEnumItem", name: "StreamItemWithNoHeadersAndEnumItem",
message: new StreamItemMessage(invocationId: "xyz", item: TestEnum.One), message: new StreamItemMessage("xyz", item: TestEnum.One),
binary: "lAKAo3h5eqNPbmU="), binary: "lAKAo3h5eqNPbmU="),
new ProtocolTestData( new ProtocolTestData(
name: "StreamItemWithNoHeadersAndCustomObjectItem", name: "StreamItemWithNoHeadersAndCustomObjectItem",
message: new StreamItemMessage(invocationId: "xyz", item: new CustomObject()), message: new StreamItemMessage("xyz", item: new CustomObject()),
binary: "lAKAo3h5eoaqU3RyaW5nUHJvcKhTaWduYWxSIapEb3VibGVQcm9wy0AZIftUQs8Sp0ludFByb3AqrERhdGVUaW1lUHJvcNb/WOwcgKhOdWxsUHJvcMCrQnl0ZUFyclByb3DEAwECAw=="), binary: "lAKAo3h5eoaqU3RyaW5nUHJvcKhTaWduYWxSIapEb3VibGVQcm9wy0AZIftUQs8Sp0ludFByb3AqrERhdGVUaW1lUHJvcNb/WOwcgKhOdWxsUHJvcMCrQnl0ZUFyclByb3DEAwECAw=="),
new ProtocolTestData( new ProtocolTestData(
name: "StreamItemWithNoHeadersAndCustomObjectArrayItem", name: "StreamItemWithNoHeadersAndCustomObjectArrayItem",
message: new StreamItemMessage(invocationId: "xyz", item: new[] { new CustomObject(), new CustomObject() }), message: new StreamItemMessage("xyz", item: new[] { new CustomObject(), new CustomObject() }),
binary: "lAKAo3h5epKGqlN0cmluZ1Byb3CoU2lnbmFsUiGqRG91YmxlUHJvcMtAGSH7VELPEqdJbnRQcm9wKqxEYXRlVGltZVByb3DW/1jsHICoTnVsbFByb3DAq0J5dGVBcnJQcm9wxAMBAgOGqlN0cmluZ1Byb3CoU2lnbmFsUiGqRG91YmxlUHJvcMtAGSH7VELPEqdJbnRQcm9wKqxEYXRlVGltZVByb3DW/1jsHICoTnVsbFByb3DAq0J5dGVBcnJQcm9wxAMBAgM="), binary: "lAKAo3h5epKGqlN0cmluZ1Byb3CoU2lnbmFsUiGqRG91YmxlUHJvcMtAGSH7VELPEqdJbnRQcm9wKqxEYXRlVGltZVByb3DW/1jsHICoTnVsbFByb3DAq0J5dGVBcnJQcm9wxAMBAgOGqlN0cmluZ1Byb3CoU2lnbmFsUiGqRG91YmxlUHJvcMtAGSH7VELPEqdJbnRQcm9wKqxEYXRlVGltZVByb3DW/1jsHICoTnVsbFByb3DAq0J5dGVBcnJQcm9wxAMBAgM="),
new ProtocolTestData( new ProtocolTestData(
name: "StreamItemWithHeadersAndCustomObjectArrayItem", name: "StreamItemWithHeadersAndCustomObjectArrayItem",
message: AddHeaders(TestHeaders, new StreamItemMessage(invocationId: "xyz", item: new[] { new CustomObject(), new CustomObject() })), message: AddHeaders(TestHeaders, new StreamItemMessage("xyz", item: new[] { new CustomObject(), new CustomObject() })),
binary: "lAKDo0Zvb6NCYXKyS2V5V2l0aApOZXcNCkxpbmVzq1N0aWxsIFdvcmtzsVZhbHVlV2l0aE5ld0xpbmVzsEFsc28KV29ya3MNCkZpbmWjeHl6koaqU3RyaW5nUHJvcKhTaWduYWxSIapEb3VibGVQcm9wy0AZIftUQs8Sp0ludFByb3AqrERhdGVUaW1lUHJvcNb/WOwcgKhOdWxsUHJvcMCrQnl0ZUFyclByb3DEAwECA4aqU3RyaW5nUHJvcKhTaWduYWxSIapEb3VibGVQcm9wy0AZIftUQs8Sp0ludFByb3AqrERhdGVUaW1lUHJvcNb/WOwcgKhOdWxsUHJvcMCrQnl0ZUFyclByb3DEAwECAw=="), binary: "lAKDo0Zvb6NCYXKyS2V5V2l0aApOZXcNCkxpbmVzq1N0aWxsIFdvcmtzsVZhbHVlV2l0aE5ld0xpbmVzsEFsc28KV29ya3MNCkZpbmWjeHl6koaqU3RyaW5nUHJvcKhTaWduYWxSIapEb3VibGVQcm9wy0AZIftUQs8Sp0ludFByb3AqrERhdGVUaW1lUHJvcNb/WOwcgKhOdWxsUHJvcMCrQnl0ZUFyclByb3DEAwECA4aqU3RyaW5nUHJvcKhTaWduYWxSIapEb3VibGVQcm9wy0AZIftUQs8Sp0ludFByb3AqrERhdGVUaW1lUHJvcNb/WOwcgKhOdWxsUHJvcMCrQnl0ZUFyclByb3DEAwECAw=="),
// Completion Messages // Completion Messages
new ProtocolTestData( new ProtocolTestData(
name: "CompletionWithNoHeadersAndError", name: "CompletionWithNoHeadersAndError",
message: CompletionMessage.WithError(invocationId: "xyz", error: "Error not found!"), message: CompletionMessage.WithError("xyz", error: "Error not found!"),
binary: "lQOAo3h5egGwRXJyb3Igbm90IGZvdW5kIQ=="), binary: "lQOAo3h5egGwRXJyb3Igbm90IGZvdW5kIQ=="),
new ProtocolTestData( new ProtocolTestData(
name: "CompletionWithHeadersAndError", name: "CompletionWithHeadersAndError",
message: AddHeaders(TestHeaders, CompletionMessage.WithError(invocationId: "xyz", error: "Error not found!")), message: AddHeaders(TestHeaders, CompletionMessage.WithError("xyz", error: "Error not found!")),
binary: "lQODo0Zvb6NCYXKyS2V5V2l0aApOZXcNCkxpbmVzq1N0aWxsIFdvcmtzsVZhbHVlV2l0aE5ld0xpbmVzsEFsc28KV29ya3MNCkZpbmWjeHl6AbBFcnJvciBub3QgZm91bmQh"), binary: "lQODo0Zvb6NCYXKyS2V5V2l0aApOZXcNCkxpbmVzq1N0aWxsIFdvcmtzsVZhbHVlV2l0aE5ld0xpbmVzsEFsc28KV29ya3MNCkZpbmWjeHl6AbBFcnJvciBub3QgZm91bmQh"),
new ProtocolTestData( new ProtocolTestData(
name: "CompletionWithNoHeadersAndNoResult", name: "CompletionWithNoHeadersAndNoResult",
message: CompletionMessage.Empty(invocationId: "xyz"), message: CompletionMessage.Empty("xyz"),
binary: "lAOAo3h5egI="), binary: "lAOAo3h5egI="),
new ProtocolTestData( new ProtocolTestData(
name: "CompletionWithHeadersAndNoResult", name: "CompletionWithHeadersAndNoResult",
message: AddHeaders(TestHeaders, CompletionMessage.Empty(invocationId: "xyz")), message: AddHeaders(TestHeaders, CompletionMessage.Empty("xyz")),
binary: "lAODo0Zvb6NCYXKyS2V5V2l0aApOZXcNCkxpbmVzq1N0aWxsIFdvcmtzsVZhbHVlV2l0aE5ld0xpbmVzsEFsc28KV29ya3MNCkZpbmWjeHl6Ag=="), binary: "lAODo0Zvb6NCYXKyS2V5V2l0aApOZXcNCkxpbmVzq1N0aWxsIFdvcmtzsVZhbHVlV2l0aE5ld0xpbmVzsEFsc28KV29ya3MNCkZpbmWjeHl6Ag=="),
new ProtocolTestData( new ProtocolTestData(
name: "CompletionWithNoHeadersAndNullResult", name: "CompletionWithNoHeadersAndNullResult",
message: CompletionMessage.WithResult(invocationId: "xyz", payload: null), message: CompletionMessage.WithResult("xyz", payload: null),
binary: "lQOAo3h5egPA"), binary: "lQOAo3h5egPA"),
new ProtocolTestData( new ProtocolTestData(
name: "CompletionWithNoHeadersAndIntResult", name: "CompletionWithNoHeadersAndIntResult",
message: CompletionMessage.WithResult(invocationId: "xyz", payload: 42), message: CompletionMessage.WithResult("xyz", payload: 42),
binary: "lQOAo3h5egMq"), binary: "lQOAo3h5egMq"),
new ProtocolTestData( new ProtocolTestData(
name: "CompletionWithNoHeadersAndEnumResult", name: "CompletionWithNoHeadersAndEnumResult",
message: CompletionMessage.WithResult(invocationId: "xyz", payload: TestEnum.One), message: CompletionMessage.WithResult("xyz", payload: TestEnum.One),
binary: "lQOAo3h5egOjT25l"), binary: "lQOAo3h5egOjT25l"),
new ProtocolTestData( new ProtocolTestData(
name: "CompletionWithNoHeadersAndFloatResult", name: "CompletionWithNoHeadersAndFloatResult",
message: CompletionMessage.WithResult(invocationId: "xyz", payload: 42.0f), message: CompletionMessage.WithResult("xyz", payload: 42.0f),
binary: "lQOAo3h5egPKQigAAA=="), binary: "lQOAo3h5egPKQigAAA=="),
new ProtocolTestData( new ProtocolTestData(
name: "CompletionWithNoHeadersAndStringResult", name: "CompletionWithNoHeadersAndStringResult",
message: CompletionMessage.WithResult(invocationId: "xyz", payload: "string"), message: CompletionMessage.WithResult("xyz", payload: "string"),
binary: "lQOAo3h5egOmc3RyaW5n"), binary: "lQOAo3h5egOmc3RyaW5n"),
new ProtocolTestData( new ProtocolTestData(
name: "CompletionWithNoHeadersAndBooleanResult", name: "CompletionWithNoHeadersAndBooleanResult",
message: CompletionMessage.WithResult(invocationId: "xyz", payload: true), message: CompletionMessage.WithResult("xyz", payload: true),
binary: "lQOAo3h5egPD"), binary: "lQOAo3h5egPD"),
new ProtocolTestData( new ProtocolTestData(
name: "CompletionWithNoHeadersAndCustomObjectResult", name: "CompletionWithNoHeadersAndCustomObjectResult",
message: CompletionMessage.WithResult(invocationId: "xyz", payload: new CustomObject()), message: CompletionMessage.WithResult("xyz", payload: new CustomObject()),
binary: "lQOAo3h5egOGqlN0cmluZ1Byb3CoU2lnbmFsUiGqRG91YmxlUHJvcMtAGSH7VELPEqdJbnRQcm9wKqxEYXRlVGltZVByb3DW/1jsHICoTnVsbFByb3DAq0J5dGVBcnJQcm9wxAMBAgM="), binary: "lQOAo3h5egOGqlN0cmluZ1Byb3CoU2lnbmFsUiGqRG91YmxlUHJvcMtAGSH7VELPEqdJbnRQcm9wKqxEYXRlVGltZVByb3DW/1jsHICoTnVsbFByb3DAq0J5dGVBcnJQcm9wxAMBAgM="),
new ProtocolTestData( new ProtocolTestData(
name: "CompletionWithNoHeadersAndCustomObjectArrayResult", name: "CompletionWithNoHeadersAndCustomObjectArrayResult",
message: CompletionMessage.WithResult(invocationId: "xyz", payload: new[] { new CustomObject(), new CustomObject() }), message: CompletionMessage.WithResult("xyz", payload: new[] { new CustomObject(), new CustomObject() }),
binary: "lQOAo3h5egOShqpTdHJpbmdQcm9wqFNpZ25hbFIhqkRvdWJsZVByb3DLQBkh+1RCzxKnSW50UHJvcCqsRGF0ZVRpbWVQcm9w1v9Y7ByAqE51bGxQcm9wwKtCeXRlQXJyUHJvcMQDAQIDhqpTdHJpbmdQcm9wqFNpZ25hbFIhqkRvdWJsZVByb3DLQBkh+1RCzxKnSW50UHJvcCqsRGF0ZVRpbWVQcm9w1v9Y7ByAqE51bGxQcm9wwKtCeXRlQXJyUHJvcMQDAQID"), binary: "lQOAo3h5egOShqpTdHJpbmdQcm9wqFNpZ25hbFIhqkRvdWJsZVByb3DLQBkh+1RCzxKnSW50UHJvcCqsRGF0ZVRpbWVQcm9w1v9Y7ByAqE51bGxQcm9wwKtCeXRlQXJyUHJvcMQDAQIDhqpTdHJpbmdQcm9wqFNpZ25hbFIhqkRvdWJsZVByb3DLQBkh+1RCzxKnSW50UHJvcCqsRGF0ZVRpbWVQcm9w1v9Y7ByAqE51bGxQcm9wwKtCeXRlQXJyUHJvcMQDAQID"),
new ProtocolTestData( new ProtocolTestData(
name: "CompletionWithHeadersAndCustomObjectArrayResult", name: "CompletionWithHeadersAndCustomObjectArrayResult",
message: AddHeaders(TestHeaders, CompletionMessage.WithResult(invocationId: "xyz", payload: new[] { new CustomObject(), new CustomObject() })), message: AddHeaders(TestHeaders, CompletionMessage.WithResult("xyz", payload: new[] { new CustomObject(), new CustomObject() })),
binary: "lQODo0Zvb6NCYXKyS2V5V2l0aApOZXcNCkxpbmVzq1N0aWxsIFdvcmtzsVZhbHVlV2l0aE5ld0xpbmVzsEFsc28KV29ya3MNCkZpbmWjeHl6A5KGqlN0cmluZ1Byb3CoU2lnbmFsUiGqRG91YmxlUHJvcMtAGSH7VELPEqdJbnRQcm9wKqxEYXRlVGltZVByb3DW/1jsHICoTnVsbFByb3DAq0J5dGVBcnJQcm9wxAMBAgOGqlN0cmluZ1Byb3CoU2lnbmFsUiGqRG91YmxlUHJvcMtAGSH7VELPEqdJbnRQcm9wKqxEYXRlVGltZVByb3DW/1jsHICoTnVsbFByb3DAq0J5dGVBcnJQcm9wxAMBAgM="), binary: "lQODo0Zvb6NCYXKyS2V5V2l0aApOZXcNCkxpbmVzq1N0aWxsIFdvcmtzsVZhbHVlV2l0aE5ld0xpbmVzsEFsc28KV29ya3MNCkZpbmWjeHl6A5KGqlN0cmluZ1Byb3CoU2lnbmFsUiGqRG91YmxlUHJvcMtAGSH7VELPEqdJbnRQcm9wKqxEYXRlVGltZVByb3DW/1jsHICoTnVsbFByb3DAq0J5dGVBcnJQcm9wxAMBAgOGqlN0cmluZ1Byb3CoU2lnbmFsUiGqRG91YmxlUHJvcMtAGSH7VELPEqdJbnRQcm9wKqxEYXRlVGltZVByb3DW/1jsHICoTnVsbFByb3DAq0J5dGVBcnJQcm9wxAMBAgM="),
// StreamInvocation Messages // StreamInvocation Messages
new ProtocolTestData( new ProtocolTestData(
name: "StreamInvocationWithNoHeadersAndNoArgs", name: "StreamInvocationWithNoHeadersAndNoArgs",
message: new StreamInvocationMessage(invocationId: "xyz", target: "method", argumentBindingException: null), message: new StreamInvocationMessage("xyz", "method", null, Array.Empty<object>()),
binary: "lQSAo3h5eqZtZXRob2SQ"), binary: "lQSAo3h5eqZtZXRob2SQ"),
new ProtocolTestData( new ProtocolTestData(
name: "StreamInvocationWithNoHeadersAndNullArg", name: "StreamInvocationWithNoHeadersAndNullArg",
message: new StreamInvocationMessage(invocationId: "xyz", target: "method", argumentBindingException: null, new object[] { null }), message: new StreamInvocationMessage("xyz", "method", null, new object[] { null }),
binary: "lQSAo3h5eqZtZXRob2SRwA=="), binary: "lQSAo3h5eqZtZXRob2SRwA=="),
new ProtocolTestData( new ProtocolTestData(
name: "StreamInvocationWithNoHeadersAndIntArg", name: "StreamInvocationWithNoHeadersAndIntArg",
message: new StreamInvocationMessage(invocationId: "xyz", target: "method", argumentBindingException: null, 42), message: new StreamInvocationMessage("xyz", "method", null, new object[] { 42 }),
binary: "lQSAo3h5eqZtZXRob2SRKg=="), binary: "lQSAo3h5eqZtZXRob2SRKg=="),
new ProtocolTestData( new ProtocolTestData(
name: "StreamInvocationWithNoHeadersAndEnumArg", name: "StreamInvocationWithNoHeadersAndEnumArg",
message: new StreamInvocationMessage(invocationId: "xyz", target: "method", argumentBindingException: null, TestEnum.One), message: new StreamInvocationMessage("xyz", "method", null, new object[] { TestEnum.One }),
binary: "lQSAo3h5eqZtZXRob2SRo09uZQ=="), binary: "lQSAo3h5eqZtZXRob2SRo09uZQ=="),
new ProtocolTestData( new ProtocolTestData(
name: "StreamInvocationWithNoHeadersAndIntAndStringArgs", name: "StreamInvocationWithNoHeadersAndIntAndStringArgs",
message: new StreamInvocationMessage(invocationId: "xyz", target: "method", argumentBindingException: null, 42, "string"), message: new StreamInvocationMessage("xyz", "method", null, new object[] { 42, "string" }),
binary: "lQSAo3h5eqZtZXRob2SSKqZzdHJpbmc="), binary: "lQSAo3h5eqZtZXRob2SSKqZzdHJpbmc="),
new ProtocolTestData( new ProtocolTestData(
name: "StreamInvocationWithNoHeadersAndIntStringAndCustomObjectArgs", name: "StreamInvocationWithNoHeadersAndIntStringAndCustomObjectArgs",
message: new StreamInvocationMessage(invocationId: "xyz", target: "method", argumentBindingException: null, 42, "string", new CustomObject()), message: new StreamInvocationMessage("xyz", "method", null, new object[] { 42, "string", new CustomObject() }),
binary: "lQSAo3h5eqZtZXRob2STKqZzdHJpbmeGqlN0cmluZ1Byb3CoU2lnbmFsUiGqRG91YmxlUHJvcMtAGSH7VELPEqdJbnRQcm9wKqxEYXRlVGltZVByb3DW/1jsHICoTnVsbFByb3DAq0J5dGVBcnJQcm9wxAMBAgM="), binary: "lQSAo3h5eqZtZXRob2STKqZzdHJpbmeGqlN0cmluZ1Byb3CoU2lnbmFsUiGqRG91YmxlUHJvcMtAGSH7VELPEqdJbnRQcm9wKqxEYXRlVGltZVByb3DW/1jsHICoTnVsbFByb3DAq0J5dGVBcnJQcm9wxAMBAgM="),
new ProtocolTestData( new ProtocolTestData(
name: "StreamInvocationWithNoHeadersAndCustomObjectArrayArg", name: "StreamInvocationWithNoHeadersAndCustomObjectArrayArg",
message: new StreamInvocationMessage(invocationId: "xyz", target: "method", argumentBindingException: null, new[] { new CustomObject(), new CustomObject() }), message: new StreamInvocationMessage("xyz", "method", null, new object[] { new CustomObject(), new CustomObject() }),
binary: "lQSAo3h5eqZtZXRob2SShqpTdHJpbmdQcm9wqFNpZ25hbFIhqkRvdWJsZVByb3DLQBkh+1RCzxKnSW50UHJvcCqsRGF0ZVRpbWVQcm9w1v9Y7ByAqE51bGxQcm9wwKtCeXRlQXJyUHJvcMQDAQIDhqpTdHJpbmdQcm9wqFNpZ25hbFIhqkRvdWJsZVByb3DLQBkh+1RCzxKnSW50UHJvcCqsRGF0ZVRpbWVQcm9w1v9Y7ByAqE51bGxQcm9wwKtCeXRlQXJyUHJvcMQDAQID"), binary: "lQSAo3h5eqZtZXRob2SShqpTdHJpbmdQcm9wqFNpZ25hbFIhqkRvdWJsZVByb3DLQBkh+1RCzxKnSW50UHJvcCqsRGF0ZVRpbWVQcm9w1v9Y7ByAqE51bGxQcm9wwKtCeXRlQXJyUHJvcMQDAQIDhqpTdHJpbmdQcm9wqFNpZ25hbFIhqkRvdWJsZVByb3DLQBkh+1RCzxKnSW50UHJvcCqsRGF0ZVRpbWVQcm9w1v9Y7ByAqE51bGxQcm9wwKtCeXRlQXJyUHJvcMQDAQID"),
new ProtocolTestData( new ProtocolTestData(
name: "StreamInvocationWithHeadersAndCustomObjectArrayArg", name: "StreamInvocationWithHeadersAndCustomObjectArrayArg",
message: AddHeaders(TestHeaders, new StreamInvocationMessage(invocationId: "xyz", target: "method", argumentBindingException: null, new[] { new CustomObject(), new CustomObject() })), message: AddHeaders(TestHeaders, new StreamInvocationMessage("xyz", "method", null, new object[] { new CustomObject(), new CustomObject() })),
binary: "lQSDo0Zvb6NCYXKyS2V5V2l0aApOZXcNCkxpbmVzq1N0aWxsIFdvcmtzsVZhbHVlV2l0aE5ld0xpbmVzsEFsc28KV29ya3MNCkZpbmWjeHl6pm1ldGhvZJKGqlN0cmluZ1Byb3CoU2lnbmFsUiGqRG91YmxlUHJvcMtAGSH7VELPEqdJbnRQcm9wKqxEYXRlVGltZVByb3DW/1jsHICoTnVsbFByb3DAq0J5dGVBcnJQcm9wxAMBAgOGqlN0cmluZ1Byb3CoU2lnbmFsUiGqRG91YmxlUHJvcMtAGSH7VELPEqdJbnRQcm9wKqxEYXRlVGltZVByb3DW/1jsHICoTnVsbFByb3DAq0J5dGVBcnJQcm9wxAMBAgM="), binary: "lQSDo0Zvb6NCYXKyS2V5V2l0aApOZXcNCkxpbmVzq1N0aWxsIFdvcmtzsVZhbHVlV2l0aE5ld0xpbmVzsEFsc28KV29ya3MNCkZpbmWjeHl6pm1ldGhvZJKGqlN0cmluZ1Byb3CoU2lnbmFsUiGqRG91YmxlUHJvcMtAGSH7VELPEqdJbnRQcm9wKqxEYXRlVGltZVByb3DW/1jsHICoTnVsbFByb3DAq0J5dGVBcnJQcm9wxAMBAgOGqlN0cmluZ1Byb3CoU2lnbmFsUiGqRG91YmxlUHJvcMtAGSH7VELPEqdJbnRQcm9wKqxEYXRlVGltZVByb3DW/1jsHICoTnVsbFByb3DAq0J5dGVBcnJQcm9wxAMBAgM="),
// CancelInvocation Messages // CancelInvocation Messages
new ProtocolTestData( new ProtocolTestData(
name: "CancelInvocationWithNoHeaders", name: "CancelInvocationWithNoHeaders",
message: new CancelInvocationMessage(invocationId: "xyz"), message: new CancelInvocationMessage("xyz"),
binary: "kwWAo3h5eg=="), binary: "kwWAo3h5eg=="),
new ProtocolTestData( new ProtocolTestData(
name: "CancelInvocationWithHeaders", name: "CancelInvocationWithHeaders",
message: AddHeaders(TestHeaders, new CancelInvocationMessage(invocationId: "xyz")), message: AddHeaders(TestHeaders, new CancelInvocationMessage("xyz")),
binary: "kwWDo0Zvb6NCYXKyS2V5V2l0aApOZXcNCkxpbmVzq1N0aWxsIFdvcmtzsVZhbHVlV2l0aE5ld0xpbmVzsEFsc28KV29ya3MNCkZpbmWjeHl6"), binary: "kwWDo0Zvb6NCYXKyS2V5V2l0aApOZXcNCkxpbmVzq1N0aWxsIFdvcmtzsVZhbHVlV2l0aE5ld0xpbmVzsEFsc28KV29ya3MNCkZpbmWjeHl6"),
// Ping Messages // Ping Messages
@ -257,10 +257,10 @@ namespace Microsoft.AspNetCore.SignalR.Common.Tests.Internal.Protocol
[Fact] [Fact]
public void ParseMessageWithExtraData() public void ParseMessageWithExtraData()
{ {
var expectedMessage = new InvocationMessage(invocationId: "xyz", target: "method", argumentBindingException: null); var expectedMessage = new InvocationMessage("xyz", "method", null, Array.Empty<object>());
// Verify that the input binary string decodes to the expected MsgPack primitives // Verify that the input binary string decodes to the expected MsgPack primitives
var bytes = new byte[] { Array(6), 1, 0x80, String(3), (byte)'x', (byte)'y', (byte)'z', String(6), (byte)'m', (byte)'e', (byte)'t', (byte)'h', (byte)'o', (byte)'d', Array(0), String(2), (byte)'e', (byte)'x' }; var bytes = new byte[] { ArrayBytes(6), 1, 0x80, StringBytes(3), (byte)'x', (byte)'y', (byte)'z', StringBytes(6), (byte)'m', (byte)'e', (byte)'t', (byte)'h', (byte)'o', (byte)'d', ArrayBytes(0), StringBytes(2), (byte)'e', (byte)'x' };
// Parse the input fully now. // Parse the input fully now.
bytes = Frame(bytes); bytes = Frame(bytes);
@ -442,17 +442,17 @@ namespace Microsoft.AspNetCore.SignalR.Common.Tests.Internal.Protocol
public void SerializerCanSerializeTypesWithNoDefaultCtor() public void SerializerCanSerializeTypesWithNoDefaultCtor()
{ {
var result = Write(CompletionMessage.WithResult("0", new List<int> { 42 }.AsReadOnly())); var result = Write(CompletionMessage.WithResult("0", new List<int> { 42 }.AsReadOnly()));
AssertMessages(new byte[] { Array(5), 3, 0x80, String(1), (byte)'0', 0x03, Array(1), 42 }, result); AssertMessages(new byte[] { ArrayBytes(5), 3, 0x80, StringBytes(1), (byte)'0', 0x03, ArrayBytes(1), 42 }, result);
} }
private byte Array(int size) private byte ArrayBytes(int size)
{ {
Debug.Assert(size < 16, "Test code doesn't support array sizes greater than 15"); Debug.Assert(size < 16, "Test code doesn't support array sizes greater than 15");
return (byte)(0x90 | size); return (byte)(0x90 | size);
} }
private byte String(int size) private byte StringBytes(int size)
{ {
Debug.Assert(size < 16, "Test code doesn't support string sizes greater than 15"); Debug.Assert(size < 16, "Test code doesn't support string sizes greater than 15");

View File

@ -166,15 +166,13 @@ namespace Microsoft.AspNetCore.SignalR.Tests
public Task<string> SendInvocationAsync(string methodName, bool nonBlocking, params object[] args) public Task<string> SendInvocationAsync(string methodName, bool nonBlocking, params object[] args)
{ {
var invocationId = nonBlocking ? null : GetInvocationId(); var invocationId = nonBlocking ? null : GetInvocationId();
return SendHubMessageAsync(new InvocationMessage(invocationId, methodName, return SendHubMessageAsync(new InvocationMessage(invocationId, methodName, null, args));
argumentBindingException: null, arguments: args));
} }
public Task<string> SendStreamInvocationAsync(string methodName, params object[] args) public Task<string> SendStreamInvocationAsync(string methodName, params object[] args)
{ {
var invocationId = GetInvocationId(); var invocationId = GetInvocationId();
return SendHubMessageAsync(new StreamInvocationMessage(invocationId, methodName, return SendHubMessageAsync(new StreamInvocationMessage(invocationId, methodName, null, args));
argumentBindingException: null, arguments: args));
} }
public async Task<string> SendHubMessageAsync(HubMessage message) public async Task<string> SendHubMessageAsync(HubMessage message)

View File

@ -1430,8 +1430,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
await client.Connected.OrTimeout(); await client.Connected.OrTimeout();
var invocationId = Guid.NewGuid().ToString("N"); var invocationId = Guid.NewGuid().ToString("N");
await client.SendHubMessageAsync(new StreamInvocationMessage(invocationId, nameof(StreamingHub.BlockingStream), await client.SendHubMessageAsync(new StreamInvocationMessage(invocationId, nameof(StreamingHub.BlockingStream), null, Array.Empty<object>()));
argumentBindingException: null));
// cancel the Streaming method // cancel the Streaming method
await client.SendHubMessageAsync(new CancelInvocationMessage(invocationId)).OrTimeout(); await client.SendHubMessageAsync(new CancelInvocationMessage(invocationId)).OrTimeout();