Here's what I had in mind. I wasn't proposing any changes, only this
addition. The idea is that the invoker would establish the evaluation
context for the XPath compiler, then pass the result to the test. A
fixture operates on *one* XML document, which can pass through
multiple XSL transforms. At the moment, namespace mappings pertain to
the entire fixture, and affect only the XPath compiler; I suppose you
could want to change the evaluation context for any of the XSLTs, but
I don't need that yet. I could post all the source code to my blog. I
could also just clean it up, zip it, and send it to you. Any comments?
using System.Xml.XPath;
using MbUnit.Framework;
using Omega.NetworkModel.Tests;
namespace Omega.NetworkModel.Tests
{
[MyXmlTestFixture("document.xml")]
public class TestXmlWithoutTransformFixture
{
[MyXPathExpressionTest("/*")]
public void DoSomething(XPathNodeIterator iterator)
{
Assert.AreEqual(1, iterator.Count);
}
// count() returns a double, it turns out.
[MyXPathExpressionTest("count(//*)")]
public void CountElements(double count)
{
Assert.AreEqual(2, count);
}
// I was surprised that the compiler does *not* expect
XML-escaped
stuff.
[MyXPathExpressionTest("count(//*) > 0")]
public void TryBoolean(bool hasElements)
{
Assert.IsTrue(hasElements);
}
}
[MyXmlTestFixture("document.xml")]
[MyXsltTransform("test.xslt")]
public class TestXmlAfterIdentityTransformFixture
{
[MyXPathExpressionTest("/*")]
public void DoSomething(XPathNodeIterator iterator)
{
Assert.AreEqual(iterator.Current.NodeType,
XPathNodeType.Root);
}
}
[MyXmlTestFixture("document.xml")]
[MyXsltTransform("test.xslt")]
[MyXsltNamespaceMappingDecorator("tnt", "")]
public class TestXmlAfterIdentityTransformAndNamespaceFixture
{
[MyXPathExpressionTest("/tnt:*")]
public void DoSomething(XPathNodeIterator iterator)
{
Assert.AreEqual(iterator.Current.NodeType,
XPathNodeType.Root);
}
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MbUnit.User" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/MbUnitUser?hl=en
-~----------~----~----~----~------~----~------~--~---