Skip to content

Commit

Permalink
Fix of EventFilter.And from Akka.testKit when one parameter is string (
Browse files Browse the repository at this point in the history
…#6316). (#6371)

Co-authored-by: Aaron Stannard <aaron@petabridge.com>
  • Loading branch information
F0b0s and Aaronontheweb committed Feb 7, 2023
1 parent c5bdeae commit 83341fa
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
Expand Up @@ -5,6 +5,7 @@
// </copyright>
//-----------------------------------------------------------------------

using System;
using System.Threading.Tasks;
using Akka.Actor;
using Akka.Event;
Expand Down Expand Up @@ -47,6 +48,26 @@ public async Task Should_be_able_to_filter_dead_letters()
_deadActor.Tell("whatever");
});
}

[Fact]
public async Task Should_check_properly_type_parameters()
{
await EventFilter.DeadLetter<int>().And.DeadLetter<double>().ExpectAsync(2, async () =>
{
_deadActor.Tell(5);
_deadActor.Tell(1.2);
});
}

[Fact]
public async Task Should_check_properly_type_parameters_when_one_of_them_string()
{
await EventFilter.DeadLetter<string>().And.DeadLetter<double>().ExpectAsync(2, async () =>
{
_deadActor.Tell("asd");
_deadActor.Tell(1.2);
});
}
}

public class DeadLettersEventFilterTests : DeadLettersEventFilterTestsBase
Expand Down
5 changes: 1 addition & 4 deletions src/core/Akka.TestKit/EventFilter/TestEventListener.cs
Expand Up @@ -108,10 +108,7 @@ private void HandleDeadLetter(DeadLetter message)
? "Received dead system message: " + msg
: "Received dead letter from " + snd + ": " + msg;
var warning2 = new Warning(recipientPath, recipientType, new DeadLetter(msgStr, snd, rcp));
if (!ShouldFilter(warning2))
{
Print(warning2);
}
Print(warning2);
}
}
}
Expand Down

0 comments on commit 83341fa

Please sign in to comment.