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))); }
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_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))); }
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))); }