Ejemplo n.º 1
0
        public void ShouldBeInitialized()
        {
            var cfg = new EmptyListCfg();

            Assert.IsNotNull(cfg.Connections);
            Assert.AreEqual(0, cfg.Connections.Count);
            Assert.IsNullOrEmpty(cfg.NullProperty);
            Assert.IsNotNull(cfg.DefaultedProperty);
            Assert.AreEqual("Default", cfg.DefaultedProperty);
        }
Ejemplo n.º 2
0
        public void TestConnectionsJson() {
            var json = "{}";

            var cfg = new EmptyListCfg(json);
            var problems = cfg.Errors();

            Assert.AreEqual(0, problems.Length);
            Assert.IsNotNull(cfg.Connections);
            Assert.AreEqual(0, cfg.Connections.Count);

        }
Ejemplo n.º 3
0
        public void TestConnectionsJson()
        {
            var json = "{}";

            var cfg      = new EmptyListCfg(json);
            var problems = cfg.Errors();

            Assert.AreEqual(0, problems.Length);
            Assert.IsNotNull(cfg.Connections);
            Assert.AreEqual(0, cfg.Connections.Count);
        }
Ejemplo n.º 4
0
        public void TestConnectionsXml() {
            var xml = @"
                <cfg>
                </cfg>
            ".Replace("'", "\"");

            var cfg = new EmptyListCfg(xml);
            var problems = cfg.Errors();

            Assert.AreEqual(0, problems.Length);
            Assert.IsNotNull(cfg.Connections);
            Assert.AreEqual(0, cfg.Connections.Count);

        }
Ejemplo n.º 5
0
        public void TestConnectionsXml()
        {
            var xml = @"
                <cfg>
                </cfg>
            ".Replace("'", "\"");

            var cfg      = new EmptyListCfg(xml);
            var problems = cfg.Errors();

            Assert.AreEqual(0, problems.Length);
            Assert.IsNotNull(cfg.Connections);
            Assert.AreEqual(0, cfg.Connections.Count);
        }
Ejemplo n.º 6
0
        public void ShouldRespectObjectInitialization()
        {
            var cfg = new EmptyListCfg {
                DefaultedProperty = "Set",
                NullProperty      = "Null",
                Connections       = new List <EmptyListConnection> {
                    new EmptyListConnection()
                }
            };

            Assert.IsNotNull(cfg.Connections);
            Assert.AreEqual(1, cfg.Connections.Count);
            Assert.IsNotNull(cfg.NullProperty);
            Assert.IsNotNull(cfg.DefaultedProperty);
            Assert.AreEqual("Null", cfg.NullProperty);
            Assert.AreEqual("Set", cfg.DefaultedProperty);
        }
Ejemplo n.º 7
0
        public void TestOtherThingsJson() {
            var json = @"{
                    'connections':[
                        { 'provider':'file', 'file':'c:\\temp.txt' }
                    ]
                }
            ".Replace("'", "\"");

            var cfg = new EmptyListCfg(json);
            var problems = cfg.Errors();

            Assert.AreEqual(0, problems.Length);
            Assert.IsNotNull(cfg.Connections);
            Assert.AreEqual(1, cfg.Connections.Count);
            Assert.IsNotNull(cfg.Connections[0].OtherThings);
            Assert.AreEqual(0, cfg.Connections[0].OtherThings.Count);

        }
Ejemplo n.º 8
0
        public void TestOtherThingsJson()
        {
            var json = @"{
                    'connections':[
                        { 'provider':'file', 'file':'c:\\temp.txt' }
                    ]
                }
            ".Replace("'", "\"");

            var cfg      = new EmptyListCfg(json);
            var problems = cfg.Errors();

            Assert.AreEqual(0, problems.Length);
            Assert.IsNotNull(cfg.Connections);
            Assert.AreEqual(1, cfg.Connections.Count);
            Assert.IsNotNull(cfg.Connections[0].OtherThings);
            Assert.AreEqual(0, cfg.Connections[0].OtherThings.Count);
        }
Ejemplo n.º 9
0
        public void TestOtherThingsXml() {
            var xml = @"
                <cfg>
                    <connections>
                        <add provider='file' file='c:\temp.txt' />
                    </connections>
                </cfg>
            ".Replace("'", "\"");

            var cfg = new EmptyListCfg(xml);
            var problems = cfg.Errors();

            Assert.AreEqual(0, problems.Length);
            Assert.IsNotNull(cfg.Connections);
            Assert.AreEqual(1, cfg.Connections.Count);
            Assert.IsNotNull(cfg.Connections[0].OtherThings);
            Assert.AreEqual(0, cfg.Connections[0].OtherThings.Count);

        }
Ejemplo n.º 10
0
        public void TestOtherThingsXml()
        {
            var xml = @"
                <cfg>
                    <connections>
                        <add provider='file' file='c:\temp.txt' />
                    </connections>
                </cfg>
            ".Replace("'", "\"");

            var cfg      = new EmptyListCfg(xml);
            var problems = cfg.Errors();

            Assert.AreEqual(0, problems.Length);
            Assert.IsNotNull(cfg.Connections);
            Assert.AreEqual(1, cfg.Connections.Count);
            Assert.IsNotNull(cfg.Connections[0].OtherThings);
            Assert.AreEqual(0, cfg.Connections[0].OtherThings.Count);
        }