NXUnit Framework Class Library

AssertStrategy Fields

The fields of the AssertStrategy structure are listed below. For a complete list of AssertStrategy structure members, see the AssertStrategy Members topic.

Public Instance Fields

IsCaseSensitive Will assertions and comparisions care about the case of the elements' names and the attributes' names?

Sample:
string s1 = "<Test b='c' />";
string s2 = "<teST B='c' />";
XMLAssert xa = XMLAssert.CreateInstance();

xa.IsCaseSensitive = false;
xa.AreEqual(s1, s2);

xa.IsCaseSensitive = true;
xa.AreEqual(s1, s2);  // Failed!
IsCommentSensitive Will assertions and comparisions care about the xml comments?

Sample:
string s1 = "<r><!-- test string 1 --></r>";
string s2 = "<r/>";
XMLAssert xa = XMLAssert.CreateInstance();

xa.IsCommentSensitive = false;
xa.AreEqual(s1, s2);

xa.IsCommentSensitive = true;
xa.AreEqual(s1, s2);  // Failed!
IsDeclarationSensitive Will assertions and comparisions care about the xml declaration?

Sample:
string s1 = "<?xml version='1.0' ?><a/>";
string s2 = "<a/>";
XMLAssert xa = XMLAssert.CreateInstance();

xa.IsDeclarationSensitive = false;
xa.AreEqual(s1, s2);

xa.IsDeclarationSensitive = true;
xa.AreEqual(s1, s2);  // Failed!
IsDocTypeSensitive Will assertions and comparisions care about the document type?

Sample:
string s1 = "<!DOCTYPE book><a/>";
string s2 = "<!DOCTYPE koob><a/>";
XMLAssert xa = XMLAssert.CreateInstance();

xa.IsDocTypeSensitive = false;
xa.AreEqual(s1, s2);

xa.IsDocTypeSensitive = true;
xa.AreEqual(s1, s2);  // Failed!
IsEmptyAttrSensitive Will assertions and comparisions care about the empty attribute?

Sample:
string s1 = "<a b=\"\" />";
string s2 = "<a/>";
XMLAssert xa = XMLAssert.CreateInstance();

xa.IsEmptyAttrSensitive = false;
xa.AreEqual(s1, s2);

xa.IsEmptyAttrSensitive = true;
xa.AreEqual(s1, s2);  // Failed!
IsEmptyElementSensitive Will assertions and comparisions care about the empty element?

Sample:
string s1 = "<a><b/></a>";
string s2 = "<a></a>";
XMLAssert xa = XMLAssert.CreateInstance();

xa.IsEmptyElementSensitive = false;
xa.AreEqual(s1, s2);

xa.IsEmptyElementSensitive = true;
xa.AreEqual(s1, s2);  // Failed!
IsOrderSensitive Will assertions and comparisions care about the order of the elements and attributes?

Sample:
string s1 = "<a b='c' c='b'/>";
string s2 = "<a c='b' b='c'/>";
string s3 = "<r><a/><b/></r>";
string s4 = "<r><b/><a/></r>";
XMLAssert xa = XMLAssert.CreateInstance();

xa.IsOrderSensitive = false;
xa.AreEqual(s1, s2);
xa.AreEqual(s3, s4);

xa.IsOrderSensitive = true;
xa.AreEqual(s1, s2);  // Failed!
xa.AreEqual(s3, s4);  // Failed!
IsWhitespaceSensitive Will assertions and comparisions care about the whitespace in xml?

Sample:
string s1 = "<a></a>";
string s2 = "<a>  \r\n\t</a>";
XMLAssert xa = XMLAssert.CreateInstance();
   
xa.IsWhitespaceSensitive = false;
xa.AreEqual(s1, s2);
   
xa.IsWhitespaceSensitive = true;
xa.AreEqual(s1, s2);  // Failed!

See Also

AssertStrategy Class | NXUnit.Framework Namespace | XMLAssert