Beispiel #1
0
        public void VerifySetUpParentChildReferenceDefProfile()
        {
            var fChild  = SetUpParentChildDef("Child", "Grandchild");
            var fParent = SetUpParentChildReferenceDef("Parent", "Child", "ChildDef", fChild);

            Assert.AreEqual(Profile, GenDataDefProfile.CreateProfile(fParent));
        }
Beispiel #2
0
        public void VerifyParentChildReferenceDataDef()
        {
            var dataChild  = SetUpParentChildData("Child", "Grandchild", "Grandchild");
            var dataParent = SetUpParentChildReferenceData("Parent", "Child", "Child", "Child", dataChild);

            Assert.AreEqual(ReferenceGenDataSaveProfile, GenDataDefProfile.CreateProfile(dataParent.GenDataDef));
        }
        public void ReferenceOutputProfileTest()
        {
            var dataGrandchildhild = SetUpParentChildData("Grandchild", "Greatgrandchild", "Greatgrandchild");
            var dataChild          = SetUpParentChildReferenceData("Child", "Grandchild", "GrandchildDef", "Grandchild", dataGrandchildhild);
            var dataParent         = SetUpParentChildReferenceData("Parent", "Child", "ChildDef", "Child", dataChild);
            var p = GenParameters.CreateProfile(dataParent.GenDataDef);

            Assert.AreEqual(GenDataDefProfile.CreateProfile(dataParent.GenDataDef),
                            p.ProfileText(ProfileFragmentSyntaxDictionary.ActiveProfileFragmentSyntaxDictionary)
                            .Replace(">:", ":"));
        }
        public void OutputProfileTest()
        {
            var f0 = GenDataDef.CreateMinimal();
            var p  = GenParameters.CreateProfile(f0);
            var p0 = GenDataDefProfile.CreateProfile(f0);

            Assert.AreEqual(p0,
                            p.ProfileText(ProfileFragmentSyntaxDictionary.ActiveProfileFragmentSyntaxDictionary)
                            .Replace(">:", ":"));
            ValidateProfileData(p, f0);
        }
        public void InheritanceDefinitionSetupTest()
        {
            var df  = SetUpVirtualDefinition();
            var d   = df.GenDataBase;
            var def = d.AsDef();

            Assert.AreEqual(VirtualDefinitionProfile, GenDataDefProfile.CreateProfile(def));
            var data = def.AsGenDataBase();

            CompareGenData(d, data);
        }
Beispiel #6
0
        public void GenDataDefTest()
        {
            const string rootProfile =
                "Definition=Root\r\n" +
                "Class=Root\r\n" +
                "Field=Id\r\n" +
                ".\r\n" +
                "`[Root:Root[`?Root.Id:Id`?Root.Id<>True:=`@StringOrName:`{`Root.Id``]`]`]`]]\r\n" +
                "`]";

            var d = new GenDataDef {
                DefinitionName = "Root"
            };
            var i = d.AddClass("", "Root");

            Assert.AreEqual(1, i);
            Assert.AreEqual(i, d.GetClassId("Root"));
            Assert.AreEqual(0, d.Classes[0].IndexOfSubClass("Root"));
            var j = d.AddClassInstanceProperty(i, "Id");

            Assert.AreEqual(j, d.GetClassProperties(i).IndexOf("Id"));
            Assert.AreEqual(rootProfile, GenDataDefProfile.CreateProfile(d));

            var id = d.GetId("Root.Id");

            Assert.AreEqual(i, id.ClassId);
            Assert.AreEqual(j, id.PropertyId);

            i = d.AddClass("Root", "Sub");
            Assert.AreEqual(2, i);
            Assert.AreEqual(i, d.GetClassId("Sub"));
            Assert.AreEqual(0, d.Classes[1].IndexOfSubClass("Sub"));
            Assert.AreEqual(1, d.GetClassParent(i).ClassId);
            j = d.AddClassInstanceProperty(i, "SubId");
            Assert.AreEqual(0, j);
            Assert.AreEqual(j, d.GetClassProperties(i).IndexOf("SubId"));

            id = d.GetId("Sub.SubId");
            Assert.AreEqual(i, id.ClassId);
            Assert.AreEqual(j, id.PropertyId);
        }