private void VerifyQueryResult(ODataRequest request, ODataResponse response, FunctionSegment functionSegment, IVerifyServiceActionQueryResult verifyServiceQueryResult)
        {
            EntitySet expectedBindingEntitySet = null;
            var actionLessUri = ConstructODataUriWithoutActionInformation(this.entityModelSchema.GetDefaultEntityContainer().EntitySets, request.Uri);
            bool entitySetFound = actionLessUri.TryGetExpectedEntitySet(out expectedBindingEntitySet);
            ExceptionUtilities.Assert(entitySetFound, "EntitySet not found for Uri {0}", actionLessUri.ToString());

            // SDP never applies for actions
            var preActionQueryValueResult = this.ODataUriEvaluator.Evaluate(actionLessUri, true, false);

            IDictionary<string, QueryValue> queryValueParametersLookup = new Dictionary<string, QueryValue>();

            if (request.Body != null)
            {
                queryValueParametersLookup = this.CreateQueryValueParameters(request, functionSegment, queryValueParametersLookup);
            }

            var expected = verifyServiceQueryResult.GetExpectedQueryValue(preActionQueryValueResult, queryValueParametersLookup.Values.ToArray());
            HttpStatusCode expectedStatusCode = CalculateExpectedStatusCode(functionSegment);

            string expectedETag = null;
            SyncHelpers.ExecuteActionAndWait(c => this.Synchronizer.SynchronizeEntireEntitySet(c, expectedBindingEntitySet.Name));

            expectedETag = this.VerifyExpected(request, response, expected, expectedStatusCode, expectedETag);

            ETagHeaderVerifier etagHeaderVerifier = new ETagHeaderVerifier();
            etagHeaderVerifier.Verify(expectedETag, request, response);
        }
示例#2
0
        private void VerifyQueryResult(ODataRequest request, ODataResponse response, FunctionSegment functionSegment, IVerifyServiceActionQueryResult verifyServiceQueryResult)
        {
            EntitySet expectedBindingEntitySet = null;
            var       actionLessUri            = ConstructODataUriWithoutActionInformation(this.entityModelSchema.GetDefaultEntityContainer().EntitySets, request.Uri);
            bool      entitySetFound           = actionLessUri.TryGetExpectedEntitySet(out expectedBindingEntitySet);

            ExceptionUtilities.Assert(entitySetFound, "EntitySet not found for Uri {0}", actionLessUri.ToString());

            // SDP never applies for actions
            var preActionQueryValueResult = this.ODataUriEvaluator.Evaluate(actionLessUri, true, false);

            IDictionary <string, QueryValue> queryValueParametersLookup = new Dictionary <string, QueryValue>();

            if (request.Body != null)
            {
                queryValueParametersLookup = this.CreateQueryValueParameters(request, functionSegment, queryValueParametersLookup);
            }

            var            expected           = verifyServiceQueryResult.GetExpectedQueryValue(preActionQueryValueResult, queryValueParametersLookup.Values.ToArray());
            HttpStatusCode expectedStatusCode = CalculateExpectedStatusCode(functionSegment);

            string expectedETag = null;

            SyncHelpers.ExecuteActionAndWait(c => this.Synchronizer.SynchronizeEntireEntitySet(c, expectedBindingEntitySet.Name));

            expectedETag = this.VerifyExpected(request, response, expected, expectedStatusCode, expectedETag);

            ETagHeaderVerifier etagHeaderVerifier = new ETagHeaderVerifier();

            etagHeaderVerifier.Verify(expectedETag, request, response);
        }