コード例 #1
0
        //* Private Properties
        private void testValidValidation(string value)
        {
            var test = new MultipleAttributesTestClass(value);

            Assert.IsTrue(test.Validate());
            Assert.IsTrue(test.Errors.Count == 0);
        }
コード例 #2
0
        public void SingleValidTest()
        {
            var test = new MultipleAttributesTestClass("@");

            Assert.IsFalse(test.Validate());
            Assert.IsTrue(test.Errors.Count == 1);
            Assert.IsTrue(test.Errors.Contains($"{nameof(test.Value)} too short"));
        }
コード例 #3
0
        public void BothInvalidTest()
        {
            var test = new MultipleAttributesTestClass("");

            Assert.IsFalse(test.Validate());
            Assert.IsTrue(test.Errors.Count == 2);
            Assert.IsTrue(test.Errors.Contains($"{nameof(test.Value)} is invalid as it" +
                                               " does not contain a '@'"));
            Assert.IsTrue(test.Errors.Contains($"{nameof(test.Value)} too short"));
        }