[Test] public void test_serialisation_and_deserialisation() { var file = "test.obj"; var o = new SerialisationObj(); var serialised = Helpers.Serialise(o, file); var deserialised = Helpers.Deserialise <SerialisationObj>(file); Assert.AreEqual(o, serialised); Assert.AreNotEqual(o, deserialised); Assert.AreEqual(o.p, deserialised.p); }
public void test_serialisation_and_deserialisation() { string file = "test.obj"; SerialisationObj o = new SerialisationObj(); SerialisationObj serialised = Helpers.Serialise(o, file); SerialisationObj deserialised = Helpers.Deserialise <SerialisationObj>(file); Assert.AreEqual(o, serialised); Assert.AreNotEqual(o, deserialised); Assert.AreEqual(o.p, deserialised.p); }
[Test] public void test_get_or_serialise_functionality() { var file = "test.obj"; var o = new SerialisationObj(); var count = 0; Func <SerialisationObj> creater = () => { count++; return(o); }; var created = Helpers.GetOrSetSerialised(file, creater); var deserialised = Helpers.GetOrSetSerialised(file, creater); Assert.AreEqual(1, count); Assert.AreEqual(o, created); Assert.AreNotEqual(o, deserialised); Assert.AreEqual(o.p, deserialised.p); }