/// <summary> /// Validator for stream properties in requests. /// </summary> /// <param name="payloadElement">The payload element to validate.</param> /// <param name="testConfigLimits">The test configuration limits to modify.</param> public static void StreamPropertyValidator(ODataPayloadElement payloadElement, TestConfigurationLimits testConfigLimits) { ExceptionUtilities.Assert(payloadElement is NamedStreamInstance, "This validator only works on stream properties."); // Stream properties are not allowed in requests. testConfigLimits.DisallowRequest(); // Stream properties are only allowed in >=V3 requests. testConfigLimits.RaiseMinPayloadVersion(ODataVersion.V4); }
/// <summary> /// Validator for actions and functions. /// </summary> /// <param name="payloadElement">The payload element to validate.</param> /// <param name="testConfigLimits">The test configuration limits to modify.</param> public static void ActionAndFunctionValidator(ODataPayloadElement payloadElement, TestConfigurationLimits testConfigLimits) { EntityInstance entityInstance = payloadElement as EntityInstance; ExceptionUtilities.Assert(entityInstance != null, "This validator only works on entity instances."); if (entityInstance.ServiceOperationDescriptors.Any()) { // Actions and Functions require V3 response payloads. testConfigLimits.DisallowRequest(); testConfigLimits.RaiseMinPayloadVersion(ODataVersion.V4); } }
/// <summary> /// Validator for stream properties in requests. /// </summary> /// <param name="payloadElement">The payload element to validate.</param> /// <param name="testConfigLimits">The test configuration limits to modify.</param> public static void AssociationLinkValidator(ODataPayloadElement payloadElement, TestConfigurationLimits testConfigLimits) { NavigationPropertyInstance navigationProperty = payloadElement as NavigationPropertyInstance; ExceptionUtilities.Assert(navigationProperty != null, "This validator only works on navigation properties."); if (navigationProperty.AssociationLink != null) { // Association links are not allowed in requests. testConfigLimits.DisallowRequest(); // Association links can only be read if MPV >= V3, they are recognized even in <V3 payloads // but we don't have a way to specify this here, so just mark them as >=V3 as well. testConfigLimits.RaiseMinPayloadVersion(ODataVersion.V4); } }