public void Test2() { var c1 = new Cls1 { Name = "c1", Cls2 = new Cls2 { Name = "c2" } }; c1.Cls2.Cls3List.Add(new Cls3 { Name = "c31" }); c1.Cls2.Cls3List.Add(new Cls3 { Name = "c32" }); c1.Cls2.Cls3List[0].Cls4 = new Cls4 { Name = "c4", Cls5 = new Cls5 { Name = "c5" } }; c1.Save(); var c = Cls1.FindById(c1.Id); Assert.AreEqual("c1", c.Name); Assert.AreEqual("c2", c.Cls2.Name); Assert.AreEqual(2, c.Cls2.Cls3List.Count); Assert.AreEqual("c31", c.Cls2.Cls3List[0].Name); Assert.AreEqual("c32", c.Cls2.Cls3List[1].Name); Assert.AreEqual("c4", c.Cls2.Cls3List[0].Cls4.Name); Assert.AreEqual("c5", c.Cls2.Cls3List[0].Cls4.Cls5.Name); }
public void Test4() { var c1 = new Cls1 { Name = "c1" }; c1.Cls2.Value = new Cls2 { Name = "c2" }; c1.Cls2.Value.Cls3List.Add(new Cls3 { Name = "c31" }); c1.Cls2.Value.Cls3List.Add(new Cls3 { Name = "c32" }); var cl4 = new Cls4 { Name = "c4" }; cl4.Cls5.Value = new Cls5 { Name = "c5" }; c1.Cls2.Value.Cls3List[0].Cls4.Value = cl4; c1.Save(); var c4 = Cls4.FindById(c1.Cls2.Value.Cls3List[0].Cls4.Value.Id); c4.Cls5.Value = new Cls5 { Name = "c5x" }; c4.Save(); var c = Cls1.FindById(c1.Id); Assert.AreEqual("c1", c.Name); Assert.AreEqual("c2", c.Cls2.Value.Name); Assert.AreEqual(2, c.Cls2.Value.Cls3List.Count); Assert.AreEqual("c31", c.Cls2.Value.Cls3List[0].Name); Assert.AreEqual("c32", c.Cls2.Value.Cls3List[1].Name); Assert.AreEqual("c4", c.Cls2.Value.Cls3List[0].Cls4.Value.Name); Assert.AreEqual("c5x", c.Cls2.Value.Cls3List[0].Cls4.Value.Cls5.Value.Name); }
static void Main(string[] args) { Cls1 o = new Cls1("lable1"); Console.WriteLine(o.Label); }