public void TestManual() { SerializerTypes.AddType( new BinTypeDescription(typeof(Manual), "Manual") , new BinTypeVersion(10, 0) , BinTypeProcess.Create <Manual>(Manual.Write, Manual.Read) ); var input = new Manual(); input.FieldOne = "asd"; input.FieldTwo = "lsd"; var output = SerializeDeserialize(input); Assert.AreEqual(input.FieldOne, output.FieldOne); Assert.AreEqual(input.FieldTwo, output.FieldTwo); }
public void CallbacksManualTest() { SerializerTypes.AddType( new BinTypeDescription(typeof(CallbacksTestManualType), "CallbacksTestManualType") , new BinTypeVersion(42, 0) , BinTypeProcess.Create <CallbacksTestManualType>(CallbacksTestManualType.Write, CallbacksTestManualType.Read) ); var instance = new CallbacksTestManualType(); instance.First = 10; var result = SerializeDeserialize(instance); Assert.AreEqual(result.First, 10); Assert.AreEqual(result.Second, 10); Assert.AreEqual(result.FromFirstAndSecond, 100); }
public void TestManualGeneric() { var write = typeof(SerializeTests).GetMethod("WriteManualGeneric", BindingFlags.Static | BindingFlags.Public); var read = typeof(SerializeTests).GetMethod("ReadManualGeneric", BindingFlags.Static | BindingFlags.Public); SerializerTypes.AddType( new BinTypeDescription(typeof(ManualGenericType <,>), "ManualGenericType") , new BinTypeVersion(10, 0) , BinTypeProcess.Create(write, read) ); var input = new ManualGenericType <string, string>(); input.FieldOne = "asd"; input.FieldTwo = "lsd"; var output = SerializeDeserialize(input); Assert.AreEqual(input.FieldOne, output.FieldOne); Assert.AreEqual(input.FieldTwo, output.FieldTwo); }