public void WhenAPIReturnsValidResponse_NoErrorsInResponse() { //Act OwnerPetsData ownerPetsData = _petsDataAccess.RetrievePets(); // Assert Assert.IsTrue(ownerPetsData.Errors.Count == 0 && ownerPetsData.Owners.Count > 0); }
public void WhenInvokedAPI_WithInvalidBaseUri_ShouldReturnError() { // Arrange ConfigurationManager.AppSettings["BaseUri"] = "http://agl-developer-test.azurewebsites.com"; // Invalid base uri ConfigurationManager.AppSettings["RetrievePetsUri"] = "/people.json"; _petsDataAccess = new PetsDataAccess(new RestClient()); //Act OwnerPetsData ownerPetsData = _petsDataAccess.RetrievePets(); // Assert Assert.IsTrue(ownerPetsData.Errors.Any(error => error.StatusCode == 0 && !string.IsNullOrEmpty(error.ErrorMessage))); }
public void WhenInvokedAPIWithInvalidResourceUri_ShouldReturn404NotFoundError() { // Arrange ConfigurationManager.AppSettings["BaseUri"] = "http://agl-developer-test.azurewebsites.net"; ConfigurationManager.AppSettings["RetrievePetsUri"] = "/people.jso"; // Inject invalid resource uri _petsDataAccess = new PetsDataAccess(new RestClient()); //Act OwnerPetsData ownerPetsData = _petsDataAccess.RetrievePets(); // Assert Assert.IsTrue(ownerPetsData.Errors.Any(error => error.StatusCode == HttpStatusCode.NotFound && !string.IsNullOrEmpty(error.ErrorMessage))); }