private static GenDataBase SetUpSegmentSeparatorData(string display) { var fm = GenDataDef.CreateMinimal(); var dm = new GenDataBase(fm); var td = CreateClass(dm, "TestData"); CreateProperty("Name", td); CreateProperty("Display", td); var f = dm.AsDef(); var a = new GenAttributes(f, 1); var d = new GenDataBase(f); a.GenObject = CreateGenObject(d.Root, "TestData", "One"); a.SetString("Name", "One"); a.SetString("Display", display[0] == '1' ? "True" : ""); a.SaveFields(); a.GenObject = CreateGenObject(d.Root, "TestData", "Two"); a.SetString("Name", "Two"); a.SetString("Display", display[1] == '1' ? "True" : ""); a.SaveFields(); a.GenObject = CreateGenObject(d.Root, "TestData", "Three"); a.SetString("Name", "Three"); a.SetString("Display", display[2] == '1' ? "True" : ""); a.SaveFields(); return(d); }
public void EmptyGenDataAsDefTest() { var f = GenDataDef.CreateMinimal(); var d = new GenDataBase(f); var f0 = d.AsDef(); Assert.AreEqual(1, f0.Classes.Count); // Root class only Assert.AreEqual("", f0.GetClassName(0)); Assert.AreEqual(0, f0.GetClassProperties(0).Count); Assert.AreEqual(0, f0.GetClassSubClasses(0).Count); }
public void EmptyClassGenDataAsDefTest() { var f = GenDataDef.CreateMinimal(); var d = new GenDataBase(f); CreateClass(d, "Class"); var f0 = d.AsDef(); Assert.AreEqual(2, f0.Classes.Count); // Root class Assert.AreEqual("", f0.GetClassName(0)); Assert.AreEqual(0, f0.GetClassProperties(0).Count); Assert.AreEqual(1, f0.GetClassSubClasses(0).Count); // Defined Class Assert.AreEqual(0, f.GetClassId("")); Assert.AreEqual("Class", f.GetClassName(1)); Assert.AreEqual(1, f0.GetClassSubClasses(0)[0].SubClass.ClassId); }