/// <summary> /// Verify Common.Core.4037 /// </summary> /// <param name="context">Service context</param> /// <param name="info">out parameter to return violation information when rule fail</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; string OdataNextLink = Constants.V4OdataNextLink; if (context.Version == ODataVersion.V3) { OdataNextLink = Constants.OdataNextLink; } string OdataDeltaLink = Constants.V4OdataDeltaLink; if (context.Version == ODataVersion.V3) { OdataDeltaLink = Constants.V4OdataDeltaLink; } // Verify whether odata.nextLink annotation in response. bool isnextLinkExist = JsonParserHelper.IsSpecifiedAnnotationExist(context, OdataNextLink); // Verify whether odata.deltaLink annotation in response. bool isdeltaLinkExist = JsonParserHelper.IsSpecifiedAnnotationExist(context, OdataDeltaLink); // If odata.deltaLink annotation in response. if (isdeltaLinkExist) { // The odata.nextLink annotation must not exist in response. if (!isnextLinkExist) { passed = true; } else { passed = false; info = new ExtensionRuleViolationInfo(this.ErrorMessage, context.Destination, context.ResponsePayload); } } return(passed); }
/// <summary> /// Verify Common.Core.4038 /// </summary> /// <param name="context">Service context</param> /// <param name="info">out parameter to return violation information when rule fail</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; string OdataNextLink = Constants.V4OdataNextLink; if (context.Version == ODataVersion.V3) { OdataNextLink = Constants.OdataNextLink; } string OdataDeltaLink = Constants.V4OdataDeltaLink; if (context.Version == ODataVersion.V3) { OdataDeltaLink = Constants.V4OdataDeltaLink; } // Verify whether odata.nextLink annotation in response. bool isnextLinkExist = JsonParserHelper.IsSpecifiedAnnotationExist(context, OdataNextLink); // Verify whether odata.deltaLink annotation in response. bool isdeltaLinkExist = JsonParserHelper.IsSpecifiedAnnotationExist(context, OdataDeltaLink); // Response must not have both an odata.deltaLink annotation and an odata.nextLink annotation. if (isnextLinkExist && isdeltaLinkExist) { passed = false; } else { passed = true; } return(passed); }