예제 #1
0
        public void ValidatableObject_IsNotNullOrEmpty_Success()
        {
            //arrange
            var stud = new TestWrapperStud();

            stud.Name = "Name1";
            stud.Age  = 15;

            //act
            var result = stud.ToValidatableObject(null);

            result.Should().BeOfType(typeof(ValidatableObject <TestWrapperStud>));
            result.Value.Age.Should().Be(stud.Age);
            result.Value.Name.Should().Be(stud.Name);
        }
예제 #2
0
        public void ValidatableObject_AddingRulesAddsRules_Success()
        {
            //arrange
            var stud = new TestWrapperStud();

            stud.Name = "Name1";
            stud.Age  = 15;
            var rule = new IsValidConditionRule <TestWrapperStud>().Ensure(e => e.Age != 100);

            //act
            var result = stud.ToValidatableObject(() => rule);

            result.Should().BeOfType(typeof(ValidatableObject <TestWrapperStud>));
            result.Value.Age.Should().Be(stud.Age);
            result.Value.Name.Should().Be(stud.Name);
        }