/// <summary>
        /// Verifies the extension rule.
        /// </summary>
        /// <param name="context">The Interop service context</param>
        /// <param name="info">out parameter to return violation information when rule does not pass</param>
        /// <returns>true if rule passes; false otherwise</returns>
        public override bool?Verify(ServiceContext context, out ExtensionRuleViolationInfo info)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            bool?passed = null;

            info = null;

            HttpStatusCode?statusCode1 = VerificationHelper.VerifySortEntities(context, SortedType.ASC, out passed, out info);

            if (info != null)
            {
                info.SetDetailsName(this.Name);
            }
            if (true != passed)
            {
                return(passed);
            }

            HttpStatusCode?statusCode2 = VerificationHelper.VerifySortEntities(context, SortedType.DESC, out passed, out info);

            if (info != null)
            {
                info.SetDetailsName(this.Name);
            }

            return(passed);
        }
        /// <summary>
        /// Verifies the extension rule.
        /// </summary>
        /// <param name="context">The Interop service context</param>
        /// <param name="info">out parameter to return violation information when rule does not pass</param>
        /// <returns>true if rule passes; false otherwise</returns>
        public override bool?Verify(ServiceContext context, out ExtensionRuleViolationInfo info)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            bool?passed = null;

            info = null;

            HttpStatusCode?statusCode1 = VerificationHelper.VerifyCanonicalFunction(context, CanonicalFunctionType.Supported, out passed, out info);

            if (true != passed)
            {
                if (info != null)
                {
                    info.SetDetailsName(this.Name);
                }
                return(passed);
            }

            HttpStatusCode?statusCode2 = VerificationHelper.VerifyCanonicalFunction(context, CanonicalFunctionType.Unsupported, out passed, out info);

            passed = statusCode2 == HttpStatusCode.NotImplemented ? true : false;
            if (info != null)
            {
                info.SetDetailsName(this.Name);
            }

            return(passed);
        }
예제 #3
0
        /// <summary>
        /// Verifies the extension rule.
        /// </summary>
        /// <param name="context">The Interop service context</param>
        /// <param name="info">out parameter to return violation information when rule does not pass</param>
        /// <returns>true if rule passes; false otherwise</returns>
        public override bool?Verify(ServiceContext context, out ExtensionRuleViolationInfo info)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            bool?passed = null;

            info = null;

            // Verify the lambda operator "any".
            HttpStatusCode?statusCode1 = VerificationHelper.VerifyLambdaOperators(context, LambdaOperatorType.Any, out passed, out info);

            if (info != null)
            {
                info.SetDetailsName(this.Name);
            }
            if (true != passed)
            {
                return(passed);
            }

            // Verify the lambda operator "all".
            HttpStatusCode?statusCode2 = VerificationHelper.VerifyLambdaOperators(context, LambdaOperatorType.All, out passed, out info);

            if (info != null)
            {
                info.SetDetailsName(this.Name);
            }

            return(passed);
        }
