Exemplo n.º 1
0
        public void GetValueAccessorBuilderShouldReturnAnAccessorBuilder([ManifestModel] ValidatorBuilderContext context,
                                                                         IGetsRuleBuilder ruleBuilderFactory,
                                                                         IGetsValidatorManifest validatorManifestFactory,
                                                                         IGetsValidatorBuilderContext contextFactory)
        {
            var sut = new ValueAccessorBuilderFactory(() => ruleBuilderFactory, () => validatorManifestFactory, () => contextFactory);

            Assert.That(() => sut.GetValueAccessorBuilder <ValidatedObject, string>(context, c => { }), Is.Not.Null);
        }
Exemplo n.º 2
0
        public void GetValueAccessorBuilderShouldExecuteConfigurationUponBuilder([ManifestModel] ValidatorBuilderContext context,
                                                                                 IGetsRuleBuilder ruleBuilderFactory,
                                                                                 IGetsValidatorManifest validatorManifestFactory,
                                                                                 IGetsValidatorBuilderContext contextFactory)
        {
            var sut = new ValueAccessorBuilderFactory(() => ruleBuilderFactory, () => validatorManifestFactory, () => contextFactory);

            sut.GetValueAccessorBuilder <ValidatedObject, string>(context, c => c.AddRuleWithParent <StringValueRule>());
            Mock.Get(ruleBuilderFactory)
            .Verify(x => x.GetRuleBuilder <StringValueRule>(context, It.IsAny <Action <IConfiguresRule <StringValueRule> > >()), Times.Once);
        }