public void Can_TransformResponse_when_proxying_to_test()
        {
            var request = new EchoTypes
            {
                Byte   = 1,
                Short  = 2,
                Int    = 3,
                Long   = 4,
                Float  = 1.1f,
                String = "foo"
            };

            var url = ListeningOn.CombineWith("test")
                      .CombineWith("/echo/types")
                      .AddQueryParam("resReplace", "foo,bar");

            var response = url.PostJsonToUrl(request)
                           .FromJson <EchoTypes>();

            Assert.That(response.Byte, Is.EqualTo(1));
            Assert.That(response.Short, Is.EqualTo(2));
            Assert.That(response.Int, Is.EqualTo(3));
            Assert.That(response.Long, Is.EqualTo(4));
            Assert.That(response.Float, Is.EqualTo(1.1f));
            Assert.That(response.String, Is.EqualTo("bar"));
        }
Beispiel #2
0
        public async Task Can_proxy_to_test_servicestack_Async()
        {
            var client = new JsonServiceClient(ListeningOn.CombineWith("test"));

            var request = new EchoTypes
            {
                Byte   = 1,
                Short  = 2,
                Int    = 3,
                Long   = 4,
                Float  = 1.1f,
                String = "foo"
            };
            var response = await client.PostAsync(request);

            Assert.That(response.Byte, Is.EqualTo(1));
            Assert.That(response.Short, Is.EqualTo(2));
            Assert.That(response.Int, Is.EqualTo(3));
            Assert.That(response.Long, Is.EqualTo(4));
            Assert.That(response.Float, Is.EqualTo(1.1f));
            Assert.That(response.String, Is.EqualTo("foo"));
        }
 public object Any(EchoTypes request) => request;