Esempio n. 1
0
        public void DeleteAll()
        {
            // Arrange
            var mockClient = new Mock <IClient>(MockBehavior.Strict);

            mockClient.Setup(c => c.DeleteAsync(ENDPOINT, It.Is <JObject>(o => o["delete_all"].ToObject <bool>()), It.IsAny <CancellationToken>()))
            .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.NoContent));

            var bounces = new Bounces(mockClient.Object);

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

            // Assert
        }
Esempio n. 2
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 bounces = new Bounces(client);

            // Act
            await bounces.DeleteAllAsync(null, CancellationToken.None).ConfigureAwait(false);

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