public void StaticAndTransient() { Assert.True(PropertyBasedSerializationSurrogate.CanHandle(typeDataCache, FudgeFieldNameConvention.Identity, typeof(StaticTransientClass))); var serializer = new FudgeSerializer(context); // We're relying on it auto-discovering the type surrogate StaticTransientClass.Static = 17; var obj1 = new StaticTransientClass { Transient = "Hello" }; var msg = serializer.SerializeToMsg(obj1); StaticTransientClass.Static = 19; var obj2 = (StaticTransientClass)serializer.Deserialize(msg); Assert.NotSame(obj1, obj2); Assert.Equal(null, obj2.Transient); Assert.Equal(19, StaticTransientClass.Static); }
public void StaticAndTransient() { Assert.True(PropertyBasedSerializationSurrogate.CanHandle(typeDataCache, FudgeFieldNameConvention.Identity, typeof(StaticTransientClass))); var serializer = new FudgeSerializer(context); // We're relying on it auto-discovering the type surrogate StaticTransientClass.Static = 17; var obj1 = new StaticTransientClass {Transient = "Hello"}; var msg = serializer.SerializeToMsg(obj1); StaticTransientClass.Static = 19; var obj2 = (StaticTransientClass)serializer.Deserialize(msg); Assert.NotSame(obj1, obj2); Assert.Equal(null, obj2.Transient); Assert.Equal(19, StaticTransientClass.Static); }