-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add default constructor to Akka.Remote.Ack to fix JSON serializer
- Loading branch information
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
src/core/Akka.Remote.Tests/Serialization/BugFix4399Spec.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Akka.Actor; | ||
using Akka.Serialization; | ||
using Akka.TestKit; | ||
using Xunit; | ||
|
||
namespace Akka.Remote.Tests.Serialization | ||
{ | ||
public class BugFix4399Spec : AkkaSpec | ||
{ | ||
[Fact] | ||
public void JsonSerializer_should_be_able_to_serialize_Ack() | ||
{ | ||
var serializer = new NewtonSoftJsonSerializer((ExtendedActorSystem) Sys); | ||
|
||
var nacks = new List<SeqNo>(); | ||
for (var i = 100; i < 200; ++i) | ||
{ | ||
nacks.Add(new SeqNo(i)); | ||
} | ||
|
||
var message = new Ack(new SeqNo(666), nacks); | ||
var serializedBytes = serializer.ToBinary(message); | ||
var deserialized = (Ack)serializer.FromBinary(serializedBytes, typeof(Ack)); | ||
|
||
deserialized.CumulativeAck.RawValue.ShouldBe(666); | ||
deserialized.Nacks.Count.ShouldBe(100); | ||
var seqNos = deserialized.Nacks.Select(ack => (int)ack.RawValue); | ||
seqNos.ShouldOnlyContainInOrder(Enumerable.Range(100, 100).ToArray()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters