コード例 #1
0
        public void Can_GET_GetFactorial_using_RestClient()
        {
            var restClient = CreateRestClient();

            var response = restClient.Get <GetFactorialResponse>("factorial/3");

            Assert.That(response, Is.Not.Null, "No response received");
            Assert.That(response.Result, Is.EqualTo(GetFactorialService.GetFactorial(3)));
        }
コード例 #2
0
        public async Task Can_call_GetAsync_on_GetFactorial_using_RestClientAsync()
        {
            var asyncClient = CreateAsyncRestClient();

            var response = await asyncClient.GetAsync <GetFactorialResponse>("factorial/3");

            Assert.That(response, Is.Not.Null, "No response received");
            Assert.That(response.Result, Is.EqualTo(GetFactorialService.GetFactorial(3)));
        }
コード例 #3
0
        public void Can_call_GetFactorial_WebService()
        {
            var client  = new XmlServiceClient(ListeningOn);
            var request = new GetFactorial {
                ForNumber = 3
            };
            var response = client.Send <GetFactorialResponse>(request);

            Assert.That(response.Result, Is.EqualTo(GetFactorialService.GetFactorial(request.ForNumber)));
        }
コード例 #4
0
        public async Task Can_call_SendAsync_on_ServiceClient()
        {
            var jsonClient = new JsonServiceClient(ListeningOn);

            var request = new GetFactorial {
                ForNumber = 3
            };
            var response = await jsonClient.SendAsync <GetFactorialResponse>(request);

            Assert.That(response, Is.Not.Null, "No response received");
            Assert.That(response.Result, Is.EqualTo(GetFactorialService.GetFactorial(request.ForNumber)));
        }
コード例 #5
0
        public async Task Can_call_SendAsync_with_compression_on_ServiceClient(string compressionType)
        {
            var jsonClient = CreateServiceClient(compressionType);

            var request = new GetFactorial {
                ForNumber = 3
            };
            var response = await jsonClient.SendAsync <GetFactorialResponse>(request);

            Assert.That(response, Is.Not.Null, "No response received");
            Assert.That(response.Result, Is.EqualTo(GetFactorialService.GetFactorial(request.ForNumber)));
        }
コード例 #6
0
        public void Can_call_GetAsync_on_GetFactorial_using_RestClientAsync()
        {
            var asyncClient = CreateAsyncRestClient();

            GetFactorialResponse response = null;

            asyncClient.GetAsync <GetFactorialResponse>("factorial/3", r => response = r, FailOnAsyncError);

            Thread.Sleep(1000);

            Assert.That(response, Is.Not.Null, "No response received");
            Assert.That(response.Result, Is.EqualTo(GetFactorialService.GetFactorial(3)));
        }
コード例 #7
0
        public void Can_call_SendAsync_on_ServiceClient()
        {
            var jsonClient = new JsonServiceClient(ListeningOn);

            var request = new GetFactorial {
                ForNumber = 3
            };
            GetFactorialResponse response = null;

            jsonClient.SendAsync <GetFactorialResponse>(request, r => response = r, FailOnAsyncError);

            Thread.Sleep(1000);

            Assert.That(response, Is.Not.Null, "No response received");
            Assert.That(response.Result, Is.EqualTo(GetFactorialService.GetFactorial(request.ForNumber)));
        }
コード例 #8
0
        public void Can_start_Listener_and_call_GetFactorial_WebService()
        {
            var appHost = new AppHost();

            appHost.Init();
            appHost.Start(ListeningOn);

            System.Console.WriteLine("AppHost Created at {0}, listening on {1}",
                                     DateTime.Now, ListeningOn);

            var client  = new XmlServiceClient(ListeningOn);
            var request = new GetFactorial {
                ForNumber = 3
            };
            var response = client.Send <GetFactorialResponse>(request);

            Assert.That(response.Result, Is.EqualTo(GetFactorialService.GetFactorial(request.ForNumber)));
        }