private static RequestDescription CreateRequestDescription(DataServiceSimulator service, bool shouldWriteResponseBody) { service.Configuration = new DataServiceConfiguration(new DataServiceProviderSimulator()); service.Configuration.DataServiceBehavior.MaxProtocolVersion = ODataProtocolVersion.V4; var host = new DataServiceHost2Simulator(); host.RequestHeaders["Prefer"] = "odata.include-annotations=\"*\""; host.RequestVersion = "4.0;"; host.RequestMaxVersion = "4.0;"; host.RequestHttpMethod = shouldWriteResponseBody ? "GET" : "DELETE"; service.OperationContext = new DataServiceOperationContext(false, host); service.OperationContext.InitializeAndCacheHeaders(service); service.OperationContext.RequestMessage.InitializeRequestVersionHeaders(V4); RequestDescription descrption = new RequestDescription(RequestTargetKind.Resource, RequestTargetSource.EntitySet, new Uri("http://service/set")); descrption.AnalyzeClientPreference(service); descrption.Preference.AnnotationFilter.Should().Be("*"); HttpVerbs verb = shouldWriteResponseBody ? HttpVerbs.GET : HttpVerbs.PATCH; descrption.DetermineWhetherResponseBodyOrETagShouldBeWritten(verb); descrption.DetermineWhetherResponseBodyShouldBeWritten(verb); return(descrption); }