Skip to content

Commit

Permalink
Port Akka.Tests.Actor tests to async/await - SystemGuardianTests (
Browse files Browse the repository at this point in the history
  • Loading branch information
eaba authored Mar 30, 2022
1 parent 25afa70 commit 121ceb9
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/core/Akka.Tests/Actor/SystemGuardianTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// </copyright>
//-----------------------------------------------------------------------

using System.Threading.Tasks;
using Akka.Actor;
using Akka.Dispatch.SysMsg;
using Akka.TestKit;
Expand All @@ -26,29 +27,29 @@ public SystemGuardianTests()
}

[Fact]
public void Should_Send_Hook_When_UserGuardian_Terminated()
public async Task Should_Send_Hook_When_UserGuardian_Terminated()
{
_systemGuardian.Tell(RegisterTerminationHook.Instance);
_userGuardian.Tell(PoisonPill.Instance);

ExpectMsg<TerminationHook>();
await ExpectMsgAsync<TerminationHook>();
}

[Fact]
public void Should_Terminate_When_Hooks_Complete()
public async Task Should_Terminate_When_Hooks_Complete()
{
var probe = CreateTestProbe();
probe.Watch(_systemGuardian);
_systemGuardian.Tell(RegisterTerminationHook.Instance);
_userGuardian.Tell(PoisonPill.Instance);

ExpectMsg<TerminationHook>();
await ExpectMsgAsync<TerminationHook>();
_systemGuardian.Tell(TerminationHookDone.Instance);
probe.ExpectTerminated(_systemGuardian);
await probe.ExpectTerminatedAsync(_systemGuardian);
}

[Fact]
public void Should_Remove_Registration_When_Registree_Terminates()
public async Task Should_Remove_Registration_When_Registree_Terminates()
{
var guardianWatcher = CreateTestProbe();
guardianWatcher.Watch(_systemGuardian);
Expand All @@ -59,7 +60,7 @@ public void Should_Remove_Registration_When_Registree_Terminates()

_userGuardian.Tell(PoisonPill.Instance);

guardianWatcher.ExpectTerminated(_systemGuardian);
await guardianWatcher.ExpectTerminatedAsync(_systemGuardian);
}
}
}
Expand Down

0 comments on commit 121ceb9

Please sign in to comment.