예제 #4
0
        /// <summary>
        /// Verifies the extension rule.
        /// </summary>
        /// <param name="context">The Interop service context</param>
        /// <param name="info">out parameter to return violation information when rule does not pass</param>
        /// <returns>true if rule passes; false otherwise</returns>
        public override bool?Verify(ServiceContext context, out ExtensionRuleViolationInfo info)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            info = null;
            List <ExtensionRuleResultDetail> details = new List <ExtensionRuleResultDetail>();
            ExtensionRuleViolationInfo       info1 = null, info2 = null;

            bool?isVerifySortEntitiesOrderByAsc  = VerificationHelper.VerifySortEntities(context, SortedType.ASC, out info1);
            bool?isVerifySortEntitiesOrderByDesc = VerificationHelper.VerifySortEntities(context, SortedType.DESC, out info2);

            if (info1 != null)
            {
                details.AddRange(info1.Details);
            }
            if (info2 != null)
            {
                details.AddRange(info2.Details);
            }

            info = new ExtensionRuleViolationInfo(context.Destination, context.ResponsePayload, details);
            info.SetDetailsName(this.Name);

            return(true == isVerifySortEntitiesOrderByAsc && true == isVerifySortEntitiesOrderByDesc);
        }
        /// <summary>
        /// Verifies the extension rule.
        /// </summary>
        /// <param name="context">The Interop service context</param>
        /// <param name="info">out parameter to return violation information when rule does not pass</param>
        /// <returns>true if rule passes; false otherwise</returns>
        public override bool?Verify(ServiceContext context, out ExtensionRuleViolationInfo info)
        {
            bool?passed = null;

            info = null;
            HttpStatusCode?statusCode = VerificationHelper.VerifyCount(context, out passed, out info);

            if (info != null)
            {
                info.SetDetailsName(this.Name);
            }

            return(passed);
        }
        /// <summary>
        /// Verifies the extension rule.
        /// </summary>
        /// <param name="context">The Interop service context</param>
        /// <param name="info">out parameter to return violation information when rule does not pass</param>
        /// <returns>true if rule passes; false otherwise</returns>
        public override bool?Verify(ServiceContext context, out ExtensionRuleViolationInfo info)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            bool svcDocResult        = false;
            bool metadataResult      = false;
            bool errorResponseResult = false;
            bool feedAndEntryResult  = false;
            ExtensionRuleViolationInfo       infoForOne = null;
            List <ExtensionRuleResultDetail> details    = new List <ExtensionRuleResultDetail>();

            svcDocResult = VerificationHelper.VerifySvcDoc(context, out infoForOne);
            if (infoForOne != null)
            {
                details.AddRange(infoForOne.Details);
            }

            metadataResult = VerificationHelper.VerifyMetadata(context, out infoForOne);
            if (infoForOne != null)
            {
                details.AddRange(infoForOne.Details);
            }

            errorResponseResult = VerificationHelper.VerifyError(context, out infoForOne);
            if (infoForOne != null)
            {
                details.AddRange(infoForOne.Details);
            }

            feedAndEntryResult = true; //Test Removed - Stuart.  Delete this line if the test is restored.
                                       //feedAndEntryResult = VerificationHelper.VerifyFeedAndEntry(context, out infoForOne);
                                       //if (infoForOne != null)
                                       //{
                                       //    details.AddRange(infoForOne.Details);
                                       //}



            info = new ExtensionRuleViolationInfo(context.Destination, context.ResponsePayload, details);
            info.SetDetailsName(this.Name);

            return(svcDocResult && metadataResult && feedAndEntryResult && errorResponseResult);
        }
        /// <summary>
        /// Verifies the extension rule.
        /// </summary>
        /// <param name="context">The Interop service context</param>
        /// <param name="info">out parameter to return violation information when rule does not pass</param>
        /// <returns>true if rule passes; false otherwise</returns>
        public override bool?Verify(ServiceContext context, out ExtensionRuleViolationInfo info)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            bool?passed = null;

            info = null;
            VerificationHelper.VerifySearch(context, out passed, out info);
            if (info != null)
            {
                info.SetDetailsName(this.Name);
            }

            return(passed);
        }
