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); }
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); }
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); }
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); }
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); }
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); }