public async Task ResumeAsync() { // Arrange var batchId = "YOUR_BATCH_ID"; var mockHttp = new MockHttpMessageHandler(); mockHttp.Expect(HttpMethod.Delete, Utils.GetSendGridApiUri(ENDPOINT, batchId)).Respond(HttpStatusCode.NoContent); var client = Utils.GetFluentClient(mockHttp); var batches = new Batches(client); // Act await batches.Resume(batchId).ConfigureAwait(false); // Assert mockHttp.VerifyNoOutstandingExpectation(); mockHttp.VerifyNoOutstandingRequest(); }
public void Resume() { // Arrange var batchId = "YOUR_BATCH_ID"; var mockHttp = new MockHttpMessageHandler(); mockHttp.Expect(HttpMethod.Delete, Utils.GetSendGridApiUri(ENDPOINT, batchId)).Respond(HttpStatusCode.NoContent); var client = Utils.GetFluentClient(mockHttp); var batches = new Batches(client); // Act batches.Resume(batchId).Wait(CancellationToken.None); // Assert mockHttp.VerifyNoOutstandingExpectation(); mockHttp.VerifyNoOutstandingRequest(); }
public void Resume() { // Arrange var batchId = "YOUR_BATCH_ID"; var mockRepository = new MockRepository(MockBehavior.Strict); var mockClient = mockRepository.Create <IClient>(); mockClient .Setup(c => c.DeleteAsync($"{ENDPOINT}/{batchId}", It.IsAny <CancellationToken>())) .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.NoContent)) .Verifiable(); var batches = new Batches(mockClient.Object, ENDPOINT); // Act batches.Resume(batchId).Wait(CancellationToken.None); // Assert }