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)));
        }
Exemple #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)));
        }
        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)));
        }
Exemple #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)));
        }
        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)));
        }
        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)));
        }
        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)));
        }
Exemple #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)));
        }