Esempio n. 1
0
        public async Task Dispatch_CommandWithNoReply_EmptyResponseType()
        {
            var serverCallContext = TestServerCallContextFactory.Create();

            serverCallContext.UserState["__HttpContext"] = httpContextFactory();
            var dispatcher = new DispatcherService();
            var cmd        = new TestCommandNoReturnValue();

            RequestEnvelope request = new RequestEnvelope()
            {
                Type    = cmd.GetType().AssemblyQualifiedName,
                Content = Value.Parser.ParseJson(JsonSerializer.Serialize(cmd))
            };
            var response = await dispatcher.Dispatch(request, serverCallContext);

            response.Type.ShouldBeNullOrEmpty();
            response.Content.ShouldBe(Value.ForNull());
        }
Esempio n. 2
0
        public async Task Dispatch_CommandWithNoReply_EmptyResponseType()
        {
            var serverCallContext = TestServerCallContextFactory.Create();

            serverCallContext.UserState["__HttpContext"] = httpContextFactory();
            var dispatcher = new DispatcherService();
            var cmd        = new TestCommandNoReturnValue();

            RequestEnvelope request = new RequestEnvelope()
            {
                Type = cmd.GetType().AssemblyQualifiedName,
                Data = UnsafeByteOperations.UnsafeWrap(JsonSerializer.SerializeToUtf8Bytes(cmd))
            };
            var response = await dispatcher.Dispatch(request, serverCallContext);

            response.Error.ShouldBeFalse();
            response.Type.ShouldBeNullOrEmpty();
            response.Data.IsEmpty.ShouldBeTrue();
        }