Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,23 @@ public void MessageSerializer_should_serialize_manifest_provided_by_EventAdapter
back.Manifest.Should().Be(p1.Manifest);
}

[Fact]
public void MessageSerializer_should_serialize_events_with_no_manifest_and_null_type()
{
var p1 = new Persistent(new MyPayload("a"), sender: TestActor);
var bytes = _serializer.ToBinary(p1);
var back = _serializer.FromBinary(bytes, null);

back.Should().BeOfType<Persistent>();
var persisted = (Persistent)back;
persisted.Payload.Should().BeOfType<MyPayload>();
persisted.Sender.Should().BeEquivalentTo(TestActor);
var payload = (MyPayload)persisted.Payload;

// Yes, the data isn't "a" but ".a.", the custom serializer added these dots.
payload.Data.ShouldBe(".a.");
}

[Fact]
public void MessageSerializer_should_serialize_state_change_event()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ private PersistentFSMSnapshot GetPersistentFSMSnapshot(object obj)

public override object FromBinary(byte[] bytes, Type type)
{
if(type == null) return GetPersistentRepresentation(PersistentMessage.Parser.ParseFrom(bytes));
if (type == typeof(Persistent)) return GetPersistentRepresentation(PersistentMessage.Parser.ParseFrom(bytes));
if (type == typeof(IPersistentRepresentation)) return GetPersistentRepresentation(PersistentMessage.Parser.ParseFrom(bytes));
if (type == typeof(AtomicWrite)) return GetAtomicWrite(bytes);
Expand Down