Esempio n. 1
0
        public void Pause()
        {
            // Arrange
            var batchId = "YOUR_BATCH_ID";

            var mockHttp = new MockHttpMessageHandler();

            mockHttp.Expect(HttpMethod.Post, Utils.GetSendGridApiUri("user/scheduled_sends")).Respond("application/json", SINGLE_BATCH_JSON);

            var client  = Utils.GetFluentClient(mockHttp);
            var batches = new Batches(client);

            // Act
            batches.Pause(batchId).Wait(CancellationToken.None);

            // Assert
            mockHttp.VerifyNoOutstandingExpectation();
            mockHttp.VerifyNoOutstandingRequest();
        }
Esempio n. 2
0
        public void Pause()
        {
            // Arrange
            var batchId = "YOUR_BATCH_ID";

            var mockRepository = new MockRepository(MockBehavior.Strict);
            var mockClient     = mockRepository.Create <IClient>();

            mockClient
            .Setup(c => c.PostAsync("/user/scheduled_sends", It.IsAny <JObject>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(SINGLE_BATCH_JSON)
            })
            .Verifiable();

            var batches = new Batches(mockClient.Object, ENDPOINT);

            // Act
            batches.Pause(batchId).Wait(CancellationToken.None);

            // Assert
        }