Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
NUnit
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Classical === Before NUnit 2.4, a separate method of the <code>Assert</code> class was used for each different assertion. It continues to be supported in NUnit, since many people prefer it.{{citation needed|date=January 2017}} Each assert method may be called without a message, with a simple text message or with a message and arguments. In the last case the message is formatted using the provided text and arguments.{{citation needed|date=January 2017}} <syntaxhighlight lang="csharp"> // Equality asserts Assert.AreEqual(object expected, object actual); Assert.AreEqual(object expected, object actual, string message, params object[] parms); Assert.AreNotEqual(object expected, object actual); Assert.AreNotEqual(object expected, object actual, string message, params object[] parms); // Identity asserts Assert.AreSame(object expected, object actual); Assert.AreSame(object expected, object actual, string message, params object[] parms); Assert.AreNotSame(object expected, object actual); Assert.AreNotSame(object expected, object actual, string message, params object[] parms); // Condition asserts // (For simplicity, methods with message signatures are omitted.) Assert.IsTrue(bool condition); Assert.IsFalse(bool condition); Assert.IsNull(object anObject); Assert.IsNotNull(object anObject); Assert.IsNaN(double aDouble); Assert.IsEmpty(string aString); Assert.IsNotEmpty(string aString); Assert.IsEmpty(ICollection collection); Assert.IsNotEmpty(ICollection collection); </syntaxhighlight>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)