Interface ITestQueue<T>
Namespace: Akka.TestKit.Internal
Assembly: Akka.TestKit.dll
Syntax
public interface ITestQueue<T>
Type Parameters
Name | Description |
---|---|
T |
Properties
| Improve this Doc View SourceCount
The number of items that are currently in the queue.
Declaration
int Count { get; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
| Improve this Doc View SourceEnqueue(T)
Adds the specified item to the end of the queue.
Declaration
void Enqueue(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The item to add to the queue. |
EnqueueAsync(T)
Adds the specified item to the end of the queue.
Declaration
ValueTask EnqueueAsync(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The item to add to the queue. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask |
Peek(CancellationToken)
Peek an item from the collection.
Declaration
T Peek(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | The cancellation token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
T | The item removed from the collection. |
Exceptions
Type | Condition |
---|---|
OperationCanceledException | This exception is thrown when the operation is canceled. |
PeekAsync(CancellationToken)
Peek an item from the collection.
Declaration
ValueTask<T> PeekAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | The cancellation token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<T> | The item removed from the collection. |
Exceptions
Type | Condition |
---|---|
OperationCanceledException | This exception is thrown when the operation is canceled. |
Take(CancellationToken)
Removes an item from the collection.
Declaration
T Take(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | The cancellation token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
T | The item removed from the collection. |
Exceptions
Type | Condition |
---|---|
OperationCanceledException | This exception is thrown when the operation is canceled. |
TakeAsync(CancellationToken)
Removes an item from the collection.
Declaration
ValueTask<T> TakeAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | The cancellation token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<T> | The item removed from the collection. |
Exceptions
Type | Condition |
---|---|
OperationCanceledException | This exception is thrown when the operation is canceled. |
ToList()
Copies the items from the ITestQueue<T> instance into a new List<T>.
Declaration
[Obsolete("This method will be removed in the future")]
List<T> ToList()
Returns
Type | Description |
---|---|
List<T> | A List<T> containing copies of the elements of the collection |
TryEnqueue(T, Int32, CancellationToken)
Tries to add the specified item to the end of the queue within the specified time period. A token can be provided to cancel the operation if needed.
Declaration
bool TryEnqueue(T item, int millisecondsTimeout, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
T | item | The item to add to the queue. |
Int32 | millisecondsTimeout | The number of milliseconds to wait for the add to complete. |
CancellationToken | cancellationToken | The cancellation token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
Boolean |
|
TryEnqueueAsync(T, Int32, CancellationToken)
Tries to add the specified item to the end of the queue within the specified time period. A token can be provided to cancel the operation if needed.
Declaration
ValueTask<bool> TryEnqueueAsync(T item, int millisecondsTimeout, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
T | item | The item to add to the queue. |
Int32 | millisecondsTimeout | The number of milliseconds to wait for the add to complete. |
CancellationToken | cancellationToken | The cancellation token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<Boolean> |
|
TryPeek(out T)
Tries to peek the specified item from the queue.
Declaration
bool TryPeek(out T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The item to remove from the queue. |
Returns
Type | Description |
---|---|
Boolean |
|
TryPeek(out T, Int32, CancellationToken)
Tries to peek the specified item from the queue within the specified time period. A token can be provided to cancel the operation if needed.
Declaration
bool TryPeek(out T item, int millisecondsTimeout, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
T | item | The item to remove from the queue. |
Int32 | millisecondsTimeout | The number of milliseconds to wait for the remove to complete. |
CancellationToken | cancellationToken | The cancellation token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
Boolean |
|
TryPeekAsync(Int32, CancellationToken)
Tries to peek the specified item from the queue within the specified time period. A token can be provided to cancel the operation if needed.
Declaration
ValueTask<(bool success, T item)> TryPeekAsync(int millisecondsTimeout, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
Int32 | millisecondsTimeout | The number of milliseconds to wait for the remove to complete. |
CancellationToken | cancellationToken | The cancellation token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.ValueTuple<Boolean, T>> | a tuple of |
TryPeekAsync(CancellationToken)
Tries to peek the specified item from the queue.
Declaration
ValueTask<(bool success, T item)> TryPeekAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | The cancellation token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.ValueTuple<Boolean, T>> | a tuple of |
TryTake(out T, Int32, CancellationToken)
Tries to remove the specified item from the queue within the specified time period. A token can be provided to cancel the operation if needed.
Declaration
bool TryTake(out T item, int millisecondsTimeout, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
T | item | The item to remove from the queue. |
Int32 | millisecondsTimeout | The number of milliseconds to wait for the remove to complete. |
CancellationToken | cancellationToken | The cancellation token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
Boolean |
|
TryTake(out T, CancellationToken)
Tries to remove the specified item from the queue.
Declaration
bool TryTake(out T item, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
T | item | The item to remove from the queue. |
CancellationToken | cancellationToken | The cancellation token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
Boolean |
|
TryTakeAsync(Int32, CancellationToken)
Tries to remove the specified item from the queue within the specified time period. A token can be provided to cancel the operation if needed.
Declaration
ValueTask<(bool success, T item)> TryTakeAsync(int millisecondsTimeout, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
Int32 | millisecondsTimeout | The number of milliseconds to wait for the remove to complete. |
CancellationToken | cancellationToken | The cancellation token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.ValueTuple<Boolean, T>> | a tuple of |
TryTakeAsync(CancellationToken)
Tries to remove the specified item from the queue.
Declaration
ValueTask<(bool success, T item)> TryTakeAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | The cancellation token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.ValueTuple<Boolean, T>> | a tuple of |