public void Journal_should_serialize_with_transport_if_enabled()
        {
            //Given
            var ser       = Sys.Serialization.FindSerializerForType(typeof(ActorRefWrapper));
            var receiver  = CreateTestProbe();
            var testActor = CreateTestActor("test-actor");

            var myEvent = new ActorRefWrapper
            {
                ActorRef = testActor
            };

            var messages = new List <IPersistentEnvelope>()
            {
                new AtomicWrite(new Persistent(myEvent, 0, Pid, string.Empty, false, testActor, WriterGuid))
            };

            //When
            Journal.Tell(new WriteMessages(messages, receiver, ActorInstanceId), testActor);
            receiver.ExpectMsg <WriteMessagesSuccessful>();
            receiver.ExpectMsg <WriteMessageSuccess>();
            Journal.Tell(new ReplayMessages(0, 1, 1, Pid, receiver.Ref));

            //Then
            receiver.ExpectMsg <ReplayedMessage>(msg =>
            {
                var e = (ActorRefWrapper)msg.Persistent.Payload;
                Assert.True(e.IsSerializedWithTransport, "event should be serialized with transport");
            });
        }
        public void SnapshotStore_should_serialize_with_transport_if_enabled()
        {
            //Given
            var ser      = Sys.Serialization.FindSerializerForType(typeof(ActorRefWrapper));
            var receiver = CreateTestProbe();
            var myEvent  = new ActorRefWrapper
            {
                ActorRef = CreateTestActor("test-actor")
            };

            //When
            var metadata = new SnapshotMetadata(Pid, 0);

            SnapshotStore.Tell(new SaveSnapshot(metadata, myEvent), receiver.Ref);
            receiver.ExpectMsg <SaveSnapshotSuccess>();
            SnapshotStore.Tell(new LoadSnapshot(Pid, SnapshotSelectionCriteria.Latest, 1), receiver.Ref);

            //Then
            receiver.ExpectMsg <LoadSnapshotResult>(msg =>
            {
                var e = (ActorRefWrapper)msg.Snapshot.Snapshot;
                Assert.True(e.IsSerializedWithTransport, "snapshot should be serialized with transport");
            });
        }