public void ContextLinkageInfoIsSerializedCorrectly(ContextLinkageDiscoveryMode mode) { var serializer = SerializerFactory.Create(MessageFactory); var serviceReference = MessageFactory.CreateConsumedServiceReference("interop.testing.EchoService", Maybe <string> .Nothing); var methodReference = MessageFactory.CreateConsumedMethodReference(serviceReference, "Unary"); var contextLinkageOptions = MessageFactory.CreateContextLinkageOptions(mode, Maybe <string> .Nothing); using (var request = MessageFactory.CreateInvocationStartRequest(methodReference, contextLinkageOptions)) using (var serialized = serializer.Serialize(request)) using (var deserialized = serializer.DeserializeClientToBrokerRequest(serialized)) { deserialized.Handle(new ClientToBrokerRequestHandler <Nothing, Nothing>( (msg, _) => { msg.ContextLinkageOptions.Mode.ShouldBe(mode); return(msg.Target.Handle(new InvocationTargetHandler <Nothing, Nothing>( (target, __) => { target.MethodId.ShouldBe("Unary"); target.ConsumedService.ServiceId.ShouldBe("interop.testing.EchoService"); target.ConsumedService.ServiceAlias.ShouldBe(Maybe <string> .Nothing); return Nothing.Instance; }, (target, __) => throw new InvalidOperationException($"Unexpected target: {target}")))); }, (msg, _) => throw new InvalidOperationException($"Unexpected message: {msg}"), (msg, _) => throw new InvalidOperationException($"Unexpected message: {msg}"))); } }
public static IInvocationStart CreateInvocationStartRequest(this IProtocolMessageFactory factory, string serviceId, Maybe <string> serviceAlias, string methodId) { return(factory.CreateInvocationStartRequest( factory.CreateConsumedMethodReference( factory.CreateConsumedServiceReference(serviceId, serviceAlias), methodId), null)); }
private IConsumedMethodReference ConvertFromProtoStrict(ConsumedMethodReference proto) { return(_messageFactory.CreateConsumedMethodReference( ConvertFromProtoStrict(proto.ConsumedService), proto.MethodId.ConvertFromProtoStrict())); }