diff --git a/src/core/Akka.TestKit/EventFilter/IEventFilterApplier.cs b/src/core/Akka.TestKit/EventFilter/IEventFilterApplier.cs
index 5d84e5b52eb..f454fe4eb9b 100644
--- a/src/core/Akka.TestKit/EventFilter/IEventFilterApplier.cs
+++ b/src/core/Akka.TestKit/EventFilter/IEventFilterApplier.cs
@@ -6,6 +6,7 @@
//-----------------------------------------------------------------------
using System;
+using System.Threading.Tasks;
namespace Akka.TestKit
{
@@ -24,6 +25,26 @@ public interface IEventFilterApplier
///
/// The action.
void ExpectOne(Action action);
+
+ ///
+ /// Executes and
+ /// expects one event to be logged during the execution.
+ /// This method fails and throws an exception if more than one event is logged,
+ /// or if a timeout occurs. The timeout is taken from the config value
+ /// "akka.test.filter-leeway", see .
+ ///
+ /// The action.
+ Task ExpectOneAsync(Action action);
+
+ ///
+ /// Executes and
+ /// expects one event to be logged during the execution.
+ /// This method fails and throws an exception if more than one event is logged,
+ /// or if a timeout occurs. The timeout is taken from the config value
+ /// "akka.test.filter-leeway", see .
+ ///
+ /// The action.
+ Task ExpectOneAsync(Func actionAsync);
///
/// Executes and
@@ -34,7 +55,17 @@ public interface IEventFilterApplier
/// The time to wait for a log event after executing
/// The action.
void ExpectOne(TimeSpan timeout, Action action);
-
+
+ ///
+ /// Executes and
+ /// expects one event to be logged during the execution.
+ /// This method fails and throws an exception if more than one event is logged,
+ /// or if a timeout occurs.
+ ///
+ /// The time to wait for a log event after executing
+ /// The action.
+ Task ExpectOneAsync(TimeSpan timeout, Action action);
+
///
/// Executes and expects the specified number
/// of events to be logged during the execution.
@@ -45,6 +76,28 @@ public interface IEventFilterApplier
/// The expected number of events
/// The action.
void Expect(int expectedCount, Action action);
+
+ ///
+ /// Executes and expects the specified number
+ /// of events to be logged during the execution.
+ /// This method fails and throws an exception if more events than expected are logged,
+ /// or if a timeout occurs. The timeout is taken from the config value
+ /// "akka.test.filter-leeway", see .
+ ///
+ /// The expected number of events
+ /// The action.
+ Task ExpectAsync(int expectedCount, Action action);
+
+ ///
+ /// Executes task and expects the specified number
+ /// of events to be logged during the execution.
+ /// This method fails and throws an exception if more events than expected are logged,
+ /// or if a timeout occurs. The timeout is taken from the config value
+ /// "akka.test.filter-leeway", see .
+ ///
+ /// The expected number of events
+ /// The async action.
+ Task ExpectAsync(int expectedCount, Func actionAsync);
///
/// Executes and expects the specified number
@@ -57,6 +110,18 @@ public interface IEventFilterApplier
/// The expected number of events
/// The action.
void Expect(int expectedCount, TimeSpan timeout, Action action);
+
+ ///
+ /// Executes and expects the specified number
+ /// of events to be logged during the execution.
+ /// This method fails and throws an exception if more events than expected are logged,
+ /// or if a timeout occurs. The timeout is taken from the config value
+ /// "akka.test.filter-leeway", see .
+ ///
+ /// The time to wait for log events after executing
+ /// The expected number of events
+ /// The action.
+ Task ExpectAsync(int expectedCount, TimeSpan timeout, Action action);
///
/// Executes and
@@ -69,6 +134,18 @@ public interface IEventFilterApplier
/// The function.
/// The returned value from .
T ExpectOne(Func func);
+
+ ///
+ /// Executes and
+ /// expects one event to be logged during the execution.
+ /// This function fails and throws an exception if more than one event is logged,
+ /// or if a timeout occurs. The timeout is taken from the config value
+ /// "akka.test.filter-leeway", see .
+ ///
+ /// The return value of the function
+ /// The function.
+ /// The returned value from .
+ Task ExpectOneAsync(Func func);
///
/// Executes and
@@ -81,6 +158,18 @@ public interface IEventFilterApplier
/// The function.
/// The returned value from .
T ExpectOne(TimeSpan timeout, Func func);
+
+ ///
+ /// Executes and
+ /// expects one event to be logged during the execution.
+ /// This function fails and throws an exception if more than one event is logged,
+ /// or if a timeout occurs.
+ ///
+ /// The return value of the function
+ /// The time to wait for a log event after executing
+ /// The function.
+ /// The returned value from .
+ Task ExpectOneAsync(TimeSpan timeout, Func func);
///
/// Executes and expects the specified number
@@ -94,6 +183,19 @@ public interface IEventFilterApplier
/// The function.
/// The returned value from .
T Expect(int expectedCount, Func func);
+
+ ///
+ /// Executes and expects the specified number
+ /// of events to be logged during the execution.
+ /// This function fails and throws an exception if more events than expected are logged,
+ /// or if a timeout occurs. The timeout is taken from the config value
+ /// "akka.test.filter-leeway", see .
+ ///
+ /// The return value of the function
+ /// The expected number of events
+ /// The function.
+ /// The returned value from .
+ Task ExpectAsync(int expectedCount, Func func);
///
/// Executes and expects the specified number
@@ -108,6 +210,20 @@ public interface IEventFilterApplier
/// The function.
/// The returned value from .
T Expect(int expectedCount, TimeSpan timeout, Func func);
+
+ ///
+ /// Executes and expects the specified number
+ /// of events to be logged during the execution.
+ /// This function fails and throws an exception if more events than expected are logged,
+ /// or if a timeout occurs. The timeout is taken from the config value
+ /// "akka.test.filter-leeway", see .
+ ///
+ /// The return value of the function
+ /// The time to wait for log events after executing
+ /// The expected number of events
+ /// The function.
+ /// The returned value from .
+ Task ExpectAsync(int expectedCount, TimeSpan timeout, Func func);
///
/// Executes and prevent events from being logged during the execution.
@@ -116,6 +232,14 @@ public interface IEventFilterApplier
/// The function.
/// The returned value from .
T Mute(Func func);
+
+ ///
+ /// Executes and prevent events from being logged during the execution.
+ ///
+ /// The return value of the function
+ /// The function.
+ /// The returned value from .
+ Task MuteAsync(Func func);
///
/// Executes and prevent events from being logged during the execution.
@@ -123,6 +247,13 @@ public interface IEventFilterApplier
/// The function.
/// The returned value from .
void Mute(Action action);
+
+ ///
+ /// Executes and prevent events from being logged during the execution.
+ ///
+ /// The function.
+ /// The returned value from .
+ Task MuteAsync(Action action);
///
/// Prevents events from being logged from now on. To allow events to be logged again, call
diff --git a/src/core/Akka.TestKit/EventFilter/Internal/EventFilterApplier.cs b/src/core/Akka.TestKit/EventFilter/Internal/EventFilterApplier.cs
index d11df487346..a4f96523071 100644
--- a/src/core/Akka.TestKit/EventFilter/Internal/EventFilterApplier.cs
+++ b/src/core/Akka.TestKit/EventFilter/Internal/EventFilterApplier.cs
@@ -8,6 +8,7 @@
using System;
using System.Collections.Generic;
using System.Threading;
+using System.Threading.Tasks;
using Akka.Actor;
using Akka.Event;
using Akka.TestKit.TestEvent;
@@ -45,6 +46,20 @@ public void ExpectOne(Action action)
InternalExpect(action, _actorSystem, 1);
}
+ public Task ExpectOneAsync(Func actionAsync)
+ {
+ return InternalExpectAsync(actionAsync, _actorSystem, 1);
+ }
+
+ ///
+ /// Async version of
+ ///
+ ///
+ public async Task ExpectOneAsync(Action action)
+ {
+ await InternalExpectAsync(action, _actorSystem, 1);
+ }
+
///
/// TBD
///
@@ -54,6 +69,15 @@ public void ExpectOne(TimeSpan timeout, Action action)
{
InternalExpect(action, _actorSystem, 1, timeout);
}
+
+ ///
+ /// Async version of
+ ///
+ ///
+ public async Task ExpectOneAsync(TimeSpan timeout, Action action)
+ {
+ await InternalExpectAsync(action, _actorSystem, 1, timeout);
+ }
///
/// TBD
@@ -65,6 +89,22 @@ public void Expect(int expectedCount, Action action)
InternalExpect(action, _actorSystem, expectedCount, null);
}
+ ///
+ /// Async version of Expect
+ ///
+ public Task ExpectAsync(int expectedCount, Func actionAsync)
+ {
+ return InternalExpectAsync(actionAsync, _actorSystem, expectedCount, null);
+ }
+
+ ///
+ /// Async version of
+ ///
+ public async Task ExpectAsync(int expectedCount, Action action)
+ {
+ await InternalExpectAsync(action, _actorSystem, expectedCount, null);
+ }
+
///
/// TBD
///
@@ -75,6 +115,14 @@ public void Expect(int expectedCount, TimeSpan timeout, Action action)
{
InternalExpect(action, _actorSystem, expectedCount, timeout);
}
+
+ ///
+ /// Async version of
+ ///
+ public async Task ExpectAsync(int expectedCount, TimeSpan timeout, Action action)
+ {
+ await InternalExpectAsync(action, _actorSystem, expectedCount, timeout);
+ }
///
/// TBD
@@ -86,6 +134,14 @@ public T ExpectOne(Func func)
{
return Intercept(func, _actorSystem, null, 1);
}
+
+ ///
+ /// Async version of ExpectOne
+ ///
+ public async Task ExpectOneAsync(Func func)
+ {
+ return await InterceptAsync(func, _actorSystem, null, 1);
+ }
///
/// TBD
@@ -98,6 +154,14 @@ public T ExpectOne(TimeSpan timeout, Func func)
{
return Intercept(func, _actorSystem, timeout, 1);
}
+
+ ///
+ /// Async version of ExpectOne
+ ///
+ public async Task ExpectOneAsync(TimeSpan timeout, Func func)
+ {
+ return await InterceptAsync(func, _actorSystem, timeout, 1);
+ }
///
/// TBD
@@ -111,6 +175,14 @@ public T Expect(int expectedCount, Func func)
return Intercept(func, _actorSystem, null, expectedCount);
}
+ ///
+ /// Async version of Expect
+ ///
+ public async Task ExpectAsync(int expectedCount, Func func)
+ {
+ return await InterceptAsync(func, _actorSystem, null, expectedCount);
+ }
+
///
/// TBD
///
@@ -123,6 +195,14 @@ public T Expect(int expectedCount, TimeSpan timeout, Func func)
{
return Intercept(func, _actorSystem, timeout, expectedCount);
}
+
+ ///
+ /// Async version of Expect
+ ///
+ public async Task ExpectAsync(int expectedCount, TimeSpan timeout, Func func)
+ {
+ return await InterceptAsync(func, _actorSystem, timeout, expectedCount);
+ }
///
/// TBD
@@ -134,6 +214,14 @@ public T Mute(Func func)
{
return Intercept(func, _actorSystem, null, null);
}
+
+ ///
+ /// Async version of Mute
+ ///
+ public async Task MuteAsync(Func func)
+ {
+ return await InterceptAsync(func, _actorSystem, null, null);
+ }
///
/// TBD
@@ -143,6 +231,14 @@ public void Mute(Action action)
{
Intercept