예제 #1
0
        public async Task GetValidationResultsAsync_Returns_Association_Property_With_Nested_Rules()
        {
            var ruleWithAssociation = new FalseRuleWithAssociation("Address");
            var rules = new List <IRule>
            {
                new TrueRule().IfValidThenValidate(ruleWithAssociation), new TrueRule()
            };

            var results = await rules.GetValidationResultsAsync();

            results.First().MemberNames.First().ShouldBe("Address");
        }
        public void GetValidationResults_Of_T_Returns_Association_Property_With_Nested_Rules()
        {
            var ruleWithAssociation = new FalseRuleWithAssociation("Address");
            var rules = new List <IRule>
            {
                new TrueRule().IfValidThenValidate(ruleWithAssociation), new TrueRule()
            };

            var results = rules.GetValidationResults <CustomValidationResult>();

            results.First().MemberNames.First().ShouldBe("Address");
        }