public void Test_value_required_for_decimal()
        {
            var user = new User();

            user.Name = "Fernando";
            user.Tags = new List<string> { "a", "b" };
            user.HairLength = 0.1m;

            var result = user.Validate();

            Assert.That(result.IsSuccess, Is.True);
        }
        public void Test_pattern_regex()
        {
            var user = new User();

            user.Name = "Fernando";
            user.Tags = new List<string> { "a", "b" };
            user.HairLength = 0.1m;

            var result = user.Validate();

            Assert.That(result.IsSuccess, Is.True);

            user.Name = "Fernando1";

            result = user.Validate();

            Assert.That(result.IsSuccess, Is.False);
        }
        public void Test_value_constraint_for_nullable_types()
        {
            var person = new User();
            person.Name = null;
            person.Tags = new List<string>() { "a" };
            person.HairLength = 0.1m;

            person.Length = 10;
            var results = person.Validate();
            Assert.That(results.IsSuccess, Is.True);

            person.Length = 0;
            results = person.Validate();
            Assert.That(results.IsSuccess, Is.False);

            person.Length = null;
            results = person.Validate();
            Assert.That(results.IsSuccess, Is.True);

            person.Length = -1;
            results = person.Validate();
            Assert.That(results.IsSuccess, Is.False);
        }
        public void Test_default_value_with_User()
        {
            var user = new User();

            user.Name = null;
            user.Tags = new List<string>() { "a" };
            user.HairLength = 0.1m;

            var result = user.Validate();

            Assert.That(result.IsSuccess, Is.True);

            Assert.AreEqual("Fernando", user.Name);
        }