Exemplo n.º 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);
        }
Exemplo n.º 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);
        }