public void SpecifyNeitherLinesNorXmlFileName_ReturnFalse() { task = new XmlQuery(); task.BuildEngine = new MockBuild(); task.XPath = "count(/configuration/appSettings/*)"; Assert.IsFalse(task.Execute(), "Should have failed to execute."); }
public void LoadXmlFromFile() { task = new XmlQuery(); task.BuildEngine = new MockBuild(); string prjRootPath = TaskUtility.GetProjectRootDirectory(true); task.XmlFileName = System.IO.Path.Combine(prjRootPath, @"Source\Subversion.proj"); task.XPath = "count(/n:Project/n:PropertyGroup/*)"; task.NamespaceDefinitions = new ITaskItem[] { new TaskItem("n=http://schemas.microsoft.com/developer/msbuild/2003") }; Assert.IsTrue(task.Execute(), "Should have executed successfully."); Assert.AreEqual("6", task.Values[0].ToString()); }
public void RetrieveAttributeValueViaXPath() { setupTask(testXml); task.XPath = "/configuration/system.web/compilation/@debug"; Assert.IsTrue(task.Execute(), "Should have executed successfully"); Assert.AreEqual("true", task.Values[0].ToString()); }