Exemplo n.º 1
0
        public void CreateResponseMessageAsync_Throws_IfResponsesAreNull()
        {
            UnbufferedODataBatchHandler batchHandler = new UnbufferedODataBatchHandler(new HttpServer());

            Assert.ThrowsArgumentNull(
                () => batchHandler.CreateResponseMessageAsync(null, new HttpRequestMessage(), CancellationToken.None).Wait(),
                "responses");
        }
Exemplo n.º 2
0
        public async Task CreateResponseMessageAsync_Throws_IfResponsesAreNull()
        {
            UnbufferedODataBatchHandler batchHandler = new UnbufferedODataBatchHandler(new HttpServer());
            HttpRequestMessage          request      = new HttpRequestMessage();

            request.EnableHttpDependencyInjectionSupport();
            await ExceptionAssert.ThrowsArgumentNullAsync(
                () => batchHandler.CreateResponseMessageAsync(null, request, CancellationToken.None),
                "responses");
        }
Exemplo n.º 3
0
        public async Task CreateResponseMessageAsync_Throws_IfResponsesAreNull()
        {
            // Arrange
            UnbufferedODataBatchHandler batchHandler = new UnbufferedODataBatchHandler();
            HttpContext context = new DefaultHttpContext();

            context.ODataFeature().PrefixName = "odata";
            context.RequestServices = BuildServiceProvider(opt => opt.AddModel("odata", EdmCoreModel.Instance));

            // Act & Assert
            await ExceptionAssert.ThrowsArgumentNullAsync(() => batchHandler.CreateResponseMessageAsync(null, context.Request),
                                                          "responses");
        }