예제 #1
0
        public void Source_WithNamedValidateNoSetup_ShouldNotBeNull()
        {
            var sut = new ValidationConfigurationSource();

            sut.Validate<Customer>("group", x=> {});

            var configuration = sut.Source();

            configuration.ShouldNotBeNull();

            configuration.Items.ShouldNotBeNull();

            configuration.Items.ShouldBeEmpty();
        }
예제 #2
0
        public void Source_WithNamedValidateCreateWhen_ShouldBeOne()
        {
            var sut = new ValidationConfigurationSource();

            sut.Validate<Customer>("group", x => { x.With<CustomerValidator>().When(y=>y.Age>10); });

            var configuration = sut.Source();

            configuration.ShouldNotBeNull();

            configuration.Items.ShouldNotBeNull();

            configuration.Items.Count.ShouldBe(1);

            configuration.Items[0].GroupName = "Group";

            configuration.Items[0].TargetType.ShouldBe(typeof(Customer));

            configuration.Items[0].ResultType.ShouldBe(typeof(CustomerValidator));

            configuration.Items[0].Selector.ShouldNotBeNull();
        }
예제 #3
0
        public void Source_WithValidateWithWhen_ShouldNotBeNull()
        {
            var sut = new ValidationConfigurationSource();

            sut.Validate<Customer>().With<CustomerValidator>().When(x=>x.Age>10);

            var configuration = sut.Source();

            configuration.ShouldNotBeNull();

            configuration.Items.ShouldNotBeNull();

            configuration.Items.Count.ShouldBe(1);

            configuration.Items[0].TargetType.ShouldBe(typeof(Customer));

            configuration.Items[0].ResultType.ShouldBe(typeof(CustomerValidator));

            configuration.Items[0].Selector.ShouldNotBeNull();
        }