From 149b3c65057222f79f7bbeed6bf532c0b3570956 Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Wed, 27 Apr 2022 00:54:57 +0700 Subject: [PATCH] Convert Akka.Remote.Tests to async - RemoteMetricsSpec --- .../Akka.Remote.Tests/RemoteMetricsSpec.cs | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/core/Akka.Remote.Tests/RemoteMetricsSpec.cs b/src/core/Akka.Remote.Tests/RemoteMetricsSpec.cs index 0d9915c8e0a..e51890084ea 100644 --- a/src/core/Akka.Remote.Tests/RemoteMetricsSpec.cs +++ b/src/core/Akka.Remote.Tests/RemoteMetricsSpec.cs @@ -58,40 +58,40 @@ protected override async Task AfterTerminationAsync() [Fact] - public void RemoteMetricsMustNotLogMessagesLargerThanFrameSizeExceeding() + public async Task RemoteMetricsMustNotLogMessagesLargerThanFrameSizeExceeding() { var sel = _client.ActorSelection(new RootActorPath(_address)/_subject.Path.Elements); sel.Tell(new byte[200]); - ExpectMsg(); + await ExpectMsgAsync(); } [Fact] - public void RemoteMetricsMustLogNewMessageSizeForTheSameMessageTypeLargerThanThePreviousOneOnTheThreshold() + public async Task RemoteMetricsMustLogNewMessageSizeForTheSameMessageTypeLargerThanThePreviousOneOnTheThreshold() { var sel = _client.ActorSelection(new RootActorPath(_address)/_subject.Path.Elements); sel.Tell(new byte[200]); - ExpectMsg(); + await ExpectMsgAsync(); sel.Tell(new byte[300]); - ExpectMsg(); + await ExpectMsgAsync(); } [Fact] - public void RemoteMetricsMustNotLogMessagesLessThanFrameSizeExceeding() + public async Task RemoteMetricsMustNotLogMessagesLessThanFrameSizeExceeding() { var sel = _client.ActorSelection(new RootActorPath(_address)/_subject.Path.Elements); sel.Tell(new byte[1]); - ExpectNoMsg(); + await ExpectNoMsgAsync(); } [Fact] - public void RemoteMetricsMustNotLogTheSameMessageSizeTwice() + public async Task RemoteMetricsMustNotLogTheSameMessageSizeTwice() { var sel = _client.ActorSelection(new RootActorPath(_address)/_subject.Path.Elements); sel.Tell(new byte[200]); - ExpectMsg(); + await ExpectMsgAsync(); sel.Tell(new byte[200]); - ExpectNoMsg(); + await ExpectNoMsgAsync(); } private class Subject : ActorBase @@ -114,9 +114,8 @@ public InfoEventListener(IActorRef testActor) protected override bool Receive(object message) { - if (message is Info) + if (message is Info info) { - var info = ((Info) message); if (info.Message.ToString().Contains("New maximum payload size for")) { _testActor.Tell(new NewMaximum());