Assertions are central to unit testing in TC-Lite.

Assertions are written as calls to static methods of the Assert class. If an assertion fails, the method call does not return, an error is reported and any code following the failing Assert is not executed. For that reason, it's usually best to try for one assertion per test.

Assert calls may be grouped into two Assertion Models.

Classic Model

Each supported Assert uses a separate method, whose name indicates what is being tested.
Assert.IsTrue Tests that a boolean condition is true.
Assert.IsNull Tests that an object is null.
Assert.IsNotNull Tests that an object is not null.
Assert.IsEmpty Tests that a string or collection is empty.
Assert.IsNotEmpty Tests that a string or collection is not empty.
Assert.AreEqual Tests that the two arguments are equal.
Assert.AreNotEqual Tests that the two arguments are unequal.
Assert.AreSame Tests that the two arguments reference the same object.
Assert.AreNotSame Tests that the two arguments do not reference the same object.
Assert.Pass Causes a test to terminate immediately with a passing result.
Assert.Fail Causes a test to terminate immediately with a failing result.
Assert.Warn Causes a test to terminate immediately with an warning result.
Assert.Ignore Causes a test to terminate immediately with an ignored result.
Assert.Inconclusive Causes a test to terminate immediately with an warning result.

Constraint Model

All Assertions use the same static method, Assert.That, with a Constraint argument that determines the particular test to be made.

Classic Model

Each supported Assert uses a separate method, whose name indicates what is being tested.
Assert.IsTrue Tests that a boolean condition is true.
Assert.IsNull Tests that an object is null.
Assert.IsNotNull Tests that an object is not null.
Assert.IsEmpty Tests that a string or collection is empty.
Assert.IsNotEmpty Tests that a string or collection is not empty.
Assert.AreEqual Tests that the two arguments are equal.
Assert.AreNotEqual Tests that the two arguments are unequal.
Assert.AreSame Tests that the two arguments reference the same object.
Assert.AreNotSame Tests that the two arguments do not reference the same object.
Assert.Pass Causes a test to terminate immediately with a passing result.
Assert.Fail Causes a test to terminate immediately with a failing result.
Assert.Warn Causes a test to terminate immediately with an warning result.
Assert.Ignore Causes a test to terminate immediately with an ignored result.
Assert.Inconclusive Causes a test to terminate immediately with an warning result.

Constraint Model

All Assertions use the same static method, Assert.That, with a Constraint argument that determines the particular test to be made.