Search Results for

    Show / Hide Table of Contents

    Class TestPublisher.ManualProbe<T>

    Implementation of Reactive.Streams.IPublisher{T} that allows various assertions. This probe does not track demand.Therefore you need to expect demand before sending elements downstream.

    Inheritance
    object
    TestPublisher.ManualProbe<T>
    TestPublisher.Probe<T>
    Implements
    IPublisher<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 TestPublisher.ManualProbe<T> : IPublisher<T>
    Type Parameters
    Name Description
    T

    Properties

    | Edit this page View Source

    AutoOnSubscribe

    Declaration
    public bool AutoOnSubscribe { get; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    Probe

    Declaration
    public TestProbe Probe { get; }
    Property Value
    Type Description
    TestProbe
    | Edit this page View Source

    Publisher

    Declaration
    public IPublisher<T> Publisher { get; }
    Property Value
    Type Description
    IPublisher<T>
    | Edit this page View Source

    Subscription

    Declaration
    public StreamTestKit.PublisherProbeSubscription<T> Subscription { get; protected set; }
    Property Value
    Type Description
    StreamTestKit.PublisherProbeSubscription<T>

    Methods

    | Edit this page View Source

    AsyncBuilder()

    Fluent async DSL. This will return an instance of PublisherFluentBuilder<T> that will compose and run all of its method call asynchronously. Note that PublisherFluentBuilder<T> contains two types of methods:

    • Methods that returns PublisherFluentBuilder<T> are used to chain test methods together using a fluent builder pattern.
    • Methods with names that ends with the postfix "Async" and returns either a Task or a Task<TResult>. These methods invokes the previously chained methods asynchronously one after another before executing its own code.
    Declaration
    public PublisherFluentBuilder<T> AsyncBuilder()
    Returns
    Type Description
    PublisherFluentBuilder<T>
    | Edit this page View Source

    ExpectEvent(CancellationToken)

    Expect a publisher event from the stream.

    Declaration
    public TestPublisher.IPublisherEvent ExpectEvent(CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    CancellationToken cancellationToken
    Returns
    Type Description
    TestPublisher.IPublisherEvent
    | Edit this page View Source

    ExpectEventAsync(CancellationToken)

    Expect a publisher event from the stream.

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

    ExpectNoMsg(CancellationToken)

    Fluent DSL Expect no messages.

    Declaration
    public TestPublisher.ManualProbe<T> ExpectNoMsg(CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    CancellationToken cancellationToken
    Returns
    Type Description
    TestPublisher.ManualProbe<T>
    | Edit this page View Source

    ExpectNoMsg(TimeSpan, CancellationToken)

    Fluent DSL Expect no messages for given duration.

    Declaration
    public TestPublisher.ManualProbe<T> ExpectNoMsg(TimeSpan duration, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan duration
    CancellationToken cancellationToken
    Returns
    Type Description
    TestPublisher.ManualProbe<T>
    | Edit this page View Source

    ExpectNoMsgAsync(CancellationToken)

    Expect no messages.

    Declaration
    public Task ExpectNoMsgAsync(CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    CancellationToken cancellationToken
    Returns
    Type Description
    Task
    | Edit this page View Source

    ExpectNoMsgAsync(TimeSpan, CancellationToken)

    Expect no messages for given duration.

    Declaration
    public Task ExpectNoMsgAsync(TimeSpan duration, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan duration
    CancellationToken cancellationToken
    Returns
    Type Description
    Task
    | Edit this page View Source

    ExpectRequest(ISubscription, int, CancellationToken)

    Fluent DSL Expect demand from the given subscription.

    Declaration
    public TestPublisher.ManualProbe<T> ExpectRequest(ISubscription subscription, int nrOfElements, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    ISubscription subscription
    int nrOfElements
    CancellationToken cancellationToken
    Returns
    Type Description
    TestPublisher.ManualProbe<T>
    | Edit this page View Source

    ExpectRequestAsync(ISubscription, int, CancellationToken)

    Expect demand from the given subscription.

    Declaration
    public Task ExpectRequestAsync(ISubscription subscription, int nrOfElements, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    ISubscription subscription
    int nrOfElements
    CancellationToken cancellationToken
    Returns
    Type Description
    Task
    | Edit this page View Source

    ExpectSubscription(CancellationToken)

    Expect a subscription.

    Declaration
    public StreamTestKit.PublisherProbeSubscription<T> ExpectSubscription(CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    CancellationToken cancellationToken
    Returns
    Type Description
    StreamTestKit.PublisherProbeSubscription<T>
    | Edit this page View Source

    ExpectSubscriptionAsync(CancellationToken)

    Expect a subscription.

    Declaration
    public Task<StreamTestKit.PublisherProbeSubscription<T>> ExpectSubscriptionAsync(CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<StreamTestKit.PublisherProbeSubscription<T>>
    | Edit this page View Source

    ExpectSubscriptionTask(TestProbe, CancellationToken)

    Declaration
    protected static Task<StreamTestKit.PublisherProbeSubscription<T>> ExpectSubscriptionTask(TestProbe probe, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    TestProbe probe
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<StreamTestKit.PublisherProbeSubscription<T>>
    | Edit this page View Source

    ReceiveWhileAsync<TOther>(TimeSpan?, TimeSpan?, Func<object, TOther>, int, CancellationToken)

    Receive messages for a given duration or until one does not match a given partial function.

    Declaration
    public IAsyncEnumerable<TOther> ReceiveWhileAsync<TOther>(TimeSpan? max = null, TimeSpan? idle = null, Func<object, TOther> filter = null, int msgCount = 2147483647, CancellationToken cancellationToken = default) where TOther : class
    Parameters
    Type Name Description
    TimeSpan? max
    TimeSpan? idle
    Func<object, TOther> filter
    int msgCount
    CancellationToken cancellationToken
    Returns
    Type Description
    IAsyncEnumerable<TOther>
    Type Parameters
    Name Description
    TOther
    | Edit this page View Source

    ReceiveWhile<TOther>(TimeSpan?, TimeSpan?, Func<object, TOther>, int, CancellationToken)

    Receive messages for a given duration or until one does not match a given partial function.

    Declaration
    public IEnumerable<TOther> ReceiveWhile<TOther>(TimeSpan? max = null, TimeSpan? idle = null, Func<object, TOther> filter = null, int msgCount = 2147483647, CancellationToken cancellationToken = default) where TOther : class
    Parameters
    Type Name Description
    TimeSpan? max
    TimeSpan? idle
    Func<object, TOther> filter
    int msgCount
    CancellationToken cancellationToken
    Returns
    Type Description
    IEnumerable<TOther>
    Type Parameters
    Name Description
    TOther
    | Edit this page View Source

    Subscribe(ISubscriber<T>)

    Subscribes a given subscriber to this probe.

    Declaration
    public void Subscribe(ISubscriber<T> subscriber)
    Parameters
    Type Name Description
    ISubscriber<T> subscriber
    | Edit this page View Source

    WithinAsync<TOther>(TimeSpan, Func<Task<TOther>>, CancellationToken)

    Sane as calling WithinAsync(TimeSpan.Zero, max, function, cancellationToken).

    Declaration
    public Task<TOther> WithinAsync<TOther>(TimeSpan max, Func<Task<TOther>> execute, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan max
    Func<Task<TOther>> execute
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<TOther>
    Type Parameters
    Name Description
    TOther
    | Edit this page View Source

    WithinAsync<TOther>(TimeSpan, TimeSpan, Func<Task<TOther>>, CancellationToken)

    Execute 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 = probe.Within(Timespan.FromMilliseconds(50), () => { test.Tell("ping"); return ExpectMsg<string>(); });

    Declaration
    public Task<TOther> WithinAsync<TOther>(TimeSpan min, TimeSpan max, Func<Task<TOther>> actionAsync, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan min
    TimeSpan max
    Func<Task<TOther>> actionAsync
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<TOther>
    Type Parameters
    Name Description
    TOther
    | Edit this page View Source

    Within<TOther>(TimeSpan, Func<TOther>, CancellationToken)

    Sane as calling Within(TimeSpan.Zero, max, function, cancellationToken).

    Declaration
    public TOther Within<TOther>(TimeSpan max, Func<TOther> execute, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan max
    Func<TOther> execute
    CancellationToken cancellationToken
    Returns
    Type Description
    TOther
    Type Parameters
    Name Description
    TOther
    | Edit this page View Source

    Within<TOther>(TimeSpan, TimeSpan, Func<TOther>, CancellationToken)

    Execute code block while bounding its execution time between min and max. Within<TOther>(TimeSpan, TimeSpan, Func<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 Within<TOther>(TimeSpan, TimeSpan, Func<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 = probe.Within(Timespan.FromMilliseconds(50), () => { test.Tell("ping"); return ExpectMsg<string>(); });

    Declaration
    public TOther Within<TOther>(TimeSpan min, TimeSpan max, Func<TOther> execute, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan min
    TimeSpan max
    Func<TOther> execute
    CancellationToken cancellationToken
    Returns
    Type Description
    TOther
    Type Parameters
    Name Description
    TOther

    Implements

    Reactive.Streams.IPublisher<T>

    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