예제 #1
0
        public void Delete()
        {
            // Arrange
            var email = "*****@*****.**";

            var mockClient = new Mock <IClient>(MockBehavior.Strict);

            mockClient.Setup(c => c.DeleteAsync($"{ENDPOINT}/{email}", It.IsAny <CancellationToken>()))
            .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.NoContent));

            var globalSuppressions = new GlobalSuppressions(mockClient.Object);

            // Act
            globalSuppressions.RemoveAsync(email, CancellationToken.None).Wait();

            // Assert
        }
예제 #2
0
        public async Task RemoveAsync()
        {
            // Arrange
            var email = "*****@*****.**";

            var mockHttp = new MockHttpMessageHandler();

            mockHttp.Expect(HttpMethod.Delete, Utils.GetSendGridApiUri(ENDPOINT, email)).Respond(HttpStatusCode.NoContent);

            var client             = Utils.GetFluentClient(mockHttp);
            var globalSuppressions = new GlobalSuppressions(client);

            // Act
            await globalSuppressions.RemoveAsync(email, null, CancellationToken.None).ConfigureAwait(false);

            // Assert
            mockHttp.VerifyNoOutstandingExpectation();
            mockHttp.VerifyNoOutstandingRequest();
        }