示例#1
0
        public async Task M()
        {
            var client = new JsonServiceClient("");

            client.DeserializeFromStream <object>(new MemoryStream());   // not a sink

            client.Get(new ReqDto1());
            client.Get(new ReqDto2());
            client.Get <ResponseDto>("relativeOrAbsoluteUrl");          // not a sink
            client.Get <ResponseDto>(new object());
            client.Get("relativeOrAbsoluteUrl");                        // not a sink
            client.Get(new object());

            await client.GetAsync <ResponseDto>("relativeOrAbsoluteUrl");    // not a sink

            await client.GetAsync <ResponseDto>(new object());

            await client.GetAsync(new ReqDto1());

            await client.GetAsync(new ReqDto2());


            client.CustomMethod("GET", new ReqDto2());
            client.CustomMethod <ResponseDto>("GET", "relativeOrAbsoluteUrl", new ReqDto1());
            client.CustomMethod <ResponseDto>("GET", new ReqDto1());
            client.CustomMethod <ResponseDto>("GET", new object());
            client.CustomMethod("GET", "relativeOrAbsoluteUrl", new object());
            client.CustomMethod("GET", (IReturnVoid)null);
            await client.CustomMethodAsync("GET", new ReqDto2());

            await client.CustomMethodAsync <ResponseDto>("GET", "relativeOrAbsoluteUrl", new ReqDto1());

            await client.CustomMethodAsync <ResponseDto>("GET", new ReqDto1());

            await client.CustomMethodAsync <ResponseDto>("GET", new object());

            client.DownloadBytes("GET", "requestUri", new object());
            await client.DownloadBytesAsync("GET", "relativeOrAbsoluteUrl", new object());

            client.Head(new object());
            client.Patch(new object());
            client.Post(new object());
            client.Put(new object());

            client.Send <ResponseDto>(new object());
            client.Publish(new ReqDto1());
            client.SendOneWay(new object());
        }
        public void SendOneWay_calls_PostTestMq_Service_via_MQ()
        {
            var client  = new JsonServiceClient(BaseUri);
            var request = new PostTestMq {
                Id = 4
            };

            client.SendOneWay(request);

            using (var mqFactory = appHost.TryResolve <IMessageFactory>())
            {
                var msg = mqFactory.CreateMessageQueueClient().Get(QueueNames <PostTestMqResponse> .In, null)
                          .ToMessage <PostTestMqResponse>();
                Assert.That(msg.GetBody().CorrelationId, Is.EqualTo(request.Id));
            }
        }
        public void SendOneWay_calls_AnyTestMq_Service_via_MQ()
        {
            var client  = new JsonServiceClient(BaseUri);
            var request = new AnyTestMq {
                Id = 3
            };

            client.SendOneWay(request);

            using (var mqFactory = AppHost.TryResolve <IMessageFactory>())
                using (var mqClient = mqFactory.CreateMessageQueueClient())
                {
                    var msg = mqClient.Get <AnyTestMqResponse>(QueueNames <AnyTestMqResponse> .In, MessageTimeout);
                    mqClient.Ack(msg);
                    Assert.That(msg.GetBody().CorrelationId, Is.EqualTo(request.Id));
                }
        }
示例#4
0
        public void SendOneWay_calls_PostTestMq_Service_via_MQ()
        {
            var client = new JsonServiceClient(BaseUri);
            var request = new PostTestMq { Id = 4 };

            client.SendOneWay(request);

            using (var mqFactory = appHost.TryResolve<IMessageFactory>())
            {
                var msg = mqFactory.CreateMessageQueueClient().Get(QueueNames<PostTestMqResponse>.In, null)
                    .ToMessage<PostTestMqResponse>();
                Assert.That(msg.GetBody().CorrelationId, Is.EqualTo(request.Id));
            }
        }