Esempio n. 1
0
        public void Delete()
        {
            // Arrange
            var groupId = 100;

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

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

            var groups = new UnsubscribeGroups(mockClient.Object);

            // Act
            groups.DeleteAsync(groupId, CancellationToken.None).Wait(CancellationToken.None);

            // Assert
        }
        public async Task DeleteAsync()
        {
            // Arrange
            var groupId = 100;

            var mockHttp = new MockHttpMessageHandler();

            mockHttp.Expect(HttpMethod.Delete, Utils.GetSendGridApiUri(ENDPOINT, groupId)).Respond(HttpStatusCode.OK);

            var client = Utils.GetFluentClient(mockHttp);
            var groups = new UnsubscribeGroups(client);

            // Act
            await groups.DeleteAsync(groupId, null, CancellationToken.None).ConfigureAwait(false);

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