Interface ITestKitAssertions
This interface defines several common assert patterns used in the various testkits.
Namespace: Akka.TestKit
Assembly: Akka.TestKit.dll
Syntax
public interface ITestKitAssertions
Methods
| Edit this page View SourceAssertEqual<T>(T, T, Func<T, T, bool>, string, params object[])
Verifies that the two specified values (expected
and actual
are equal using a specified comparison function comparer
.
Declaration
void AssertEqual<T>(T expected, T actual, Func<T, T, bool> comparer, string format = "", params object[] args)
Parameters
Type | Name | Description |
---|---|---|
T | expected | The expected value of the object |
T | actual | The actual value of the object |
Func<T, T, bool> | comparer | The function used to compare the two specified values. |
string | format | A template string to display if the assertion fails. |
object[] | args | An optional object array that contains zero or more objects to format. |
Type Parameters
Name | Description |
---|---|
T | The type that is being compared. |
AssertEqual<T>(T, T, string, params object[])
Verifies that the two specified values (expected
and actual
are equal.
Declaration
void AssertEqual<T>(T expected, T actual, string format = "", params object[] args)
Parameters
Type | Name | Description |
---|---|---|
T | expected | The expected value of the object |
T | actual | The actual value of the object |
string | format | A template string to display if the assertion fails. |
object[] | args | An optional object array that contains zero or more objects to format. |
Type Parameters
Name | Description |
---|---|
T | The type that is being compared. |
AssertFalse(bool, string, params object[])
Verifies that a specified condition
is false.
Declaration
void AssertFalse(bool condition, string format = "", params object[] args)
Parameters
Type | Name | Description |
---|---|---|
bool | condition | The condition that is being verified. |
string | format | A template string to display if the assertion fails. |
object[] | args | An optional object array that contains zero or more objects to format. |
AssertThrows(Action)
Declaration
Exception AssertThrows(Action action)
Parameters
Type | Name | Description |
---|---|---|
Action | action |
Returns
Type | Description |
---|---|
Exception |
AssertThrowsAsync(Func<Task>)
Declaration
Task<Exception> AssertThrowsAsync(Func<Task> action)
Parameters
Type | Name | Description |
---|---|---|
Func<Task> | action |
Returns
Type | Description |
---|---|
Task<Exception> |
AssertThrowsAsync<TException>(Func<Task>)
Declaration
Task<TException> AssertThrowsAsync<TException>(Func<Task> action) where TException : Exception
Parameters
Type | Name | Description |
---|---|---|
Func<Task> | action |
Returns
Type | Description |
---|---|
Task<TException> |
Type Parameters
Name | Description |
---|---|
TException |
AssertThrows<TException>(Action)
Declaration
TException AssertThrows<TException>(Action action) where TException : Exception
Parameters
Type | Name | Description |
---|---|---|
Action | action |
Returns
Type | Description |
---|---|
TException |
Type Parameters
Name | Description |
---|---|
TException |
AssertTrue(bool, string, params object[])
Verifies that a specified condition
is true.
Declaration
void AssertTrue(bool condition, string format = "", params object[] args)
Parameters
Type | Name | Description |
---|---|---|
bool | condition | The condition that is being verified |
string | format | A template string to display if the assertion fails |
object[] | args | An optional object array that contains zero or more objects to format. |
Fail(string, params object[])
Fails an assertion without checking any conditions.
Declaration
void Fail(string format = "", params object[] args)
Parameters
Type | Name | Description |
---|---|---|
string | format | A template string to display if the assertion fails |
object[] | args | An optional object array that contains zero or more objects to format. |