예제 #8
0
        /// <summary>
        /// Verifies the extension rule.
        /// </summary>
        /// <param name="context">The Interop service context</param>
        /// <param name="info">out parameter to return violation information when rule does not pass</param>
        /// <returns>true if rule passes; false otherwise</returns>
        public override bool?Verify(ServiceContext context, out ExtensionRuleViolationInfo info)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            bool?passed = true;

            info = null;
            bool?result;
            List <ExtensionRuleResultDetail> details = new List <ExtensionRuleResultDetail>();

            // call helper method
            ExtensionRuleViolationInfo info1        = null;
            HttpStatusCode?            selectResult = VerificationHelper.VerifySelect(context, out result, out info1);

            if (info1 != null)
            {
                info1.SetDetailsName(this.Name);
                details.AddRange(info1.Details);
            }
            if (false == result || !(selectResult.HasValue && (selectResult.Value == HttpStatusCode.OK || selectResult.Value == HttpStatusCode.NotImplemented)))
            {
                passed = false;
            }

            ExtensionRuleViolationInfo info2        = null;
            HttpStatusCode?            searchResult = VerificationHelper.VerifySearch(context, out result, out info2);

            if (info2 != null)
            {
                info2.SetDetailsName(this.Name);
                details.AddRange(info2.Details);
            }
            if (false == result || !(searchResult.HasValue && (searchResult.Value == HttpStatusCode.OK || searchResult.Value == HttpStatusCode.NotImplemented)))
            {
                passed = false;
            }

            ExtensionRuleViolationInfo info3        = null;
            HttpStatusCode?            filterResult = VerificationHelper.VerifyLambdaOperators(context, LambdaOperatorType.All, out result, out info3);

            if (info3 != null)
            {
                info3.SetDetailsName(this.Name);
                details.AddRange(info3.Details);
            }
            if (false == result || !(filterResult.HasValue && (filterResult.Value == HttpStatusCode.OK || filterResult.Value == HttpStatusCode.NotImplemented)))
            {
                passed = false;
            }

            ExtensionRuleViolationInfo info4       = null;
            HttpStatusCode?            countResult = VerificationHelper.VerifyCount(context, out result, out info4);

            if (info4 != null)
            {
                info4.SetDetailsName(this.Name);
                details.AddRange(info4.Details);
            }
            if (false == result || !(countResult.HasValue && (countResult.Value == HttpStatusCode.OK || countResult.Value == HttpStatusCode.NotImplemented)))
            {
                passed = false;
            }

            ExtensionRuleViolationInfo info5      = null;
            HttpStatusCode?            skipResult = VerificationHelper.VerifySkip(context, out result, out info5);

            if (info5 != null)
            {
                info5.SetDetailsName(this.Name);
                details.AddRange(info5.Details);
            }
            if (false == result || !(skipResult.HasValue && (skipResult.Value == HttpStatusCode.OK || skipResult.Value == HttpStatusCode.NotImplemented)))
            {
                passed = false;
            }

            ExtensionRuleViolationInfo info6     = null;
            HttpStatusCode?            topResult = VerificationHelper.VerifyTop(context, out result, out info6);

            if (info6 != null)
            {
                info6.SetDetailsName(this.Name);
                details.AddRange(info6.Details);
            }
            if (false == result || !(topResult.HasValue && (topResult.Value == HttpStatusCode.OK || topResult.Value == HttpStatusCode.NotImplemented)))
            {
                passed = false;
            }

            ExtensionRuleViolationInfo info7         = null;
            HttpStatusCode?            orderbyResult = VerificationHelper.VerifySortEntities(context, SortedType.ASC, out result, out info7);

            if (info7 != null)
            {
                info7.SetDetailsName(this.Name);
                details.AddRange(info7.Details);
            }
            if (false == result || !(orderbyResult.HasValue && (orderbyResult.Value == HttpStatusCode.OK || orderbyResult.Value == HttpStatusCode.NotImplemented)))
            {
                passed = false;
            }

            if (passed == null)
            {
                passed = true;
            }

            info = new ExtensionRuleViolationInfo(this.ErrorMessage, context.Destination, context.ResponsePayload, details);
            return(passed);
        }
        /// <summary>
        /// Verifies the extension rule.
        /// </summary>
        /// <param name="context">The Interop service context</param>
        /// <param name="info">out parameter to return violation information when rule does not pass</param>
        /// <returns>true if rule passes; false otherwise</returns>
        public override bool?Verify(ServiceContext context, out ExtensionRuleViolationInfo info)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            bool svcDocResult          = false;
            bool metadataResult        = false;
            bool feedAndEntryResult    = false;
            bool referenceResult       = false;
            bool propertyResult        = false;
            bool collectionCountResult = false;
            bool derivedTypeResult     = false;
            bool mediaStreamResult     = false;
            bool crossJoinResult       = false;
            bool allEntitiesResult     = false;
            ExtensionRuleViolationInfo       infoForOne = null;
            List <ExtensionRuleResultDetail> details    = new List <ExtensionRuleResultDetail>();

            svcDocResult = VerificationHelper.VerifySvcDoc(context, out infoForOne);
            if (infoForOne != null)
            {
                details.AddRange(infoForOne.Details);
            }

            metadataResult = VerificationHelper.VerifyMetadata(context, out infoForOne);
            if (infoForOne != null)
            {
                details.AddRange(infoForOne.Details);
            }

            feedAndEntryResult = VerificationHelper.VerifyFeedAndEntry(context, out infoForOne);
            if (infoForOne != null)
            {
                details.AddRange(infoForOne.Details);
            }

            referenceResult = VerificationHelper.VerifyReference(context, out infoForOne);
            if (infoForOne != null)
            {
                details.AddRange(infoForOne.Details);
            }

            propertyResult = VerificationHelper.VerifyPropertyAndValue(context, out infoForOne);
            if (infoForOne != null)
            {
                details.AddRange(infoForOne.Details);
            }

            collectionCountResult = VerificationHelper.VerifyCollectionCount(context, out infoForOne);
            if (infoForOne != null)
            {
                details.AddRange(infoForOne.Details);
            }

            derivedTypeResult = VerificationHelper.VerifyDerivedType(context, out infoForOne);
            if (infoForOne != null)
            {
                details.AddRange(infoForOne.Details);
            }

            mediaStreamResult = VerificationHelper.VerifyMediaStream(context, out infoForOne);
            if (infoForOne != null)
            {
                details.AddRange(infoForOne.Details);
            }

            crossJoinResult = VerificationHelper.VerifyCrossJoin(context, out infoForOne);
            if (infoForOne != null)
            {
                details.AddRange(infoForOne.Details);
            }

            allEntitiesResult = VerificationHelper.VerifyAllEntities(context, out infoForOne);
            if (infoForOne != null)
            {
                details.AddRange(infoForOne.Details);
            }

            info = new ExtensionRuleViolationInfo(context.Destination, context.ResponsePayload, details);
            info.SetDetailsName(this.Name);

            return(svcDocResult && metadataResult && feedAndEntryResult && referenceResult && propertyResult &&
                   collectionCountResult && derivedTypeResult && mediaStreamResult && crossJoinResult && allEntitiesResult);
        }