Class SubscriberFluentBuilder<T>
Inheritance
SubscriberFluentBuilder<T>
Assembly: Akka.Streams.TestKit.dll
Syntax
public class SubscriberFluentBuilder<T>
Type Parameters
Properties
|
Improve this Doc
View Source
Probe
Declaration
public TestSubscriber.ManualProbe<T> Probe { get; }
Property Value
Methods
|
Improve this Doc
View Source
Cancel()
Fluent async DSL.
Cancel the stream.
Declaration
public SubscriberFluentBuilder<T> Cancel()
Returns
|
Improve this Doc
View Source
EnsureSubscription()
Fluent async DSL.
Ensure that the probe has received a subscription
Declaration
public SubscriberFluentBuilder<T> EnsureSubscription()
Returns
|
Improve this Doc
View Source
ExecuteAsync(Func<Task>, CancellationToken)
Declaration
public async Task ExecuteAsync(Func<Task> asyncAction = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Returns
Exceptions
|
Improve this Doc
View Source
ExpectComplete()
Fluent async DSL.
Expect completion.
Declaration
public SubscriberFluentBuilder<T> ExpectComplete()
Returns
|
Improve this Doc
View Source
ExpectComplete(Nullable<TimeSpan>)
Fluent async DSL.
Expect completion with a timeout.
Declaration
public SubscriberFluentBuilder<T> ExpectComplete(TimeSpan? timeout)
Parameters
Returns
|
Improve this Doc
View Source
ExpectErrorAsync(CancellationToken)
Execute the async chain and then expect and return the signalled System.Exception/>.
NOTE: This method will execute the async chain
Declaration
public async Task<Exception> ExpectErrorAsync(CancellationToken cancellationToken = default(CancellationToken))
Parameters
Returns
|
Improve this Doc
View Source
ExpectEvent(TestSubscriber.ISubscriberEvent)
Declaration
public SubscriberFluentBuilder<T> ExpectEvent(TestSubscriber.ISubscriberEvent e)
Parameters
Returns
|
Improve this Doc
View Source
ExpectEventAsync(Nullable<TimeSpan>, CancellationToken)
Declaration
public async Task<TestSubscriber.ISubscriberEvent> ExpectEventAsync(TimeSpan? max, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Returns
|
Improve this Doc
View Source
ExpectEventAsync(CancellationToken)
Declaration
public async Task<TestSubscriber.ISubscriberEvent> ExpectEventAsync(CancellationToken cancellationToken = default(CancellationToken))
Parameters
Returns
|
Improve this Doc
View Source
ExpectEventAsync<TOther>(Func<TestSubscriber.ISubscriberEvent, TOther>, CancellationToken)
Declaration
public async Task<TOther> ExpectEventAsync<TOther>(Func<TestSubscriber.ISubscriberEvent, TOther> func, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Returns
Type |
Description |
Task<TOther> |
|
Type Parameters
|
Improve this Doc
View Source
ExpectNext(T, Nullable<TimeSpan>)
Fluent async DSL.
Expect a stream element.
Declaration
public SubscriberFluentBuilder<T> ExpectNext(T element, TimeSpan? timeout = null)
Parameters
Returns
|
Improve this Doc
View Source
ExpectNext(T[])
Fluent async DSL.
Expect multiple stream elements.
Declaration
public SubscriberFluentBuilder<T> ExpectNext(params T[] elems)
Parameters
Type |
Name |
Description |
T[] |
elems |
|
Returns
|
Improve this Doc
View Source
ExpectNext(Nullable<TimeSpan>, T)
Fluent async DSL.
Expect a stream element during specified time or timeout.
Declaration
public SubscriberFluentBuilder<T> ExpectNext(TimeSpan? timeout, T element)
Parameters
Returns
|
Improve this Doc
View Source
ExpectNext(Nullable<TimeSpan>, T[])
Fluent async DSL.
Expect multiple stream elements during specified time or timeout.
Declaration
public SubscriberFluentBuilder<T> ExpectNext(TimeSpan? timeout, params T[] elems)
Parameters
Returns
|
Improve this Doc
View Source
ExpectNextAsync(Nullable<TimeSpan>, CancellationToken)
Execute the async chain and then expect and return a stream element during specified time or timeout.
NOTE: This method will execute the async chain
Declaration
public async Task<T> ExpectNextAsync(TimeSpan? timeout, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Returns
|
Improve this Doc
View Source
ExpectNextAsync(CancellationToken)
Execute the async chain and then expect and return a stream element.
NOTE: This method will execute the async chain
Declaration
public async Task<T> ExpectNextAsync(CancellationToken cancellationToken = default(CancellationToken))
Parameters
Returns
|
Improve this Doc
View Source
ExpectNextAsync<TOther>(Predicate<TOther>, CancellationToken)
Execute the async chain and then expect next element and test it with the predicate
NOTE: This method will execute the async chain
Declaration
public async Task<TOther> ExpectNextAsync<TOther>(Predicate<TOther> predicate, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type |
Name |
Description |
Predicate<TOther> |
predicate |
The System.Predicate{T} that is applied to the message
|
CancellationToken |
cancellationToken |
|
Returns
Type |
Description |
Task<TOther> |
The next element
|
Type Parameters
Name |
Description |
TOther |
The System.Type of the expected message
|
|
Improve this Doc
View Source
ExpectNextN(IEnumerable<T>, Nullable<TimeSpan>)
Fluent async DSL.
Expect the given elements to be signalled in order.
Declaration
public SubscriberFluentBuilder<T> ExpectNextN(IEnumerable<T> all, TimeSpan? timeout = null)
Parameters
Returns
|
Improve this Doc
View Source
ExpectNextNAsync(Int64, Nullable<TimeSpan>, CancellationToken)
Execute the async chain and then expect and return the next n
stream elements.
NOTE: This method will execute the async chain
Declaration
public async IAsyncEnumerable<T> ExpectNextNAsync(long n, TimeSpan? timeout = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Returns
Type |
Description |
System.Collections.Generic.IAsyncEnumerable<T> |
|
|
Improve this Doc
View Source
ExpectNextOrComplete(T)
Fluent async DSL.
Expect given next element or stream completion.
Declaration
public SubscriberFluentBuilder<T> ExpectNextOrComplete(T element)
Parameters
Type |
Name |
Description |
T |
element |
|
Returns
|
Improve this Doc
View Source
ExpectNextOrCompleteAsync(CancellationToken)
Execute the async chain and then expect given next element or stream completion, returning whichever was signaled.
NOTE: This method will execute the async chain
Declaration
public async Task<object> ExpectNextOrCompleteAsync(CancellationToken cancellationToken = default(CancellationToken))
Parameters
Returns
|
Improve this Doc
View Source
ExpectNextOrError(T, Exception)
Fluent async DSL.
Expect given next element or error signal.
Declaration
public SubscriberFluentBuilder<T> ExpectNextOrError(T element, Exception cause)
Parameters
Type |
Name |
Description |
T |
element |
|
Exception |
cause |
|
Returns
|
Improve this Doc
View Source
ExpectNextOrErrorAsync(CancellationToken)
Execute the async chain and then expect given next element or error signal, returning whichever was signaled.
NOTE: This method will execute the async chain
Declaration
public async Task<object> ExpectNextOrErrorAsync(CancellationToken cancellationToken = default(CancellationToken))
Parameters
Returns
|
Improve this Doc
View Source
ExpectNextUnordered(T[])
Fluent async DSL.
Expect multiple stream elements in arbitrary order.
Declaration
public SubscriberFluentBuilder<T> ExpectNextUnordered(params T[] elems)
Parameters
Type |
Name |
Description |
T[] |
elems |
|
Returns
|
Improve this Doc
View Source
ExpectNextUnordered(Nullable<TimeSpan>, T[])
Fluent async DSL.
Expect multiple stream elements in arbitrary order during specified time or timeout.
Declaration
public SubscriberFluentBuilder<T> ExpectNextUnordered(TimeSpan? timeout, params T[] elems)
Parameters
Returns
|
Improve this Doc
View Source
ExpectNextUnorderedN(IEnumerable<T>, Nullable<TimeSpan>)
Fluent async DSL.
Expect the given elements to be signalled in any order.
Declaration
public SubscriberFluentBuilder<T> ExpectNextUnorderedN(IEnumerable<T> all, TimeSpan? timeout = null)
Parameters
Returns
|
Improve this Doc
View Source
ExpectNextWithinSet(ICollection<T>)
Fluent async DSL.
Expect a single stream element matching one of the element in a list. Found element is removed from the list.
Declaration
public SubscriberFluentBuilder<T> ExpectNextWithinSet(ICollection<T> elems)
Parameters
Returns
|
Improve this Doc
View Source
ExpectNoMsg()
Declaration
public SubscriberFluentBuilder<T> ExpectNoMsg()
Returns
|
Improve this Doc
View Source
ExpectNoMsg(TimeSpan)
Fluent async DSL.
Assert that no message is received for the specified time.
Declaration
public SubscriberFluentBuilder<T> ExpectNoMsg(TimeSpan remaining)
Parameters
Type |
Name |
Description |
TimeSpan |
remaining |
|
Returns
|
Improve this Doc
View Source
ExpectSubscriptionAndComplete()
Fluent async DSL.
Expect subscription followed by immediate stream completion.
By default single demand will be signaled in order to wake up a possibly lazy upstream.
Declaration
public SubscriberFluentBuilder<T> ExpectSubscriptionAndComplete()
Returns
See Also
|
Improve this Doc
View Source
ExpectSubscriptionAndComplete(Boolean)
Fluent async DSL.
Expect subscription followed by immediate stream completion. Depending on the signalDemand
parameter
demand may be signaled immediately after obtaining the subscription in order to wake up a possibly lazy upstream.
You can disable this by setting the signalDemand
parameter to false
.
Declaration
public SubscriberFluentBuilder<T> ExpectSubscriptionAndComplete(bool signalDemand)
Parameters
Type |
Name |
Description |
Boolean |
signalDemand |
|
Returns
See Also
|
Improve this Doc
View Source
ExpectSubscriptionAndErrorAsync(Boolean, CancellationToken)
Execute the async chain and then expect subscription to be followed immediately by an error signal.
Depending on the signalDemand
parameter demand may be signaled immediately after obtaining
the subscription in order to wake up a possibly lazy upstream.
You can disable this by setting the signalDemand
parameter to false
.
NOTE: This method will execute the async chain
ExpectSubscriptionAndErrorAsync(CancellationToken)
Declaration
public async Task<Exception> ExpectSubscriptionAndErrorAsync(bool signalDemand, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Returns
|
Improve this Doc
View Source
ExpectSubscriptionAndErrorAsync(CancellationToken)
Declaration
public async Task<Exception> ExpectSubscriptionAndErrorAsync(CancellationToken cancellationToken = default(CancellationToken))
Parameters
Returns
|
Improve this Doc
View Source
ExpectSubscriptionAsync(CancellationToken)
Execute the async chain and then expect and returns a Reactive.Streams.ISubscription/>.
NOTE: This method will execute the async chain
Declaration
public async Task<ISubscription> ExpectSubscriptionAsync(CancellationToken cancellationToken = default(CancellationToken))
Parameters
Returns
Type |
Description |
Task<Reactive.Streams.ISubscription> |
|
|
Improve this Doc
View Source
MatchNext<TOther>(Predicate<TOther>)
Fluent async DSL.
Expect next element and test it with the predicate
Declaration
public SubscriberFluentBuilder<T> MatchNext<TOther>(Predicate<TOther> predicate)
Parameters
Type |
Name |
Description |
Predicate<TOther> |
predicate |
The System.Predicate{T} that is applied to the message
|
Returns
Type Parameters
Name |
Description |
TOther |
The System.Type of the expected message
|
|
Improve this Doc
View Source
ReceiveWhileAsync<TOther>(Nullable<TimeSpan>, Nullable<TimeSpan>, Func<Object, TOther>, Int32, CancellationToken)
Execute the async chain and then receive messages for a given duration or until one does not match a given filter function.
NOTE: This method will execute the async chain
Declaration
public async IAsyncEnumerable<TOther> ReceiveWhileAsync<TOther>(TimeSpan? max = null, TimeSpan? idle = null, Func<object, TOther> filter = null, int msgs = 2147483647, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Returns
Type |
Description |
System.Collections.Generic.IAsyncEnumerable<TOther> |
|
Type Parameters
|
Improve this Doc
View Source
ReceiveWithinAsync<TOther>(Nullable<TimeSpan>, Int32, CancellationToken)
Execute the async chain and then drains a given number of messages
NOTE: This method will execute the async chain
Declaration
public async IAsyncEnumerable<TOther> ReceiveWithinAsync<TOther>(TimeSpan? max, int messages = 2147483647, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Returns
Type |
Description |
System.Collections.Generic.IAsyncEnumerable<TOther> |
|
Type Parameters
|
Improve this Doc
View Source
Request(Int64)
Fluent async DSL.
Request a specified number of elements.
Declaration
public SubscriberFluentBuilder<T> Request(long n)
Parameters
Type |
Name |
Description |
Int64 |
n |
|
Returns
|
Improve this Doc
View Source
RequestNext(T)
Fluent async DSL.
Request and expect a stream element.
Declaration
public SubscriberFluentBuilder<T> RequestNext(T element)
Parameters
Type |
Name |
Description |
T |
element |
|
Returns
|
Improve this Doc
View Source
RequestNextN(T[])
Fluent async DSL.
Request and expect a stream element.
Declaration
public SubscriberFluentBuilder<T> RequestNextN(params T[] elements)
Parameters
Type |
Name |
Description |
T[] |
elements |
|
Returns
|
Improve this Doc
View Source
ToStrictAsync(TimeSpan, CancellationToken)
Execute the async chain and then attempt to drain the stream into an IAsyncEnumerable (by requesting long.MaxValue elements).
NOTE: This method will execute the async chain
Declaration
public async IAsyncEnumerable<T> ToStrictAsync(TimeSpan atMost, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Returns
Type |
Description |
System.Collections.Generic.IAsyncEnumerable<T> |
|
|
Improve this Doc
View Source
WithinAsync<TOther>(TimeSpan, Func<Task<TOther>>, Nullable<TimeSpan>, CancellationToken)
Execute the async chain and then execute code block while bounding its execution time with a max
timeout.
var ret = await probe.AsyncBuilder().WithinAsync(Timespan.FromSeconds(3), async () =>
{
test.Tell("ping");
return await ExpectMsgAsync<string>();
});
NOTE: This method will execute the async chain
Declaration
public async Task<TOther> WithinAsync<TOther>(TimeSpan max, Func<Task<TOther>> actionAsync, TimeSpan? epsilonValue = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Returns
Type |
Description |
Task<TOther> |
|
Type Parameters
|
Improve this Doc
View Source
WithinAsync<TOther>(TimeSpan, TimeSpan, Func<Task<TOther>>, String, Nullable<TimeSpan>, CancellationToken)
Execute the async chain and then execute the code block while bounding its execution time between min
and max
.
Note that the timeout is scaled using Dilated(TimeSpan), which uses the
configuration entry "akka.test.timefactor", while the min Duration is not.
var ret = await probe.AsyncBuilder().WithinAsync(Timespan.FromMilliseconds(50), Timespan.FromSeconds(3), async () =>
{
test.Tell("ping");
await ExpectMsgAsync<string>("expected");
});
NOTE: This method will execute the async chain
Declaration
public async Task<TOther> WithinAsync<TOther>(TimeSpan min, TimeSpan max, Func<Task<TOther>> asyncFunction, string hint = null, TimeSpan? epsilonValue = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Returns
Type |
Description |
Task<TOther> |
|
Type Parameters
Extension Methods