public void WebExceptionShouldNotBeSurfacedWhenGetResponseThrowsOnBatch() { IODataRequestMessage requestMessage = new ODataTestMessage(); var context = new DataServiceContextWithCustomTransportLayer(ODataProtocolVersion.V4, () => requestMessage, () => { throw new WebException("web exception on getting response"); }); Action test = () => context.ExecuteBatch(context.CreateQuery<NorthwindModel.Products>("Products")); test.ShouldThrow<WebException>().WithMessage("web exception on getting response"); }
private static Action GetQueryWithInjectedObjectDisposedOnGetStream(bool useExecuteBatch) { IODataRequestMessage requestMessage = new ODataTestMessage(); var responseMessage = CreateResponseMessageWithGetStreamThrowingObjectDisposeException(); var context = new DataServiceContextWithCustomTransportLayer(ODataProtocolVersion.V4, requestMessage, responseMessage); if (useExecuteBatch) { return () => context.ExecuteBatch(context.CreateQuery<NorthwindModel.Products>("Products")); } else { return () => context.CreateQuery<NorthwindModel.Products>("Products").ToList(); } }