예제 #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 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");
        }
예제 #3
0
        private void ExecuteBuildComponent(BuildComponent bc)
        {
            if (!compsExecuted.Contains(bc.Name))
            {
                compsExecuted.Add(bc.Name);

                Logging.Instance.LogEntry("BuildComponentExecute", (bc.Name));

                List<BuildComponent> deps = (List<BuildComponent>)bc.ParentBuildFile.GetBuildComponents((List<string>)bc.Dependencies);

                this.ExecuteElements(deps.ConvertAll(new Converter<BuildComponent, IBuildFileElement>(Utility.ConvertBuildComponent)));
                this.ExecuteElements(((List<IAction>)bc.Actions).ConvertAll(new Converter<IAction, IBuildFileElement>(Utility.ConvertBaseAction)));
            }
        }
예제 #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 static IBuildFileElement Create(XmlElement xe, BuildFile bf)
        {
            if (xe == null)
                return null;

            IBuildFileElement element = null;

            if (xe.Name == "BuildComponent")
            {
                element = new BuildComponent(xe, bf);
            }
            else if (xe.Name == "Property")
            {
                element = new Property(xe.Attributes["name"].Value, xe.InnerText);
                element.ParentBuildFile = bf;
            }
            else // assume that element is a BaseAction
            {
                element = ActionFactory.Create(xe);
                element.ParentBuildFile = bf;
            }

            return element;
        }
예제 #6
0
파일: Utility.cs 프로젝트: almx/CamBuild
 public static IBuildFileElement ConvertBuildComponent(BuildComponent bc)
 {
     return (IBuildFileElement)bc;
 }
예제 #7
0
파일: Utility.cs 프로젝트: almx/CamBuild
 public static IBuildFileElement ConvertBuildComponent(BuildComponent bc)
 {
     return((IBuildFileElement)bc);
 }