Esempio n. 1
0
        public void An_ActorRef_should_throw_an_exception_on_deserialize_if_no_system_in_scope()
        {
            var aref = ActorOf <BlackHoleActor>();

            var serializer = new NewtonSoftJsonSerializer(null);

            Intercept(() =>
            {
                var binary = serializer.ToBinary(aref);
                var bref   = serializer.FromBinary(binary, typeof(IActorRef));
            });
        }
Esempio n. 2
0
        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());
        }
Esempio n. 3
0
        public string JsonNet_serialize_string()
        {
            var bytes = NewtonSoftJsonSerializer.ToBinary(TestString);

            return(NewtonSoftJsonSerializer.FromBinary <string>(bytes));
        }
Esempio n. 4
0
 public override byte[] ToBinary(object obj)
 {
     return(_underlying.ToBinary(obj));
 }