Class XunitAssertions
This class contains several common assert patterns used throughout this testkit.
Implements
Inherited Members
Namespace: Akka.TestKit.Xunit2
Assembly: Akka.TestKit.Xunit2.dll
Syntax
public class XunitAssertions : 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
public 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. |
Exceptions
| Type | Condition |
|---|---|
| AkkaEqualException | This exception is thrown when the two specified values are not equal. |
AssertEqual<T>(T, T, string, params object[])
Verifies that the two specified values (expected and actual
are equal using the built-in comparison function AkkaAssertEqualityComparer<T>.
Declaration
public 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. |
Exceptions
| Type | Condition |
|---|---|
| AkkaEqualException | This exception is thrown when the two specified values are not equal. |
AssertFalse(bool, string, params object[])
Verifies that a specified condition is false.
Declaration
public 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
public Exception AssertThrows(Action action)
Parameters
| Type | Name | Description |
|---|---|---|
| Action | action |
Returns
| Type | Description |
|---|---|
| Exception |
AssertThrowsAsync(Func<Task>)
Declaration
public Task<Exception> AssertThrowsAsync(Func<Task> action)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<Task> | action |
Returns
| Type | Description |
|---|---|
| Task<Exception> |
AssertThrowsAsync<TException>(Func<Task>)
Declaration
public 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
public 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
public 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
public 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. |
Edit this page