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"); }
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"); }
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))); } }
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); }
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; }
public static IBuildFileElement ConvertBuildComponent(BuildComponent bc) { return (IBuildFileElement)bc; }
public static IBuildFileElement ConvertBuildComponent(BuildComponent bc) { return((IBuildFileElement)bc); }