//[TestCase(Description = "Test for restoring context with references.")] //public void DataRestoreContextTest() //{ // var f = new GenDataDef(); // f.AddSubClass("", "Parent"); // f.Classes[f.GetClassId("Parent")].AddInstanceProperty("Name"); // f.AddSubClass("Parent", "Class", "Definition"); // var d = new GenData(f); // CreateGenObject(d, "", "Parent", "Minimal"); // ((SubClassReference)d.Context[1].GenObject.SubClass[0]).Reference = "Minimal"; // CreateGenObject(d, "", "Parent", "Basic"); // ((SubClassReference)d.Context[1].GenObject.SubClass[0]).Reference = "Basic"; // CreateGenObject(d, "", "Parent", "Definition"); // ((SubClassReference)d.Context[1].GenObject.SubClass[0]).Reference = "Definition"; // d.First(1); // var o = d.Context[4].GenObject; // var sc = d.SaveContext(4); // Assert.AreEqual("minimal", o.GenDataBase.ToString()); // Assert.AreEqual("Minimal", d.Context[4].Reference); // Assert.AreEqual("Minimal", d.Context[3].Reference); // Assert.AreEqual("Minimal", d.Context[2].Reference); // Assert.AreEqual("", d.Context[1].Reference); // d.Last(1); // Assert.AreEqual("definition", d.Context[4].GenObject.GenDataBase.ToString()); // Assert.AreEqual("Definition", d.Context[4].Reference); // Assert.AreEqual("Definition", d.Context[3].Reference); // Assert.AreEqual("Definition", d.Context[2].Reference); // Assert.AreEqual("", d.Context[1].Reference); // sc.EstablishContext(); // Assert.AreSame(o, d.Context[4].GenObject); // Assert.AreEqual("Minimal", d.Context[4].Reference); // Assert.AreEqual("Minimal", d.Context[3].Reference); // Assert.AreEqual("Minimal", d.Context[2].Reference); // Assert.AreEqual("", d.Context[1].Reference); //} private static void Navigate(GenData d, int classId) { d.First(classId); while (!d.Eol(classId)) { foreach (GenDataDefSubClass subClass in d.Context[classId].DefClass.SubClasses) { Navigate(d, subClass.SubClass.ClassId); } d.Next(classId); } }