コード例 #1
0
        public void registers_rules()
        {
            var a1 = ReflectionHelper.GetAccessor<RuleGraphModel>(x => x.FirstName);
            var a2 = ReflectionHelper.GetAccessor<RuleGraphModel>(x => x.LastName);

            var r1 = new RequiredFieldRule();
            var r2 = new MinimumLengthRule(5);

            theGraph.RegisterRule(a1, r1);
            theGraph.RegisterRule(a1, r2);

            theGraph.RegisterRule(a2, r1);

            theGraph.RulesFor(a1).ShouldHaveTheSameElementsAs(RemoteFieldRule.For(a1, r1), RemoteFieldRule.For(a1, r2));
            theGraph.RulesFor(a2).ShouldHaveTheSameElementsAs(RemoteFieldRule.For(a2, r1));
        }
コード例 #2
0
 protected bool Equals(MinimumLengthRule other)
 {
     return _length == other._length && Token.Equals(other.Token);
 }
コード例 #3
0
 protected bool Equals(MinimumLengthRule other)
 {
     return(_length == other._length && Token.Equals(other.Token));
 }