phuccaoca123 / mb-unit

Automatically exported from code.google.com/p/mb-unit
0 stars 0 forks source link

XmlAssert.AreEqual() does not assert #33

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
XmlAssert.AreEqual() does not contain any assertions. As a result, the 
test passes on documents that the underlying XmlDiff flags as different. 

Something like this (borrowed from the implementation of AreIdentical()) 
should do the trick: 

            DiffResult diffResult = xmlDiff.Compare(); 
            Assert.AreEqual(equal, diffResult.Equal, 
xmlDiff.OptionalDescription);

Original issue reported on code.google.com by astopf...@gmail.com on 31 Aug 2007 at 1:33

GoogleCodeExporter commented 9 years ago

Original comment by astopf...@gmail.com on 31 Aug 2007 at 1:34

GoogleCodeExporter commented 9 years ago
Looks like the issue is in the private overload of XmlAssert.XmlEquals. It calls
XmlDiff.Compare but does nothing with the return value. This renders all public
overloads of XmlAssert.XmlEquals useless, as well as DataAssert.AreSchemasEqual,
DataAssert.AreEqual, and DataAssert.AreDataEqual.

I believe the main reason this wasn't caught is a fundamental problem with
XmlAssertionTests. This test fixture uses the same methods it's testing to 
perform
the actual assertions. It's never going to catch false positives that way.

Original comment by tmen...@gmail.com on 16 Nov 2007 at 8:34

GoogleCodeExporter commented 9 years ago
It should be able to catch false positives by looking for expected
AssertionExceptions in negative cases.

Original comment by jeff.br...@gmail.com on 16 Nov 2007 at 9:13

GoogleCodeExporter commented 9 years ago
This has already been fixed (r515), I added a couple of extra test cases though.

Original comment by grahamr...@gmail.com on 4 Mar 2008 at 2:32