public async Task DeleteMultipleAsync() { // Arrange var emailAddresses = new[] { "*****@*****.**", "*****@*****.**" }; 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.DeleteMultipleAsync(emailAddresses).ConfigureAwait(false); // Assert mockHttp.VerifyNoOutstandingExpectation(); mockHttp.VerifyNoOutstandingRequest(); }
public void DeleteMultiple() { // Arrange var emailAddresses = new[] { "*****@*****.**", "*****@*****.**" }; var mockRepository = new MockRepository(MockBehavior.Strict); var mockClient = mockRepository.Create<IClient>(); mockClient .Setup(c => c.DeleteAsync(ENDPOINT, It.Is<JObject>(o => o["emails"].ToObject<string[]>().Length == emailAddresses.Length), It.IsAny<CancellationToken>())) .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.NoContent)) .Verifiable(); var invalidEmails = new InvalidEmails(mockClient.Object, ENDPOINT); // Act invalidEmails.DeleteMultipleAsync(emailAddresses).Wait(CancellationToken.None); // Assert }