FromBinary() public method

Deserializes a byte array into an object of type type.
public FromBinary ( byte bytes, Type type ) : object
bytes byte The array containing the serialized object
type System.Type The type of object contained in the array
return object
Ejemplo n.º 1
0
 public void StateShouldBeSerializedAndDeserializedCorrectly(object sut)
 {
     var serializer = new NewtonSoftJsonSerializer(null);
     var bytes = serializer.ToBinary(sut);
     //var json = Encoding.Default.GetString(bytes);
     var result = (DeviceStoreState) serializer.FromBinary(bytes, typeof (DeviceStoreState));
     result.ShouldBeEquivalentTo(sut);
 }
Ejemplo n.º 2
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));
            });
        }