public void TestJson() {
            var json = @"{ 'thing1':'System.Int16', 'thing2':'System.Int16' }".Replace("'", "\"");

            var cfg = new Pm(json);

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

            var problems = cfg.Errors();
            Assert.AreEqual(1, problems.Length);
            Assert.AreEqual("The root element has an invalid value of 'System.Int16' in the 'thing1' attribute.  The valid domain is: int16.", problems[0]);
            Assert.AreEqual("System.Int16", cfg.Thing1);
            Assert.AreEqual("int16", cfg.Thing2);

        }
Beispiel #2
0
        public void TestJson()
        {
            var json = @"{ 'thing1':'System.Int16', 'thing2':'System.Int16' }".Replace("'", "\"");

            var cfg = new Pm(json);

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

            var problems = cfg.Errors();

            Assert.AreEqual(1, problems.Length);
            Assert.AreEqual("The root element has an invalid value of 'System.Int16' in the 'thing1' attribute.  The valid domain is: int16.", problems[0]);
            Assert.AreEqual("System.Int16", cfg.Thing1);
            Assert.AreEqual("int16", cfg.Thing2);
        }
        public void TestXml() {
            var xml = @"
    <cfg thing1='System.Int16' thing2='System.Int16'>
    </cfg>
".Replace("'", "\"");

            var cfg = new Pm(xml);

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

            var problems = cfg.Errors();
            Assert.AreEqual(1, problems.Length);
            Assert.AreEqual("An invalid value of 'System.Int16' is in the 'thing1' attribute.  The valid domain is: int16.", problems[0]);
            Assert.AreEqual("System.Int16", cfg.Thing1);
            Assert.AreEqual("int16", cfg.Thing2);

        }
Beispiel #4
0
        public void TestXml()
        {
            var xml = @"
    <cfg thing1='System.Int16' thing2='System.Int16'>
    </cfg>
".Replace("'", "\"");

            var cfg = new Pm(xml);

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

            var problems = cfg.Errors();

            Assert.AreEqual(1, problems.Length);
            Assert.AreEqual("An invalid value of System.Int16 is in thing1.  The valid domain is: int16.", problems[0]);
            Assert.AreEqual("System.Int16", cfg.Thing1);
            Assert.AreEqual("int16", cfg.Thing2);
        }