Beispiel #1
0
        public void Delete()
        {
            // Arrange
            var alertId = 48;

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

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

            var alerts = new Alerts(mockClient.Object);

            // Act
            alerts.DeleteAsync(alertId, CancellationToken.None).Wait(CancellationToken.None);

            // Assert
        }
Beispiel #2
0
        public async Task Delete()
        {
            // Arrange
            var alertId = 48;

            var mockHttp = new MockHttpMessageHandler();

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

            var client = Utils.GetFluentClient(mockHttp);
            var alerts = new Alerts(client);

            // Act
            await alerts.DeleteAsync(alertId, null, CancellationToken.None).ConfigureAwait(false);

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