Assert Value Categories
Learn and practice how to perform assertions on value categories.
Introduction
C# types store values which are categorized into the following groups:
Null
NotNull
Zero
NotZero
IsNaN
IsEmpty
IsNotEmpty
NUnit provides facilities to assert against these value categories.
Conceptually understanding each value category
The following are interpretations of each value category:
-
Null
: A nullable value type or a reference type can assume the value ofnull
. This means that the variable does not point to any instance in memory. -
NotNull
: A nullable value type/reference type can assume the value of not null. This means that the variable points to an instance in memory. -
Zero
: A variable that assumes the value of zero. -
NotZero
: A variable that does not assume the value of zero. -
IsNaN
: A numeric variable assumes a value that ...