Search Results for

    Show / Hide Table of Contents

    Class SubscriberFluentBuilder<T>

    Inheritance
    object
    SubscriberFluentBuilder<T>
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Akka.Streams.TestKit
    Assembly: Akka.Streams.TestKit.dll
    Syntax
    public class SubscriberFluentBuilder<T>
    Type Parameters
    Name Description
    T

    Properties

    | Edit this page View Source

    Probe

    Declaration
    public TestSubscriber.ManualProbe<T> Probe { get; }
    Property Value
    Type Description
    TestSubscriber.ManualProbe<T>

    Methods

    | Edit this page View Source

    Cancel()

    Fluent async DSL. Cancel the stream.

    Declaration
    public SubscriberFluentBuilder<T> Cancel()
    Returns
    Type Description
    SubscriberFluentBuilder<T>
    | Edit this page View Source

    EnsureSubscription()

    Fluent async DSL. Ensure that the probe has received a subscription

    Declaration
    public SubscriberFluentBuilder<T> EnsureSubscription()
    Returns
    Type Description
    SubscriberFluentBuilder<T>
    | Edit this page View Source

    ExecuteAsync(Func<Task>?, CancellationToken)

    Execute the async chain.

    Declaration
    public Task ExecuteAsync(Func<Task>? asyncAction = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Func<Task> asyncAction
    CancellationToken cancellationToken
    Returns
    Type Description
    Task
    Exceptions
    Type Condition
    InvalidOperationException
    | Edit this page View Source

    ExpectComplete()

    Fluent async DSL. Expect completion.

    Declaration
    public SubscriberFluentBuilder<T> ExpectComplete()
    Returns
    Type Description
    SubscriberFluentBuilder<T>
    | Edit this page View Source

    ExpectComplete(TimeSpan?)

    Fluent async DSL. Expect completion with a timeout.

    Declaration
    public SubscriberFluentBuilder<T> ExpectComplete(TimeSpan? timeout)
    Parameters
    Type Name Description
    TimeSpan? timeout
    Returns
    Type Description
    SubscriberFluentBuilder<T>
    | Edit this page 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 Task<Exception> ExpectErrorAsync(CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<Exception>
    | Edit this page View Source

    ExpectEvent(ISubscriberEvent)

    Fluent async DSL. Expect and return TestSubscriber.ISubscriberEvent (any of: TestSubscriber.OnSubscribe, TestSubscriber.OnNext<T>, TestSubscriber.OnError or TestSubscriber.OnComplete).

    Declaration
    public SubscriberFluentBuilder<T> ExpectEvent(TestSubscriber.ISubscriberEvent e)
    Parameters
    Type Name Description
    TestSubscriber.ISubscriberEvent e
    Returns
    Type Description
    SubscriberFluentBuilder<T>
    | Edit this page View Source

    ExpectEventAsync(TimeSpan?, CancellationToken)

    Execute the async chain and then expect and return a TestSubscriber.ISubscriberEvent (any of: TestSubscriber.OnSubscribe, TestSubscriber.OnNext<T>, TestSubscriber.OnError or TestSubscriber.OnComplete). NOTE: This method will execute the async chain

    Declaration
    public Task<TestSubscriber.ISubscriberEvent> ExpectEventAsync(TimeSpan? max, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan? max
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<TestSubscriber.ISubscriberEvent>
    | Edit this page View Source

    ExpectEventAsync(CancellationToken)

    Execute the async chain and then expect and return a TestSubscriber.ISubscriberEvent (any of: TestSubscriber.OnSubscribe, TestSubscriber.OnNext<T>, TestSubscriber.OnError or TestSubscriber.OnComplete). NOTE: This method will execute the async chain

    Declaration
    public Task<TestSubscriber.ISubscriberEvent> ExpectEventAsync(CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<TestSubscriber.ISubscriberEvent>
    | Edit this page View Source

    ExpectEventAsync<TOther>(Func<ISubscriberEvent, TOther>, CancellationToken)

    Declaration
    public Task<TOther> ExpectEventAsync<TOther>(Func<TestSubscriber.ISubscriberEvent, TOther> func, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Func<TestSubscriber.ISubscriberEvent, TOther> func
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<TOther>
    Type Parameters
    Name Description
    TOther
    | Edit this page View Source

    ExpectNext(TimeSpan?, T)

    Fluent async DSL. Expect a stream element during specified time or timeout.

    Declaration
    public SubscriberFluentBuilder<T> ExpectNext(TimeSpan? timeout, T element)
    Parameters
    Type Name Description
    TimeSpan? timeout
    T element
    Returns
    Type Description
    SubscriberFluentBuilder<T>
    | Edit this page View Source

    ExpectNext(TimeSpan?, params T[])

    Fluent async DSL. Expect multiple stream elements during specified time or timeout.

    Declaration
    public SubscriberFluentBuilder<T> ExpectNext(TimeSpan? timeout, params T[] elems)
    Parameters
    Type Name Description
    TimeSpan? timeout
    T[] elems
    Returns
    Type Description
    SubscriberFluentBuilder<T>
    | Edit this page View Source

    ExpectNext(T, TimeSpan?)

    Fluent async DSL. Expect a stream element.

    Declaration
    public SubscriberFluentBuilder<T> ExpectNext(T element, TimeSpan? timeout = null)
    Parameters
    Type Name Description
    T element
    TimeSpan? timeout
    Returns
    Type Description
    SubscriberFluentBuilder<T>
    | Edit this page View Source

    ExpectNext(params T[])

    Fluent async DSL. Expect multiple stream elements.

    Declaration
    public SubscriberFluentBuilder<T> ExpectNext(params T[] elems)
    Parameters
    Type Name Description
    T[] elems
    Returns
    Type Description
    SubscriberFluentBuilder<T>
    | Edit this page View Source

    ExpectNextAsync(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 Task<T> ExpectNextAsync(TimeSpan? timeout, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan? timeout
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<T>
    | Edit this page 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 Task<T> ExpectNextAsync(CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<T>
    | Edit this page 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 Task<TOther> ExpectNextAsync<TOther>(Predicate<TOther> predicate, CancellationToken cancellationToken = default)
    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

    | Edit this page View Source

    ExpectNextN(IEnumerable<T>, 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
    Type Name Description
    IEnumerable<T> all
    TimeSpan? timeout
    Returns
    Type Description
    SubscriberFluentBuilder<T>
    | Edit this page View Source

    ExpectNextNAsync(long, 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 IAsyncEnumerable<T> ExpectNextNAsync(long n, TimeSpan? timeout = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    long n
    TimeSpan? timeout
    CancellationToken cancellationToken
    Returns
    Type Description
    IAsyncEnumerable<T>
    | Edit this page 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
    Type Description
    SubscriberFluentBuilder<T>
    | Edit this page 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 Task<object> ExpectNextOrCompleteAsync(CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<object>
    | Edit this page 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
    Type Description
    SubscriberFluentBuilder<T>
    | Edit this page 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 Task<object> ExpectNextOrErrorAsync(CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<object>
    | Edit this page View Source

    ExpectNextUnordered(TimeSpan?, params 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
    Type Name Description
    TimeSpan? timeout
    T[] elems
    Returns
    Type Description
    SubscriberFluentBuilder<T>
    | Edit this page View Source

    ExpectNextUnordered(params 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
    Type Description
    SubscriberFluentBuilder<T>
    | Edit this page View Source

    ExpectNextUnorderedN(IEnumerable<T>, 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
    Type Name Description
    IEnumerable<T> all
    TimeSpan? timeout
    Returns
    Type Description
    SubscriberFluentBuilder<T>
    | Edit this page 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
    Type Name Description
    ICollection<T> elems
    Returns
    Type Description
    SubscriberFluentBuilder<T>
    | Edit this page View Source

    ExpectNoMsg()

    Fluent async DSL. Same as ExpectNoMsg(TimeSpan), but correctly treating the timeFactor.

    Declaration
    public SubscriberFluentBuilder<T> ExpectNoMsg()
    Returns
    Type Description
    SubscriberFluentBuilder<T>
    | Edit this page 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
    Type Description
    SubscriberFluentBuilder<T>
    | Edit this page 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
    Type Description
    SubscriberFluentBuilder<T>
    See Also
    ExpectSubscriptionAndComplete(bool)
    | Edit this page View Source

    ExpectSubscriptionAndComplete(bool)

    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
    bool signalDemand
    Returns
    Type Description
    SubscriberFluentBuilder<T>
    See Also
    ExpectSubscriptionAndComplete()
    | Edit this page View Source

    ExpectSubscriptionAndErrorAsync(bool, 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 Task<Exception> ExpectSubscriptionAndErrorAsync(bool signalDemand, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    bool signalDemand
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<Exception>
    | Edit this page View Source

    ExpectSubscriptionAndErrorAsync(CancellationToken)

    Execute the async chain and then expect subscription to be followed immediately by an error signal. By default single demand will be signaled in order to wake up a possibly lazy upstream. NOTE: This method will execute the async chain ExpectSubscriptionAndErrorAsync(bool, CancellationToken)

    Declaration
    public Task<Exception> ExpectSubscriptionAndErrorAsync(CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<Exception>
    | Edit this page 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 Task<ISubscription> ExpectSubscriptionAsync(CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<ISubscription>
    | Edit this page 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 Description
    SubscriberFluentBuilder<T>

    this

    Type Parameters
    Name Description
    TOther

    The System.Type of the expected message

    | Edit this page View Source

    ReceiveWhileAsync<TOther>(TimeSpan?, TimeSpan?, Func<object, TOther>?, int, 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 IAsyncEnumerable<TOther> ReceiveWhileAsync<TOther>(TimeSpan? max = null, TimeSpan? idle = null, Func<object, TOther>? filter = null, int msgs = 2147483647, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan? max
    TimeSpan? idle
    Func<object, TOther> filter
    int msgs
    CancellationToken cancellationToken
    Returns
    Type Description
    IAsyncEnumerable<TOther>
    Type Parameters
    Name Description
    TOther
    | Edit this page View Source

    ReceiveWithinAsync<TOther>(TimeSpan?, int, CancellationToken)

    Execute the async chain and then drains a given number of messages NOTE: This method will execute the async chain

    Declaration
    public IAsyncEnumerable<TOther> ReceiveWithinAsync<TOther>(TimeSpan? max, int messages = 2147483647, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan? max
    int messages
    CancellationToken cancellationToken
    Returns
    Type Description
    IAsyncEnumerable<TOther>
    Type Parameters
    Name Description
    TOther
    | Edit this page View Source

    Request(long)

    Fluent async DSL. Request a specified number of elements.

    Declaration
    public SubscriberFluentBuilder<T> Request(long n)
    Parameters
    Type Name Description
    long n
    Returns
    Type Description
    SubscriberFluentBuilder<T>
    | Edit this page 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
    Type Description
    SubscriberFluentBuilder<T>
    | Edit this page View Source

    RequestNextN(params 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
    Type Description
    SubscriberFluentBuilder<T>
    | Edit this page 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 IAsyncEnumerable<T> ToStrictAsync(TimeSpan atMost, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan atMost
    CancellationToken cancellationToken
    Returns
    Type Description
    IAsyncEnumerable<T>
    | Edit this page View Source

    WithinAsync<TOther>(TimeSpan, Func<Task<TOther>>, 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 Task<TOther> WithinAsync<TOther>(TimeSpan max, Func<Task<TOther>> actionAsync, TimeSpan? epsilonValue = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan max
    Func<Task<TOther>> actionAsync
    TimeSpan? epsilonValue
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<TOther>
    Type Parameters
    Name Description
    TOther
    | Edit this page View Source

    WithinAsync<TOther>(TimeSpan, TimeSpan, Func<Task<TOther>>, string?, 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 Task<TOther> WithinAsync<TOther>(TimeSpan min, TimeSpan max, Func<Task<TOther>> asyncFunction, string? hint = null, TimeSpan? epsilonValue = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan min
    TimeSpan max
    Func<Task<TOther>> asyncFunction
    string hint
    TimeSpan? epsilonValue
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<TOther>
    Type Parameters
    Name Description
    TOther

    Extension Methods

    ObjectExtensions.IsDefaultForType<T>(T)
    ObjectExtensions.AsOption<T>(T)
    Extensions.AsInstanceOf<T>(object)
    In this article
    • githubEdit this page
    • View Source
    Back to top
    Contribute
    • Project Chat
    • Discussion Forum
    • Source Code
    Support
    • Akka.NET Support Plans
    • Akka.NET Observability Tools
    • Akka.NET Training & Consulting
    Maintained By
    • Petabridge - The Akka.NET Company
    • Learn Akka.NET