public async Task DeleteAllAsync() { // Arrange var mockHttp = new MockHttpMessageHandler(); mockHttp.Expect(HttpMethod.Delete, Utils.GetSendGridApiUri(ENDPOINT)).Respond(HttpStatusCode.NoContent); var client = Utils.GetFluentClient(mockHttp); var invalidEmails = new InvalidEmails(client); // Act await invalidEmails.DeleteAllAsync().ConfigureAwait(false); // Assert mockHttp.VerifyNoOutstandingExpectation(); mockHttp.VerifyNoOutstandingRequest(); }
public void DeleteAll() { // Arrange var mockRepository = new MockRepository(MockBehavior.Strict); var mockClient = mockRepository.Create<IClient>(); mockClient .Setup(c => c.DeleteAsync(ENDPOINT, It.IsAny<JObject>(), It.IsAny<CancellationToken>())) .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.NoContent)) .Verifiable(); var invalidEmails = new InvalidEmails(mockClient.Object, ENDPOINT); // Act invalidEmails.DeleteAllAsync().Wait(CancellationToken.None); // Assert }