From ab5071d53dac7f0fc88e09d0db623b6dcd7b99c9 Mon Sep 17 00:00:00 2001 From: Ebere Abanonu Date: Wed, 30 Mar 2022 19:12:56 +0100 Subject: [PATCH] Port `Akka.Tests.Event` tests to `async/await` - `LoggerSpec` (#5795) --- src/core/Akka.Tests/Event/LoggerSpec.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/core/Akka.Tests/Event/LoggerSpec.cs b/src/core/Akka.Tests/Event/LoggerSpec.cs index 96b1e53ba8c..2445c2102d2 100644 --- a/src/core/Akka.Tests/Event/LoggerSpec.cs +++ b/src/core/Akka.Tests/Event/LoggerSpec.cs @@ -45,7 +45,7 @@ public LoggerSpec(ITestOutputHelper helper) : base(Config, helper) { } [InlineData(LogLevel.DebugLevel, true, "foo", new object[] { })] [InlineData(LogLevel.DebugLevel, false, "foo {0}", new object[] { 1 })] [InlineData(LogLevel.DebugLevel, true, "foo {0}", new object[] { 1 })] - public void LoggingAdapter_should_log_all_information(LogLevel logLevel, bool includeException, string formatStr, object [] args) + public async Task LoggingAdapter_should_log_all_information(LogLevel logLevel, bool includeException, string formatStr, object [] args) { Sys.EventStream.Subscribe(TestActor, typeof(LogEvent)); var msg = args != null ? string.Format(formatStr, args) : formatStr; @@ -102,10 +102,10 @@ void ProcessLog(LogEvent logEvent) logEvent.Cause.Should().BeNull(); } - var log = ExpectMsg(); + var log = await ExpectMsgAsync(); ProcessLog(log); - var log2 = ExpectMsg(); + var log2 = await ExpectMsgAsync(); ProcessLog(log2); } @@ -117,23 +117,23 @@ public async Task LoggingBus_should_stop_all_loggers_on_termination() system.EventStream.Subscribe(TestActor, typeof(Debug)); await system.Terminate(); - await AwaitAssertAsync(() => + await AwaitAssertAsync(async() => { - var shutdownInitiated = ExpectMsg(TestKitSettings.DefaultTimeout); + var shutdownInitiated = await ExpectMsgAsync(TestKitSettings.DefaultTimeout); shutdownInitiated.Message.ShouldBe("System shutdown initiated"); }); - var loggerStarted = ExpectMsg(TestKitSettings.DefaultTimeout); + var loggerStarted = await ExpectMsgAsync(TestKitSettings.DefaultTimeout); loggerStarted.Message.ShouldBe("Shutting down: StandardOutLogger started"); loggerStarted.LogClass.ShouldBe(typeof(EventStream)); loggerStarted.LogSource.ShouldBe(typeof(EventStream).Name); - var loggerStopped = ExpectMsg(TestKitSettings.DefaultTimeout); + var loggerStopped = await ExpectMsgAsync(TestKitSettings.DefaultTimeout); loggerStopped.Message.ShouldBe("All default loggers stopped"); loggerStopped.LogClass.ShouldBe(typeof(EventStream)); loggerStopped.LogSource.ShouldBe(typeof(EventStream).Name); - ExpectNoMsg(TimeSpan.FromSeconds(1)); + await ExpectNoMsgAsync(TimeSpan.FromSeconds(1)); } } }