public void GetExpressionShouldReturnAnExpressionWhichReturnsTrueForAResultWhichMatchesTheCurrentContextWithAValue([ManifestModel] ManifestRule rule,
                                                                                                                           [RuleId] RuleIdentifier ruleIdentifier,
                                                                                                                           object actualValue,
                                                                                                                           Type ruleInterface,
                                                                                                                           [RuleResult] RuleResult ruleResult,
                                                                                                                           IValidationLogic logic)
        {
            ((ManifestValueBase)rule.ManifestValue).IdentityAccessor = null;
            var context = new RuleContext(rule, ruleIdentifier, actualValue, Enumerable.Empty <ValueContext>(), ruleInterface);
            var validationRuleResult = new ValidationRuleResult(ruleResult, context, logic);
            var sut = new RuleResultIsForDescendentOfValue(rule.ManifestValue, actualValue);

            Assert.That(() => sut.Matches(validationRuleResult), Is.True);
        }
        public void GetExpressionShouldReturnAnExpressionWhichReturnsFalseForAResultWhichMatchesAnAncestorContextWhenAllowAncestorsIsFalse([ManifestModel] ManifestValue value,
                                                                                                                                           [ManifestModel] ManifestValue otherValue,
                                                                                                                                           [ManifestModel] ManifestRule rule,
                                                                                                                                           [RuleId] RuleIdentifier ruleIdentifier,
                                                                                                                                           object identity,
                                                                                                                                           object actualValue,
                                                                                                                                           Type ruleInterface,
                                                                                                                                           [RuleResult] RuleResult ruleResult,
                                                                                                                                           IValidationLogic logic)
        {
            value.IdentityAccessor = null;
            var context = new RuleContext(rule, ruleIdentifier, actualValue, new [] { new ValueContext(identity, actualValue, value) }, ruleInterface);
            var validationRuleResult = new ValidationRuleResult(ruleResult, context, logic);
            var sut = new RuleResultIsForDescendentOfValue(value, false);

            Assert.That(() => sut.Matches(validationRuleResult), Is.False);
        }
Пример #3
0
 public Task <string> GetFailureMessageAsync(string val1, object val2, ValidationRuleResult result, CancellationToken token = default)
 => throw new System.NotImplementedException();