Inheritance: ValueObjectBase
コード例 #1
0
        public void UserValidatorTest() {
            var user = new User()
                       {
                           Id = "debop",
                           Password = "******",
                           Name = "배성혁",
                           LastAccessTime = DateTime.Today
                       };

            var result = ValidatorTool.Validate(user);

            result.IsValid.Should().Be.True();
            result.Errors.Count.Should().Be(0);

            foreach(var failure in result.Errors) {
                Console.WriteLine(failure);
            }

            user = new User()
                   {
                       Id = "debop",
                       Password = "******",
                       Name = "배성혁",
                       LastAccessTime = DateTime.Today.AddYears(1)
                   };

            result = ValidatorTool.Validate(user);

            result.IsValid.Should().Be.False();
            result.Errors.Count.Should().Be.GreaterThan(0);

            foreach(var failure in result.Errors) {
                Console.WriteLine(failure);
            }
        }
コード例 #2
0
        public void GetValidatorOfTest() {
            var customer = new Customer();
            var validator = ValidatorTool.GetValidatorOf(customer);
            validator.Should().Not.Be.Null();

            var user = new User();
            validator = ValidatorTool.GetValidatorOf(user);
            validator.Should().Not.Be.Null();
        }