Ejemplo n.º 1
0
        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 spamReports = new SpamReports(client);

            // Act
            await spamReports.DeleteAllAsync().ConfigureAwait(false);

            // Assert
            mockHttp.VerifyNoOutstandingExpectation();
            mockHttp.VerifyNoOutstandingRequest();
        }
Ejemplo n.º 2
0
        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 spamReports = new SpamReports(mockClient.Object, ENDPOINT);

            // Act
            spamReports.DeleteAllAsync().Wait(CancellationToken.None);

            // Assert
        }