From 911e68ac17c840b37750464c4e0218edac9603b8 Mon Sep 17 00:00:00 2001 From: Ebere Abanonu Date: Wed, 30 Mar 2022 14:12:36 +0100 Subject: [PATCH] Port `Akka.Tests.Loggers` tests to `async/await` - `LoggerSpec` --- src/core/Akka.Tests/Loggers/LoggerSpec.cs | 32 +++++++++++------------ 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/core/Akka.Tests/Loggers/LoggerSpec.cs b/src/core/Akka.Tests/Loggers/LoggerSpec.cs index 2ed7f79aca7..758b0968f6e 100644 --- a/src/core/Akka.Tests/Loggers/LoggerSpec.cs +++ b/src/core/Akka.Tests/Loggers/LoggerSpec.cs @@ -38,8 +38,8 @@ public async Task TestOutputLogger_WithBadFormattingMustNotThrow() Sys.EventStream.Subscribe(TestActor, typeof(LogEvent)); Sys.Log.Error(new FakeException("BOOM"), Case.t, Case.p); - events.Add(ExpectMsg()); - events.Add(ExpectMsg()); + events.Add(await ExpectMsgAsync()); + events.Add(await ExpectMsgAsync()); events.All(e => e is Error).Should().BeTrue(); events.Select(e => e.Cause).Any(c => c is FakeException).Should().BeTrue(); @@ -47,22 +47,22 @@ public async Task TestOutputLogger_WithBadFormattingMustNotThrow() events.Clear(); Sys.Log.Warning(Case.t, Case.p); - events.Add(ExpectMsg()); - events.Add(ExpectMsg()); + events.Add(await ExpectMsgAsync()); + events.Add(await ExpectMsgAsync()); events.Any(e => e is Warning).Should().BeTrue(); events.First(e => e is Error).Cause.Should().BeOfType(); events.Clear(); Sys.Log.Info(Case.t, Case.p); - events.Add(ExpectMsg()); - events.Add(ExpectMsg()); + events.Add(await ExpectMsgAsync()); + events.Add(await ExpectMsgAsync()); events.Any(e => e is Info).Should().BeTrue(); events.First(e => e is Error).Cause.Should().BeOfType(); events.Clear(); Sys.Log.Debug(Case.t, Case.p); - events.Add(ExpectMsg()); - events.Add(ExpectMsg()); + events.Add(await ExpectMsgAsync()); + events.Add(await ExpectMsgAsync()); events.Any(e => e is Debug).Should().BeTrue(); events.First(e => e is Error).Cause.Should().BeOfType(); } @@ -77,16 +77,16 @@ public async Task DefaultLogger_WithBadFormattingMustNotThrow() sys2.EventStream.Subscribe(probe, typeof(LogEvent)); sys2.Log.Error(new FakeException("BOOM"), Case.t, Case.p); - probe.ExpectMsg().Cause.Should().BeOfType(); + (await probe.ExpectMsgAsync()).Cause.Should().BeOfType(); sys2.Log.Warning(Case.t, Case.p); - probe.ExpectMsg(); + await probe.ExpectMsgAsync(); sys2.Log.Info(Case.t, Case.p); - probe.ExpectMsg(); + await probe.ExpectMsgAsync(); sys2.Log.Debug(Case.t, Case.p); - probe.ExpectMsg(); + await probe.ExpectMsgAsync(); await sys2.Terminate(); } @@ -101,16 +101,16 @@ public async Task StandardOutLogger_WithBadFormattingMustNotThrow() sys2.EventStream.Subscribe(probe, typeof(LogEvent)); sys2.Log.Error(new FakeException("BOOM"), Case.t, Case.p); - probe.ExpectMsg().Cause.Should().BeOfType(); + (await probe.ExpectMsgAsync()).Cause.Should().BeOfType(); sys2.Log.Warning(Case.t, Case.p); - probe.ExpectMsg(); + await probe.ExpectMsgAsync(); sys2.Log.Info(Case.t, Case.p); - probe.ExpectMsg(); + await probe.ExpectMsgAsync(); sys2.Log.Debug(Case.t, Case.p); - probe.ExpectMsg(); + await probe.ExpectMsgAsync(); await sys2.Terminate(); }