public void AddNonSerializableObjectTest_JsonSerializer() { string truckId = Guid.NewGuid().ToString(); SerializationOption?serializationOption = Truck.SendCargo(new NonSerializableClass(), truckId, SerializationOption.JsonSerializer); Assert.IsTrue(serializationOption.HasValue, "Truck.SendCargo returned null serialization option"); NonSerializableClass nonSerializableClass = Truck.ReceiveCargo <NonSerializableClass>(truckId, serializationOption.Value); Assert.AreEqual("I'm Not Serializable", nonSerializableClass.AString); }
public void AddNonSerializableObjectTest_JsonSerializer_ByType() { string truckId = Guid.NewGuid().ToString(); SerializationOption?serializationOption = Truck.SendCargo(new NonSerializableClass(), truckId, SerializationOption.BinarySerializer); Assert.IsTrue(serializationOption.HasValue, "Truck.SendCargo returned null serialization option"); Assert.IsTrue(serializationOption.Value == SerializationOption.JsonSerializer, "Serialization option is not JsonSerializer over non serializable type"); NonSerializableClass nonSerializableClass = Truck.ReceiveCargo(truckId, serializationOption.Value, typeof(NonSerializableClass)) as NonSerializableClass; Assert.IsNotNull(nonSerializableClass, "Serialization has failed"); Assert.AreEqual("I'm Not Serializable", nonSerializableClass.AString); }