ObjectAssertions<TSelf, T> Class
Definition
Base class for assertions on a value, providing null checks, equality and type checking. Derived classes pass themselves as TSelf so that assertions defined here return a chain whose And is the derived type.
c#
public abstract class ObjectAssertions<TSelf, T>
where TSelf : ObjectAssertions<TSelf, T>Type Parameters
| Name | Description |
|---|---|
TSelf | The type of the derived assertions class, returned from And to allow chaining. |
T | The type of the value being asserted on. |
Constructors
| Name | Description |
|---|---|
ObjectAssertions(T) | Base class for assertions on a value, providing null checks, equality and type checking. Derived classes pass themselves as TSelf so that assertions defined here return a chain whose And is the derived type. |
Properties
| Name | Description |
|---|---|
Value | Gets the value being asserted on. |
Methods
| Name | Description |
|---|---|
BeNull() | Asserts that the value is null. |
BeOfType<TOther>() | Asserts that the value is assignable to the specified type. |
BeTheSameInstanceAs(T) | Asserts that the value is the same instance as the expected value. |
Equal(T) | Asserts that the value is equal to the expected value using the default equality comparer. |
Equal(T, IEqualityComparer<T>) | Asserts that the value is equal to the expected value using the specified equality comparer. |
Equal(T, Func<T, T, Boolean>) | |
Equals(Object) | Determines whether the specified object is equal to the current object. |
GetHashCode() | Serves as the default hash function. |
GetType() | Not supported. This method is hidden to prevent accidental use. |
NotBeNull() | Asserts that the value is not null. |
NotBeOfType<TOther>() | Asserts that the value is not assignable to the specified type. |
NotBeTheSameInstanceAs(T) | Asserts that the value is not the same instance as the expected value. |
NotEqual(T) | Asserts that the value is not equal to the expected value using the default equality comparer. |
NotEqual(T, IEqualityComparer<T>) | Asserts that the value is not equal to the expected value using the specified equality comparer. |
NotEqual(T, Func<T, T, Boolean>) | |
ToString() | Returns a string that represents the current object. |