Example #1
0
        public void Basic()
        {
            XmlElement            group       = GetBasicItemDefinitionGroupWithOneDefinitionAndOneMetadatum();
            ItemDefinitionLibrary definitions = NewAndEvaluateItemDefinitionLibraryXml(group);

            Assertion.AssertEquals(1, definitions.GetDefaultedMetadataCount("CCompile"));
            Assertion.AssertEquals("DEBUG", definitions.GetDefaultMetadataValue("CCompile", "Defines"));
        }
Example #2
0
        public void FalseConditionOnMetadatum()
        {
            XmlElement group = GetBasicItemDefinitionGroupWithOneDefinitionAndOneMetadatum();

            XmlTestUtilities.AddAttribute(group.ChildNodes[0].ChildNodes[0], "Condition", "'v2'=='$(p1)'");
            ItemDefinitionLibrary definitions = NewAndEvaluateItemDefinitionLibraryXml(group);

            // No exception
            Assertion.AssertEquals(0, definitions.GetDefaultedMetadataCount("arbitrary"));
        }
Example #3
0
        public void NoMetadata()
        {
            XmlElement group = GetBasicItemDefinitionGroupWithOneDefinitionAndOneMetadatum();

            group.ChildNodes[0].RemoveAll();
            ItemDefinitionLibrary definitions = NewAndEvaluateItemDefinitionLibraryXml(group);

            // No exception
            Assertion.AssertEquals(0, definitions.GetDefaultedMetadataCount("arbitrary"));
        }
Example #4
0
        public void ExpandPropertiesInMetadatumValue()
        {
            XmlElement group = GetBasicItemDefinitionGroupWithOneDefinitionAndOneMetadatum();

            group["CCompile"]["Defines"].InnerText = "A_$(p1)_$(p2)_B";
            ItemDefinitionLibrary definitions = NewAndEvaluateItemDefinitionLibraryXml(group);

            Assertion.AssertEquals(1, definitions.GetDefaultedMetadataCount("CCompile"));
            Assertion.AssertEquals("A_v1__B", definitions.GetDefaultMetadataValue("CCompile", "Defines"));
        }
Example #5
0
        public void DuplicateMetadataLastOneWins()
        {
            XmlElement group = GetBasicItemDefinitionGroupWithOneDefinitionAndOneMetadatum();
            XmlElement meta2 = XmlTestUtilities.AddChildElement(group.ChildNodes[0], "Defines");

            meta2.InnerText = "RETAIL";
            ItemDefinitionLibrary definitions = NewAndEvaluateItemDefinitionLibraryXml(group);

            Assertion.AssertEquals(1, definitions.GetDefaultedMetadataCount("CCompile"));
            Assertion.AssertEquals("RETAIL", definitions.GetDefaultMetadataValue("CCompile", "Defines"));
        }
Example #6
0
        public void TrueConditionOnEverything()
        {
            XmlElement group = GetBasicItemDefinitionGroupWithOneDefinitionAndOneMetadatum();

            XmlTestUtilities.AddAttribute(group.ChildNodes[0], "Condition", "'v1'=='$(p1)'");
            XmlTestUtilities.AddAttribute(group.ChildNodes[0].ChildNodes[0], "Condition", "'v1'=='$(p1)'");
            XmlTestUtilities.AddAttribute(group.ChildNodes[0].ChildNodes[0], "Condition", "'v1'=='$(p1)'");
            ItemDefinitionLibrary definitions = NewAndEvaluateItemDefinitionLibraryXml(group);

            Assertion.AssertEquals(1, definitions.GetDefaultedMetadataCount("CCompile"));
            Assertion.AssertEquals("DEBUG", definitions.GetDefaultMetadataValue("CCompile", "Defines"));
        }