public void WhenTryGetFails_ThenReturnsResponse() { using (var ws = new HttpWebService <HttpEntityConventionClientTestService>("http://localhost:20000", "products", new ServiceConfiguration())) { var client = new HttpEntityConventionClient(ws.BaseUri); var product = default(Product); var response = client.TryGet <Product>("25", out product); Assert.Equal(HttpStatusCode.NotFound, response.StatusCode); Assert.Null(product); } }
public void WhenTryGetSucceeds_ThenPopulatesEntity() { using (var ws = new HttpWebService <HttpEntityConventionClientTestService>("http://localhost:20000", "products", new ServiceConfiguration())) { var client = new HttpEntityConventionClient(ws.BaseUri); var product = default(Product); var response = client.TryGet <Product>("1", out product); Assert.True(response.IsSuccessStatusCode); Assert.NotNull(product); Assert.Equal("kzu", product.Owner.Name); } }
public void WhenTryGetSucceeds_ThenPopulatesEntity() { using (var ws = new HttpWebService<HttpEntityConventionClientTestService>("http://localhost:20000", "products", new ServiceConfiguration())) { var client = new HttpEntityConventionClient(ws.BaseUri); var product = default(Product); var response = client.TryGet<Product>("1", out product); Assert.True(response.IsSuccessStatusCode); Assert.NotNull(product); Assert.Equal("kzu", product.Owner.Name); } }
public void WhenTryGetFails_ThenReturnsResponse() { using (var ws = new HttpWebService<HttpEntityConventionClientTestService>("http://localhost:20000", "products", new ServiceConfiguration())) { var client = new HttpEntityConventionClient(ws.BaseUri); var product = default(Product); var response = client.TryGet<Product>("25", out product); Assert.Equal(HttpStatusCode.NotFound, response.StatusCode); Assert.Null(product); } }