Andrew Stopford's Weblog

poobah

News

Articles

MbUnit Folks

Old Blogs

NUnit and MbUnit Asserts

MbUnit has a lot of asserts that you can use in your testing toolbox. To help you see the difference between unit test frameworks I have compared the asserts from the current NUnit release to the current MbUnit release as follows.

AreEqual - NUnit
AreNotSame - NUnit
AreSame - NUnit
AreValueEqual
Between
Fail - NUnit
GreaterEqualThan
GreaterThan - Same as NUnit Greater
Ignore - NUnit
In - Same as NUnit Contains
IncrementAssertCount
IsFalse - NUnit
IsTrue - NUnit
IsNotNull
IsNull
LowerEqualThan
LowerThan - Same as the NUnit 2.4 Less Assert
NotBetween
NotIn
ReferanceEquals
ResetAssertCount
Warning

The following NUnit asserts are currently not supported, AreNotEqual,IsEmpty, IsNotEmpty, IsNaN.

The NUnit type asserts are currently not supported, IsInstanceofType, IsNotInstanceOfType, IsAssignableFrom, IsNotAssignableFrom, IsInstanceOf

MbUnit also has StringAsserts as follows

AreEqualIgnoreCase
DoesNotContain
EndsWith - NUnit
Equals - - NUnit StringAssert.Contains is closest
FullMatch
IsEmpty - NUnit 2.4
IsNonEmpty - NUnit 2.4
Like
NotLike
ReferanceEquals
StartsWith - NUnit

The NUnit 2.4 Collection assert is supported in MbUnit as follows

AreCountEqual
AreElementsEqual - NUnit AllItemsAreNotNull and AllItemsAreInstancesOf would be closest
AreEqual - NUnit
AreIsSyncronisedEqual
AreSyncRootEqual
Equals - NUnit AllItemsAreInstancesOf, Contains, DoesNotContain would be closest
IsCountCorrect
IsNotyncronised (actully a typo should be IsNotSyncronised)
IsSyncronised
ReferanceEquals

The following NUnit collection asserts are not supported directly AllItemsAreInstancesof, AllItemsAreUnique, AreNotEqual, AreEquivalent, AreNotEquivalent, Contains, DoesNotContain, IsSubSetOf and IsNotSubSetOf.

MbUnit supports FileAssert as follows

AreQual
AreStreamContentEqual
Equals
Exists
NotExists
ReferanceEquals

This was added to NUnit 2.4 but no details are available.

It's interesting to see how we compare and some of things that NUnit has already and has coming in 2.4. MbUnit has a lot of functionality built right in (no need to start reinventing the spanner, look inside the toolbox for what you need). Heres what MbUnit has in addition.

XmlAssert
SecruityAssert
ArrayAssert
CompilerAssert
DataAssert
PerfAssert
ReflectionAssert

Comments

JIRA: MbUnit said:

See - http://weblogs.asp.net/astopford/archive/2006/07/27/MbUnit-Asserts.aspx We need Asserts AreNotEqual IsEmpty IsNotEmpty IsNaN. Less - dupes existing LowerThan Contains - dupes existing In Greater - dupes existing GreaterThan Typ...

# August 15, 2006 7:12 AM

Tic said:

Just wanted to know from your side about what is your final views about Mbunit compared to latest NUnit.

Should we go for Nunit or Mbunit

Regards

# December 19, 2006 8:45 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)