Table of Contents

Class TestLatch

Namespace
Akka.TestKit
Assembly
Akka.TestKit.dll

A count down latch that initially is closed. In order for it to become open CountDown() must be called. By default one call is enough, but this can be changed by specifying the count in the constructor.

By default a timeout of 5 seconds is used.

When created using TestKit.CreateTestLatch the default timeout from DefaultTimeout is used and all timeouts are dilated, i.e. multiplied by TestTimeFactor

Timeouts will always throw an exception.
public class TestLatch
Inheritance
TestLatch
Inherited Members

Constructors

TestLatch()

Initializes a new instance of the TestLatch class with count = 1, i.e. the instance will become open after one call to CountDown(). The default timeout is set to 5 seconds.

public TestLatch()

TestLatch(Func<TimeSpan, TimeSpan>, TimeSpan, int)

TBD

protected TestLatch(Func<TimeSpan, TimeSpan> dilate, TimeSpan defaultTimeout, int count)

Parameters

dilate Func<TimeSpan, TimeSpan>

TBD

defaultTimeout TimeSpan

TBD

count int

TBD

TestLatch(int)

Initializes a new instance of the TestLatch class with the specified count, i.e number of times CountDown() must be called to make this instance become open. The default timeout is set to 5 seconds.

public TestLatch(int count)

Parameters

count int

TBD

TestLatch(int, TimeSpan)

Initializes a new instance of the TestLatch class with the specified count, i.e number of times CountDown() must be called to make this instance become open.

public TestLatch(int count, TimeSpan defaultTimeout)

Parameters

count int

TBD

defaultTimeout TimeSpan

TBD

Fields

DefaultTimeout

Obsolete. This field will be removed. DefaultTimeout is an alternative.

[Obsolete("This field will be removed. TestKitSettings.DefaultTimeout is an alternative.")]
public static readonly TimeSpan DefaultTimeout

Field Value

TimeSpan

Properties

IsOpen

Gets a value indicating whether the latch is open.

public bool IsOpen { get; }

Property Value

bool

Methods

CountDown()

Count down the latch.

public void CountDown()

Open()

Make this instance become open.

public void Open()

Ready()

Expects the latch to become open within the default timeout. If the timeout is reached, a TimeoutException is thrown.

If no timeout was specified when creating this instance, 5 seconds is used.

If this instance has been created using TestKit.CreateTestLatch the default timeout from DefaultTimeout is used and dilated, i.e. multiplied by TestTimeFactor

public void Ready()

Exceptions

TimeoutException

This exception is thrown when the timeout is reached.

Ready(TimeSpan)

Expects the latch to become open within the specified timeout. If the timeout is reached, a TimeoutException is thrown.

If this instance has been created using TestKit.CreateTestLatch timeout is dilated, i.e. multiplied by TestTimeFactor

public void Ready(TimeSpan timeout)

Parameters

timeout TimeSpan

TBD

Exceptions

ArgumentException

This exception is thrown when a too large timeout has been specified.

TimeoutException

This exception is thrown when the timeout is reached.

Reset()

Reset this instance to the initial count, making it become closed.

public void Reset()