예제 #1
0
        public void SendMessageAsync_CallsInvoker()
        {
            HttpResponseMessage response = new HttpResponseMessage();

            HttpMessageInvoker invoker = new HttpMessageInvoker(new MockHttpServer((request) =>
            {
                return(response);
            }));

            var result = ODataBatchRequestItem.SendMessageAsync(invoker, new HttpRequestMessage(HttpMethod.Get, "http://example.com"), CancellationToken.None, new Dictionary <string, string>()).Result;

            Assert.Same(response, result);
        }
예제 #2
0
 public void SendMessageAsync_Throws_WhenRequestIsNull()
 {
     Assert.ThrowsArgumentNull(
         () => ODataBatchRequestItem.SendMessageAsync(new HttpMessageInvoker(new HttpServer()), null, CancellationToken.None, null).Wait(),
         "request");
 }
예제 #3
0
 public async Task SendMessageAsync_Throws_WhenRequestIsNull()
 {
     await ExceptionAssert.ThrowsArgumentNullAsync(
         () => ODataBatchRequestItem.SendMessageAsync(new HttpMessageInvoker(new HttpServer()), null, CancellationToken.None, null),
         "request");
 }
예제 #4
0
 public void SendMessageAsync_Throws_WhenInvokerIsNull()
 {
     Assert.ThrowsArgumentNull(
         () => ODataBatchRequestItem.SendMessageAsync(null, new HttpRequestMessage(), CancellationToken.None, null).Wait(),
         "invoker");
 }
예제 #5
0
 public async Task SendMessageAsync_Throws_WhenInvokerIsNull()
 {
     await ExceptionAssert.ThrowsArgumentNullAsync(
         () => ODataBatchRequestItem.SendMessageAsync(null, new HttpRequestMessage(), CancellationToken.None, null),
         "invoker");
 }