Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Assert.NotNull(object anObject) vs. Assert.IsNotNull(object anObject)

Tags:

c#

assert

nunit

There are these two methods in the NUnit.Framework.Assert namespace.

I just cannot find what's the difference between them. I'm also curious when to use which one.

like image 775
ChocapicSz Avatar asked Oct 22 '15 08:10

ChocapicSz


People also ask

What is Assert NotNull?

Verifies that the object that is passed in is not equal to null If the object is null then an AssertionException is thrown. NotNull(Object) Verifies that the object that is passed in is not equal to null If the object is null then an AssertionException is thrown. NotNull(Object, String)

What is a Assert IsNotNull in c#?

IsNotNull(Object) Tests whether the specified object is non-null and throws an exception if it is null.


1 Answers

Two forms are provided for the True, False, Null and NotNull conditions. The "Is" forms are compatible with earlier versions of the NUnit framework, while those without "Is" are provided for compatibility with NUnitLite.

Got it here.

like image 81
Stas Ivanov Avatar answered Oct 16 '22 09:10

Stas Ivanov