Class EventSink<T>
A synchronous blocking queue with Xunit assertion helpers.
Inheritance
System.Object
EventSink<T>
Namespace: LaunchDarkly.TestHelpers
Assembly: LaunchDarkly.TestHelpers.dll
Syntax
public sealed class EventSink<T> : Object
Type Parameters
Name | Description |
---|---|
T | the type of items in the queue |
Constructors
EventSink()
Declaration
public EventSink()
Methods
Add(Object, T)
Equivalent to Enqueue(T), but with a first sender
parameter so it
can be used as an event handler.
Declaration
public void Add(object sender, T args)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | the event sender |
T | args | the event data |
Enqueue(T)
Adds a value to the queue.
Declaration
public void Enqueue(T arg)
Parameters
Type | Name | Description |
---|---|---|
T | arg | the value |
ExpectNoValue()
Equivalent to ExpectNoValue(TimeSpan) with a timeout of 100 milliseconds.
Declaration
public void ExpectNoValue()
ExpectNoValue(TimeSpan)
Causes an assertion failure if the queue contains any items.
Declaration
public void ExpectNoValue(TimeSpan timeout)
Parameters
Type | Name | Description |
---|---|---|
System.TimeSpan | timeout | how long to wait |
ExpectValue()
Equivalent to ExpectValue(TimeSpan) with a timeout of one second.
Declaration
public T ExpectValue()
Returns
Type | Description |
---|---|
T | the received value |
ExpectValue(TimeSpan)
Takes a value from the queue and returns it, or causes an assertion failure if the timeout expires.
Declaration
public T ExpectValue(TimeSpan timeout)
Parameters
Type | Name | Description |
---|---|---|
System.TimeSpan | timeout | how long to wait for an item |
Returns
Type | Description |
---|---|
T | the item |
TryTakeValue(out T)
Takes a value from the queue if one exists.
Declaration
public bool TryTakeValue(out T value)
Parameters
Type | Name | Description |
---|---|---|
T | value | receives the value |
Returns
Type | Description |
---|---|
System.Boolean | true if successful |