Пример #1
0
        public void TestNameProperty()
        {
            XmlDocument xd = TestData.XmlDocument;
            BuildFile bf = new BuildFile();
            bf.LoadXmlDocument(xd);

            BuildComponent bc = new BuildComponent((XmlElement)xd.SelectSingleNode("//BuildComponent[@name='TestComponent']"), bf);

            Assert.AreEqual(bc.Name, "TestComponent");
        }
Пример #2
0
        public void DefaultComponentsPropertyTest()
        {
            BuildFile bf = new BuildFile();
            bf.LoadXmlDocument(TestData.XmlDocument);

            List<string> comps = (List<string>)bf.DefaultComponents;

            Assert.AreEqual("Core", comps[0]);
            Assert.AreEqual("TestComponent", comps[1]);
        }
Пример #3
0
        public void TestActionsProperty()
        {
            XmlDocument xd = TestData.XmlDocument;
            BuildFile bf = new BuildFile();
            bf.LoadXmlDocument(xd);

            BuildComponent bc = new BuildComponent((XmlElement)xd.SelectSingleNode("//BuildComponent[@name='TestComponent']"), bf);

            List<IAction> actions = (List<IAction>)bc.Actions;

            Assert.IsTrue(actions.Count == 1);
            Assert.IsTrue(((IAction)actions[0]).GetType().Name == "WriteConsole");
        }
Пример #4
0
        public void TestDependenciesProperty()
        {
            XmlDocument xd = TestData.XmlDocument;
            BuildFile bf = new BuildFile();
            bf.LoadXmlDocument(xd);

            BuildComponent bc = new BuildComponent((XmlElement)xd.SelectSingleNode("//BuildComponent[@name='TestComponent']"), bf);

            Assert.AreEqual(1, bc.Dependencies.Count);
            Assert.AreEqual(((List<string>)bc.Dependencies)[0], "Core");

            BuildComponent bc2 = new BuildComponent((XmlElement)xd.SelectSingleNode("//BuildComponent[@name='Core']"), bf);
            Assert.AreEqual(0, bc2.Dependencies.Count);
        }
Пример #5
0
        public void TestConstructorXmlParsing()
        {
            XmlDocument xd = TestData.XmlDocument;
            BuildFile bf = new BuildFile();
            bf.LoadXmlDocument(xd);

            try
            {
                new BuildComponent(xd.DocumentElement, bf);
            }
            catch (Exception ex)
            {
                Assert.IsTrue(ex is BuildFileParseException);
            }
        }
Пример #6
0
        public void ParseTest()
        {
            XmlDocument xd = TestData.XmlDocument;
            BuildFile bf = new BuildFile();
            bf.LoadXmlDocument(xd);

            List<IBuildFileElement> elements = (List<IBuildFileElement>)BuildFileElementParser.Parse(xd, bf);

            Assert.AreEqual(4, elements.Count);
            Assert.AreEqual(typeof(Property), elements[0].GetType());
            Assert.AreEqual("WriteConsole", elements[1].GetType().Name);

            Assert.AreEqual(typeof(BuildComponent), elements[2].GetType());
            Assert.AreEqual("Core", ((BuildComponent)elements[2]).Name);

            Assert.AreEqual(typeof(BuildComponent), elements[3].GetType());
            Assert.AreEqual("TestComponent", ((BuildComponent)elements[3]).Name);
        }
Пример #7
0
        public void Create()
        {
            XmlDocument xd = TestData.XmlDocument;
            BuildFile bf = new BuildFile();
            bf.LoadXmlDocument(xd);

            IBuildFileElement elementAction = BuildFileElementFactory.Create((XmlElement)xd.SelectSingleNode("/CamBuildProject/WriteConsole"), bf);
            Assert.IsTrue(elementAction.GetType().Name == "WriteConsole");
            Assert.AreEqual(elementAction.ParentBuildFile, bf);

            IBuildFileElement elementBuildComponent = BuildFileElementFactory.Create((XmlElement)xd.SelectSingleNode("/CamBuildProject/BuildComponent[@name='TestComponent']"), bf);
            Assert.IsTrue(elementBuildComponent is BuildComponent);
            Assert.AreEqual("TestComponent", ((BuildComponent)elementBuildComponent).Name);
            Assert.AreEqual(elementBuildComponent.ParentBuildFile, bf);

            IBuildFileElement elementProperty = BuildFileElementFactory.Create((XmlElement)xd.GetElementsByTagName("Property")[0], bf);
            Assert.AreEqual("Property", elementProperty.GetType().Name);
            Assert.AreEqual("OutputDir", elementProperty.GetType().GetProperty("Name").GetValue(elementProperty, null).ToString());
            Assert.AreEqual(elementProperty.ParentBuildFile, bf);
        }
Пример #8
0
        public void ProjectNamePropertyTest()
        {
            BuildFile bf = new BuildFile();

            bf.LoadXmlDocument(TestData.XmlDocument);

            Assert.AreEqual("Test Project", bf.ProjectName);
        }