Summary
The Assert class contains a collection of static methods that
implement the assertions used in TC-Lite.
- Namespace
- TCLite
- Base Types
-
- object
graph BT
Type-->Base0["object"]
Type["Assert"]
class Type type-node
Syntax
public abstract class Assert
Remarks
We don't actually want any instances of this object, but some people
like to inherit from it to add other static methods. Hence, the
use of abstract in the declaration.
Methods
Name | Value | Summary |
---|---|---|
AreEqual |
void |
Asserts that two doubles are equal within the specified
tolerance. If not, a
TCLite.AssertionException is
thrown, ending the test and reporting it as a Failure.
static
|
AreEqual |
void |
Asserts that two doubles are equal within the specified
tolerance. If not, a
TCLite.AssertionException is
thrown, ending the test and reporting it as a Failure.
static
|
AreEqual |
void |
Asserts that two instances of a type are equal. If not,
then a
TCLite.AssertionException is thrown, ending
the test and reporting it as a Failure.
static
|
AreEqual |
void |
Asserts that two instances of a type are equal. If not,
then a
TCLite.AssertionException is thrown, ending
the test and reporting it as a Failure.
static
|
AreNotEqual |
void |
Asserts that two instances of a type are not equal. If equal,
a
TCLite.AssertionException is thrown, ending
the test and reporting it as a Failure.
static
|
AreNotSame |
void |
Asserts that two references do not refer to the same instance.
If they do, a
TCLite.AssertionException is thrown,
ending the test and reporting it as a Failure.
static
|
AreSame |
void |
Asserts that two references refer to the same instance of
a Type. If not, a
TCLite.AssertionException is thrown,
ending the test and reporting it as a Failure.
static
|
DoesNotThrow |
void |
Asserts that a delegate does not throw an exception.
If any exception is thrown, it is caught and a
TCLite.AssertionException is thrown,
ending the test and reporting it as a Failure.
static
|
Equals |
bool |
The Equals method is overridden to throw a
System.InvalidOperationException .
This is done to make sure there is no mistake by calling it when
Assert.AreEqual(object, object) is actually intended.
static
|
Fail |
void |
Throws a
TCLite.AssertionException with the message
and arguments provided, ending the running test immediately
and reporting it as a Failure.
static
|
Ignore |
void |
Throws a
TCLite.IgnoreException with the message
and arguments provided, ending the running test immediately
and reporting it as Ignored.
static
|
Inconclusive |
void |
Throws a
TCLite.InconclusiveException with the message
and arguments provided, ending the running test immediately. The test
is reported as Inconclusive unless Warnings were previously recorded.
static
|
IsEmpty |
void |
Asserts that an array, list, collection or enumeration
is empty. If it is not empty a
TCLite.AssertionException
is thrown, ending the running test and reporting it as a Failure.
static
|
IsEmpty |
void |
Asserts that a string is empty. If the string is not empty
a
TCLite.AssertionException is thrown, ending
the running test and reporting it as a Failure.
static
|
IsFalse |
void |
Asserts that a condition is false. If the condition is true
the method throws a
TCLite.AssertionException ,
ending the running test and reporting it as a Failure.
static
|
IsNotEmpty |
void |
Asserts that an array, list, collection or enumeration is
not empty. If it is empty a
TCLite.AssertionException
is thrown, ending the running test and reporting it as a Failure.
static
|
IsNotEmpty |
void |
Asserts that a string is not empty. If the string is empty
a
TCLite.AssertionException is thrown, ending
the running test and reporting it as a Failure.
static
|
IsNotNull |
void |
Asserts that an object is not
null . If the object is null
a TCLite.AssertionException is thrown, ending the running
test and reporting it as a Failure.
static
|
IsNull |
void |
Asserts that an object is
null . If the object is not null
a TCLite.AssertionException is thrown, ending the running
test and reporting it as a Failure.
static
|
IsTrue |
void |
Asserts that a condition is true. If the condition is false
the method throws a
TCLite.AssertionException ,
ending the running test and reporting it as a Failure.
static
|
Pass |
void |
Throws a
TCLite.SuccessException with the message
and arguments provided, ending the running test immediately
and reporting it as successful.
static
|
ReferenceEquals |
bool |
The ReferenceEquals method is overridden to throw a
System.InvalidOperationException .
This ensures that there there is no mistake in calling this function rather than
Assert.AreSame(object, object) .
static
|
That |
void |
Asserts that a condition is true. If the condition is false
the method throws a
TCLite.AssertionException ,
ending the running test and reporting it as a Failure.
static
|
That |
void |
Apply a constraint to a
TCLite.ActualValueDelegate ,
succeeding if the constraint is satisfied and throwing an
assertion exception on failure.
static
|
That |
void |
Apply a constraint to an actual value, succeeding if the constraint
is satisfied and throwing an assertion exception on failure.
static
|
That |
void |
Apply a constraint to a referenced value, succeeding if the constraint
is satisfied and throwing an assertion exception on failure.
static
|
Throws |
Exception |
Asserts that a delegate throws an exception, which
satisfies a provided
Constraint . If no exception
is thrown or if the constraint is not satisfied, then
a TCLite.AssertionException is thrown, ending
the test and reporting it as a Failure.
static
|
Throws |
Exception |
Asserts that a delegate throws an exception of the Type
specified. If no exception is thrown or if it is of the
wrong Type, a
TCLite.AssertionException is thrown,
ending the test and reporting it as a Failure.
static
|
Throws |
T |
Asserts that a delegate throws an exception of the Type
specified. If no exception is thrown or if it is of the
wrong Type, a
TCLite.AssertionException is thrown,
ending the test and reporting it as a Failure.
static
|
Warn |
void |
Records a warning message and continues running the test.
If the test eventually completes without failing, it will
be reported with a Warning result.
static
|