public void ShouldSeeaStandardIsMissing() { //Arrange const string standardCode = "-1"; MockProviderService .UponReceiving($"a request to retrieve standard with id '{standardCode}'") .With(new ProviderServiceRequest { Method = HttpVerb.Get, Path = $"/standards/{standardCode}", Headers = new Dictionary <string, string> { { "Accept", "application/json" } } }) .WillRespondWith(new ProviderServiceResponse { Status = 404 }); var consumer = new StandardApiClient(MockProviderServiceBaseUri); //Act Assert.Throws <EntityNotFoundException>(() => consumer.Get(standardCode)); MockProviderService.VerifyInteractions(); }
public void ShouldGetaStandard() { //Arrange const string standardCode = "12"; MockProviderService .UponReceiving($"a request to retrieve standard with id '{standardCode}'") .With(new ProviderServiceRequest { Method = HttpVerb.Get, Path = $"/standards/{standardCode}", Headers = new Dictionary <string, string> { { "Accept", "application/json" } } }) .WillRespondWith(new ProviderServiceResponse { Status = 200, Headers = new Dictionary <string, string> { { "Content-Type", "application/json; charset=utf-8" } }, Body = new { StandardId = standardCode } }); var consumer = new StandardApiClient(MockProviderServiceBaseUri); //Act var result = consumer.Get(standardCode); // TODO is this needed? //Assert Assert.AreEqual(standardCode, result.StandardId); MockProviderService.VerifyInteractions(); }