public void RemoveAddressFromSuppressionGroup()
        {
            // Arrange
            var groupId = 103;
            var email   = "*****@*****.**";

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

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

            var suppressions = new Suppressions(mockClient.Object);

            // Act
            suppressions.RemoveAddressFromSuppressionGroupAsync(groupId, email, CancellationToken.None).Wait();

            // Assert
        }
示例#2
0
        public async Task RemoveAddressFromSuppressionGrouAsyncp()
        {
            // Arrange
            var groupId = 103;
            var email   = "*****@*****.**";

            var mockHttp = new MockHttpMessageHandler();

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

            var client       = Utils.GetFluentClient(mockHttp);
            var suppressions = new Suppressions(client);

            // Act
            await suppressions.RemoveAddressFromSuppressionGroupAsync(groupId, email, null, CancellationToken.None).ConfigureAwait(false);

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