From a3648798772228c0405c16a872781e971f55fd09 Mon Sep 17 00:00:00 2001 From: Ebere Abanonu Date: Mon, 28 Mar 2022 21:46:50 +0100 Subject: [PATCH] Port `Akka.Tests.Actor` tests to `async/await` - RefIgnoreSpec (#5763) * Port `Akka.Tests.Actor` tests to `async/await` - RefIgnoreSpec * Fix missing cancellationToken default value Co-authored-by: Gregorius Soedharmo --- src/core/Akka.Tests/Actor/ActorRefIgnoreSpec.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/core/Akka.Tests/Actor/ActorRefIgnoreSpec.cs b/src/core/Akka.Tests/Actor/ActorRefIgnoreSpec.cs index 04830198a0a..3863bfc812e 100644 --- a/src/core/Akka.Tests/Actor/ActorRefIgnoreSpec.cs +++ b/src/core/Akka.Tests/Actor/ActorRefIgnoreSpec.cs @@ -15,29 +15,30 @@ using Xunit; using Akka.Util.Internal; using FluentAssertions; +using System.Threading.Tasks; namespace Akka.Tests.Actor { public class ActorRefIgnoreSpec : AkkaSpec, INoImplicitSender { [Fact] - public void IgnoreActorRef_should_ignore_all_incoming_messages() + public async Task IgnoreActorRef_should_ignore_all_incoming_messages() { var askMeRef = Sys.ActorOf(Props.Create(() => new AskMeActor())); var probe = CreateTestProbe("response-probe"); askMeRef.Tell(new Request(probe.Ref)); - probe.ExpectMsg(1); + await probe.ExpectMsgAsync(1); // this is more a compile-time proof // since the reply is ignored, we can't check that a message was sent to it askMeRef.Tell(new Request(Sys.IgnoreRef)); - probe.ExpectNoMsg(); + await probe.ExpectNoMsgAsync(default); // but we do check that the counter has increased when we used the ActorRef.ignore askMeRef.Tell(new Request(probe.Ref)); - probe.ExpectMsg(3); + await probe.ExpectMsgAsync(3); } [Fact] @@ -55,14 +56,14 @@ public void IgnoreActorRef_should_make_a_Future_timeout_when_used_in_a_ask() } [Fact] - public void IgnoreActorRef_should_be_watchable_from_another_actor_without_throwing_an_exception() + public async Task IgnoreActorRef_should_be_watchable_from_another_actor_without_throwing_an_exception() { var probe = CreateTestProbe("probe-response"); var forwardMessageRef = Sys.ActorOf(Props.Create(() => new ForwardMessageWatchActor(probe))); // this proves that the actor started and is operational and 'watch' didn't impact it forwardMessageRef.Tell("abc"); - probe.ExpectMsg("abc"); + await probe.ExpectMsgAsync("abc"); } [Fact]