public void TestCase()
        {
            var model = new MyModel()
            {
                AnInt = 1, AString = "A", ABool = true
            };

            var aFileName = BinaryFormatterExample.Serialize(model);
            var outModel  = BinaryFormatterExample.Deserialize <MyModel> (aFileName);

            Assert.AreEqual(model, outModel);
        }
        public void TestCase()
        {
            var model = new ExampleISerializable()
            {
                MyField = "Hello"
            };

            var aFileName = BinaryFormatterExample.Serialize(model);
            var outModel  = BinaryFormatterExample.Deserialize <ExampleISerializable> (aFileName);

            Assert.AreEqual("Hello", outModel.MyField);
        }
Ejemplo n.º 3
0
        public void TestCase()
        {
            var model = new SerializeEventsExample();

            var aFileName = BinaryFormatterExample.Serialize(model);
            var outModel  = BinaryFormatterExample.Deserialize <SerializeEventsExample> (aFileName);

            Assert.IsFalse(model.OnDeserializedFire);
            Assert.IsTrue(model.OnSerializingFire);

            Assert.IsTrue(outModel.OnSerializingFire);
            Assert.IsTrue(outModel.OnDeserializedFire);
        }