Ejemplo n.º 1
0
        public void throws_when_targeting_messages_to_an_unknown_accessor()
        {
            var rule     = FieldEqualityRule.For <FieldEqualityTarget>(x => x.Value1, x => x.Value2);
            var accessor = SingleProperty.Build <FieldEqualityTarget>(x => x.Other);

            Exception <ArgumentOutOfRangeException>
            .ShouldBeThrownBy(() => rule.ReportMessagesFor(accessor));
        }
Ejemplo n.º 2
0
        public void SetUp()
        {
            token1 = StringToken.FromKeyString("TestKeys:Key1", "Token 1");
            token2 = StringToken.FromKeyString("TestKeys:Key2", "Token 2");

            rule1       = FieldEqualityRule.For <LoFiTarget>(x => x.Value1, x => x.Value2);
            rule1.Token = token1;

            rule2       = FieldEqualityRule.For <LoFiTarget>(x => x.Value1, x => x.Value2);
            rule2.Token = token2;

            var source = new ConfiguredValidationSource(new IValidationRule[] { rule1, rule2 });

            theValidationGraph = ValidationGraph.For(source);

            theGraph = BehaviorGraph.BuildFrom(x =>
            {
                x.Actions.IncludeType <FormValidationModeEndpoint>();
                x.Import <FubuMvcValidation>();
            });
        }
		public void SetUp()
		{
			theTarget = new FieldEqualityTarget();
			theRule = FieldEqualityRule.For<FieldEqualityTarget>(t => t.Value1, t => t.Value2);
		}
Ejemplo n.º 4
0
 public void uses_the_default_token()
 {
     FieldEqualityRule.For <FieldEqualityTarget>(t => t.Value1, t => t.Value2)
     .Token.ShouldEqual(ValidationKeys.FieldEquality);
 }
Ejemplo n.º 5
0
 public void throws_when_property_types_do_not_match()
 {
     Exception <InvalidOperationException>
     .ShouldBeThrownBy(() => FieldEqualityRule.For <FieldEqualityTarget>(x => x.Value1, x => x.DifferentType));
 }
Ejemplo n.º 6
0
 public void SetUp()
 {
     theTarget = new FieldEqualityTarget();
     theRule   = FieldEqualityRule.For <FieldEqualityTarget>(t => t.Value1, t => t.Value2);
 }