Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port Akka.Tests.Actor tests to async/await - ActorLookup #5761

Merged
merged 3 commits into from
Mar 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions src/core/Akka.Tests/Actor/ActorLookupSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//-----------------------------------------------------------------------

using System.Collections.Generic;
using System.Threading.Tasks;
using Akka.Actor;
using Akka.Actor.Internal;
using Akka.TestKit;
Expand Down Expand Up @@ -134,16 +135,16 @@ public void ActorSystem_must_find_Actors_by_looking_up_their_string_representati
}

[Fact]
public void ActorSystem_must_take_actor_incarnation_into_account_when_comparing_actor_references()
public async Task ActorSystem_must_take_actor_incarnation_into_account_when_comparing_actor_references()
{
var name = "abcdefg";
var a1 = Sys.ActorOf(P, name);
Watch(a1);
a1.Tell(PoisonPill.Instance);
ExpectTerminated(a1);
await ExpectTerminatedAsync(a1);

// let it be completely removed from the user guardian
ExpectNoMsg(1.Seconds());
await ExpectNoMsgAsync(1.Seconds());

// not equal, because it's terminated
Provider.ResolveActorRef(a1.Path.ToString()).Should().NotBe(a1);
Expand All @@ -156,11 +157,11 @@ public void ActorSystem_must_take_actor_incarnation_into_account_when_comparing_

Watch(a2);
a2.Tell(PoisonPill.Instance);
ExpectTerminated(a2);
await ExpectTerminatedAsync(a2);
}

[Fact]
public void ActorSystem_must_find_temporary_actors()
public async Task ActorSystem_must_find_temporary_actors()
{
var f = c1.Ask(new GetSender(TestActor));
var a = ExpectMsg<IInternalActorRef>();
Expand All @@ -171,8 +172,8 @@ public void ActorSystem_must_find_temporary_actors()
f.IsCompleted.Should().Be(false);
a.IsTerminated.Should().Be(false);
a.Tell(42);
AwaitAssert(() => f.IsCompleted.Should().Be(true));
AwaitAssert(() => f.Result.Should().Be(42));
await AwaitAssertAsync(() => f.IsCompleted.Should().Be(true));
await AwaitAssertAsync(() => f.Result.Should().Be(42));
}

/*
Expand Down