Various Nunit assertions
First, assertions are some functions that can be used to test whether the tested functions work normally.
The Nunit library is provided to Testers in the form of static Assert methods.
AreEqual (expected, actual [, string message])
Parameter description: The first parameter is the expected value, the second parameter is the actual value generated by the test code, and the third parameter is the message reported when an error occurs.
Functional constraints: Any object can be used for Equality testing. However, if you want to use this assertion to compare floating point numbers, you need to specify an additional error parameter. This is because the computer cannot accurately represent all floating point numbers.
IsNull (objec [, string message])/IsNotNull (object [, string message])
Parameter description: The first parameter is the object to be verified, and the second parameter is the same as above.
Functional constraints: verify whether a given object is null or not null.
AreSame (expected, actual [, string message])
Parameter description: the first is the expected object, and the second is the actual object.
Function constraint: verify whether the two parameters reference the same object.
IsTrue (bool condition [, string message])/IsFalse (bool condition [, string message])
Parameter description: The first parameter is a binary condition to be verified.
Functional constraints: whether the verification conditions are true or false.
Fail ([string message])
Function constraint: make the current test fail immediately. This type of assertion is usually used to mark a branch that should not be reached, but it is not commonly used in practice.