Skip to content

Commit 577aba8

Browse files
eabaArkatufus
andauthored
Port Akka.Tests.Loggers tests to async/await - LoggerSpec (#5798)
Co-authored-by: Gregorius Soedharmo <[email protected]>
1 parent 27a0052 commit 577aba8

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/core/Akka.Tests/Loggers/LoggerSpec.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,31 +38,31 @@ public async Task TestOutputLogger_WithBadFormattingMustNotThrow()
3838
Sys.EventStream.Subscribe(TestActor, typeof(LogEvent));
3939

4040
Sys.Log.Error(new FakeException("BOOM"), Case.t, Case.p);
41-
events.Add(ExpectMsg<Error>());
42-
events.Add(ExpectMsg<Error>());
41+
events.Add(await ExpectMsgAsync<Error>());
42+
events.Add(await ExpectMsgAsync<Error>());
4343

4444
events.All(e => e is Error).Should().BeTrue();
4545
events.Select(e => e.Cause).Any(c => c is FakeException).Should().BeTrue();
4646
events.Select(e => e.Cause).Any(c => c is AggregateException).Should().BeTrue();
4747

4848
events.Clear();
4949
Sys.Log.Warning(Case.t, Case.p);
50-
events.Add(ExpectMsg<LogEvent>());
51-
events.Add(ExpectMsg<LogEvent>());
50+
events.Add(await ExpectMsgAsync<LogEvent>());
51+
events.Add(await ExpectMsgAsync<LogEvent>());
5252
events.Any(e => e is Warning).Should().BeTrue();
5353
events.First(e => e is Error).Cause.Should().BeOfType<FormatException>();
5454

5555
events.Clear();
5656
Sys.Log.Info(Case.t, Case.p);
57-
events.Add(ExpectMsg<LogEvent>());
58-
events.Add(ExpectMsg<LogEvent>());
57+
events.Add(await ExpectMsgAsync<LogEvent>());
58+
events.Add(await ExpectMsgAsync<LogEvent>());
5959
events.Any(e => e is Info).Should().BeTrue();
6060
events.First(e => e is Error).Cause.Should().BeOfType<FormatException>();
6161

6262
events.Clear();
6363
Sys.Log.Debug(Case.t, Case.p);
64-
events.Add(ExpectMsg<LogEvent>());
65-
events.Add(ExpectMsg<LogEvent>());
64+
events.Add(await ExpectMsgAsync<LogEvent>());
65+
events.Add(await ExpectMsgAsync<LogEvent>());
6666
events.Any(e => e is Debug).Should().BeTrue();
6767
events.First(e => e is Error).Cause.Should().BeOfType<FormatException>();
6868
}
@@ -77,16 +77,16 @@ public async Task DefaultLogger_WithBadFormattingMustNotThrow()
7777
sys2.EventStream.Subscribe(probe, typeof(LogEvent));
7878

7979
sys2.Log.Error(new FakeException("BOOM"), Case.t, Case.p);
80-
probe.ExpectMsg<Error>().Cause.Should().BeOfType<FakeException>();
80+
(await probe.ExpectMsgAsync<Error>()).Cause.Should().BeOfType<FakeException>();
8181

8282
sys2.Log.Warning(Case.t, Case.p);
83-
probe.ExpectMsg<Warning>();
83+
await probe.ExpectMsgAsync<Warning>();
8484

8585
sys2.Log.Info(Case.t, Case.p);
86-
probe.ExpectMsg<Info>();
86+
await probe.ExpectMsgAsync<Info>();
8787

8888
sys2.Log.Debug(Case.t, Case.p);
89-
probe.ExpectMsg<Debug>();
89+
await probe.ExpectMsgAsync<Debug>();
9090

9191
await sys2.Terminate();
9292
}
@@ -101,16 +101,16 @@ public async Task StandardOutLogger_WithBadFormattingMustNotThrow()
101101
sys2.EventStream.Subscribe(probe, typeof(LogEvent));
102102

103103
sys2.Log.Error(new FakeException("BOOM"), Case.t, Case.p);
104-
probe.ExpectMsg<Error>().Cause.Should().BeOfType<FakeException>();
104+
(await probe.ExpectMsgAsync<Error>()).Cause.Should().BeOfType<FakeException>();
105105

106106
sys2.Log.Warning(Case.t, Case.p);
107-
probe.ExpectMsg<Warning>();
107+
await probe.ExpectMsgAsync<Warning>();
108108

109109
sys2.Log.Info(Case.t, Case.p);
110-
probe.ExpectMsg<Info>();
110+
await probe.ExpectMsgAsync<Info>();
111111

112112
sys2.Log.Debug(Case.t, Case.p);
113-
probe.ExpectMsg<Debug>();
113+
await probe.ExpectMsgAsync<Debug>();
114114

115115
await sys2.Terminate();
116116
}

0 commit comments

Comments
 (0)