Example #1
0
        public void TestXml()
        {
            var xml = @"
    <test>
        <things>
            <add value='this-GOOD-value' />
            <add value='BAD-value' />
        </things>
    </test>
".Replace("'", "\"");

            var cfg = new TestValidatorCfg(xml);

            foreach (var problem in cfg.Errors())
            {
                Console.WriteLine(problem);
            }

            var problems = cfg.Errors();

            Assert.AreEqual(1, problems.Length);
            Assert.AreEqual(
                "The value 'BAD-value' in the 'value' attribute is no good! It does not have two dashes like we agreed on.",
                problems[0]);
        }
Example #2
0
        public void TestJson() {
            var json = @"{
        'things': [
            { 'value':'this-GOOD-value' },
            { 'value':'BAD-value' }
        ]
    }".Replace("'", "\"");

            var cfg = new TestValidatorCfg(json);

            foreach (var problem in cfg.Errors()) {
                Console.WriteLine(problem);
            }

            var problems = cfg.Errors();
            Assert.AreEqual(1, problems.Length);
            Assert.AreEqual(
                "The value 'bad-value' in the 'value' attribute is no good! It does not have two dashes like we agreed on.",
                problems[0]);

        }
Example #3
0
        public void TestJson()
        {
            var json = @"{
        'things': [
            { 'value':'this-GOOD-value' },
            { 'value':'BAD-value' }
        ]
    }".Replace("'", "\"");

            var cfg = new TestValidatorCfg(json);

            foreach (var problem in cfg.Errors())
            {
                Console.WriteLine(problem);
            }

            var problems = cfg.Errors();

            Assert.AreEqual(1, problems.Length);
            Assert.AreEqual("The value 'BAD-value' in the 'value' attribute is no good! It does not have two dashes like we agreed on.", problems[0]);
        }
Example #4
0
        public void TestXml() {
            var xml = @"
    <test>
        <things>
            <add value='this-GOOD-value' />
            <add value='BAD-value' />
        </things>
    </test>
".Replace("'", "\"");

            var cfg = new TestValidatorCfg(xml);

            foreach (var problem in cfg.Errors()) {
                Console.WriteLine(problem);
            }

            var problems = cfg.Errors();
            Assert.AreEqual(1, problems.Length);
            Assert.AreEqual(
                "The value 'bad-value' in the 'value' attribute is no good! It does not have two dashes like we agreed on.",
                problems[0]);

        }