/// <summary> /// Validates the data in the response payload based on the expected query value /// </summary> /// <param name="requestUri">The request uri</param> /// <param name="response">The response</param> /// <param name="expected">The expected query value</param> /// <param name="maxProtocolVersion">The max protocol version of the service</param> public void ValidateResponsePayload(ODataUri requestUri, ODataResponse response, QueryValue expected, DataServiceProtocolVersion maxProtocolVersion) { ExceptionUtilities.CheckObjectNotNull(requestUri, "requestUri"); ExceptionUtilities.CheckObjectNotNull(response, "response"); ExceptionUtilities.CheckObjectNotNull(expected, "expected"); var expectedVersion = response.GetDataServiceVersion(); this.Validator.ExpectedProtocolVersion = expectedVersion; this.Validator.ExpectedPayloadOptions = ODataPayloadOptions.None; string contentType; if (response.Headers.TryGetValue(HttpHeaders.ContentType, out contentType)) { var strategy = this.FormatSelector.GetStrategy(contentType, requestUri); ExceptionUtilities.CheckObjectNotNull(strategy, "Could not get strategy for content type '{0}'", contentType); this.Validator.PrimitiveValueComparer = strategy.GetPrimitiveComparer(); this.Validator.ExpectedPayloadOptions = this.ProtocolImplementationDetails.GetExpectedPayloadOptions(contentType, expectedVersion, requestUri); } this.ValidateAndPrintInfoOnError(requestUri, response.RootElement, expected); }
/// <summary> /// Verifies the update succeeded /// </summary> /// <param name="request">The request to verify</param> /// <param name="response">The response to verify</param> public override void Verify(ODataRequest request, ODataResponse response) { base.Verify(request, response); var contentType = response.GetHeaderValueIfExists(HttpHeaders.ContentType); var version = response.GetDataServiceVersion(); var options = this.ProtocolImplementationDetails.GetExpectedPayloadOptions(contentType, version, request.Uri); new NextLinkValidatingVisitor(request.Uri, options, this).ValidateNextLinks(response.RootElement); }