Exemple #1
0
 public void Count0()
 {
     using (TextWriter writer = new StringWriter())
     {
         var document = new XmlDocument();
         document.LoadXml("<root />");
         var context = new Context {Document = document, XPath = "foo", Output = writer, Quiet = writer, FileName = "file"};
         var task = new Show();
         task.Execute(context);
         Assert.IsTrue(writer.ToString().StartsWith("file: 0"));
     }
 }
Exemple #2
0
 public void NoSelection()
 {
     using (TextWriter writer = new StringWriter())
     {
         var document = new XmlDocument();
         document.LoadXml("<root/>");
         var context = new Context {Document = document, XPath = "//foo", FileName = "file", Output = writer, Quiet = writer};
         var task = new Show();
         task.Execute(context);
         Assert.That(writer.ToString(), Is.EqualTo(string.Format("file: 0{0}", Environment.NewLine)));
     }
 }
Exemple #3
0
        public void AnInvalidXPathExpressionShouldThrow()
        {
            using (TextWriter writer = new StringWriter())
            {
                var document = new XmlDocument();
                document.LoadXml("<root/>");
                var context = new Context {Document = document, XPath = "///", FileName = "file", Output = writer, Quiet = writer};
                var task = new Show();

                Assert.Throws<TaskExecutionException>(() => task.Execute(context));
            }
        }