public async Task DeleteAllStubs_ShouldDeleteAllStubs() { // Arrange var client = new HttPlaceholderClient(CreateHttpClient(mock => mock .When(HttpMethod.Delete, $"{BaseUrl}ph-api/stubs") .Respond(HttpStatusCode.NoContent))); // Act / Assert await client.DeleteAllStubsAsync(); }
public async Task DeleteAllStubs_ExceptionInRequest_ShouldThrowHttPlaceholderClientException() { // Arrange var client = new HttPlaceholderClient(CreateHttpClient(mock => mock .When(HttpMethod.Delete, $"{BaseUrl}ph-api/stubs") .Respond(HttpStatusCode.BadRequest, "text/plain", "Error occurred!"))); // Act var exception = await Assert.ThrowsExceptionAsync <HttPlaceholderClientException>(() => client.DeleteAllStubsAsync()); // Assert Assert.AreEqual("Status code '400' returned by HttPlaceholder with message 'Error occurred!'", exception.Message); }