Class PublisherFluentBuilder<T>
Inheritance
PublisherFluentBuilder<T>
Assembly: Akka.Streams.TestKit.dll
Syntax
public class PublisherFluentBuilder<T>
Type Parameters
Properties
|
Improve this Doc
View Source
Probe
Declaration
public TestPublisher.ManualProbe<T> Probe { get; }
Property Value
Methods
|
Improve this Doc
View Source
EnsureSubscription()
Asserts that a subscription has been received or will be received
Declaration
public PublisherFluentBuilder<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
ExpectCancellation()
Declaration
public PublisherFluentBuilder<T> ExpectCancellation()
Returns
|
Improve this Doc
View Source
ExpectEventAsync(CancellationToken)
Execute the async chain and then expect a publisher event from the stream.
NOTE: This method will execute the async chain
Declaration
public async Task<TestPublisher.IPublisherEvent> ExpectEventAsync(CancellationToken cancellationToken = default(CancellationToken))
Parameters
Returns
|
Improve this Doc
View Source
ExpectNoMsg()
Fluent async DSL
Expect no messages.
Declaration
public PublisherFluentBuilder<T> ExpectNoMsg()
Returns
|
Improve this Doc
View Source
ExpectNoMsg(TimeSpan, CancellationToken)
Fluent async DSL
Expect no messages for given duration.
Declaration
public PublisherFluentBuilder<T> ExpectNoMsg(TimeSpan duration, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Returns
|
Improve this Doc
View Source
ExpectRequest(ISubscription, Int32)
Fluent async DSL
Expect demand from the given subscription.
Declaration
public PublisherFluentBuilder<T> ExpectRequest(ISubscription subscription, int nrOfElements)
Parameters
Type |
Name |
Description |
Reactive.Streams.ISubscription |
subscription |
|
Int32 |
nrOfElements |
|
Returns
|
Improve this Doc
View Source
ExpectRequestAsync(CancellationToken)
Declaration
public async Task<long> ExpectRequestAsync(CancellationToken cancellationToken = default(CancellationToken))
Parameters
Returns
|
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 partial 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 msgCount = 2147483647, CancellationToken cancellationToken = default(CancellationToken))
where TOther : class
Parameters
Returns
Type |
Description |
System.Collections.Generic.IAsyncEnumerable<TOther> |
|
Type Parameters
|
Improve this Doc
View Source
SendComplete()
Declaration
public PublisherFluentBuilder<T> SendComplete()
Returns
|
Improve this Doc
View Source
SendError(Exception)
Declaration
public PublisherFluentBuilder<T> SendError(Exception e)
Parameters
Returns
|
Improve this Doc
View Source
SendNext(T)
Declaration
public PublisherFluentBuilder<T> SendNext(T element)
Parameters
Type |
Name |
Description |
T |
element |
|
Returns
|
Improve this Doc
View Source
SendNext(IEnumerable<T>)
Declaration
public PublisherFluentBuilder<T> SendNext(IEnumerable<T> elements)
Parameters
Returns
|
Improve this Doc
View Source
UnsafeSendNext(T)
Declaration
public PublisherFluentBuilder<T> UnsafeSendNext(T element)
Parameters
Type |
Name |
Description |
T |
element |
|
Returns
|
Improve this Doc
View Source
WithinAsync<TOther>(TimeSpan, Func<Task<TOther>>, CancellationToken)
Sane as calling WithinAsync(TimeSpan.Zero, max, function, cancellationToken).
NOTE: This method will execute the async chain
Declaration
public async Task<TOther> WithinAsync<TOther>(TimeSpan max, Func<Task<TOther>> execute, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Returns
Type |
Description |
Task<TOther> |
|
Type Parameters
|
Improve this Doc
View Source
WithinAsync<TOther>(TimeSpan, TimeSpan, Func<Task<TOther>>, CancellationToken)
Execute the async chain and then execute the code block while bounding its execution time between min
and
max
. WithinAsync<TOther>(TimeSpan, TimeSpan, Func<Task<TOther>>, CancellationToken) blocks may be nested.
All methods in this class which take maximum wait times are available in a version which implicitly uses
the remaining time governed by the innermost enclosing WithinAsync<TOther>(TimeSpan, TimeSpan, Func<Task<TOther>>, CancellationToken) block.
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().Within(Timespan.FromMilliseconds(50), 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 min, TimeSpan max, Func<Task<TOther>> function, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Returns
Type |
Description |
Task<TOther> |
|
Type Parameters
Extension Methods