Esempio n. 1
0
        public void TestBasicWriteRead()
        {
            FileSerializer <SerializationTestBasic> serializer = new FileSerializer <SerializationTestBasic>();

            SerializationTestBasic write = new SerializationTestBasic {
                TestBool       = true,
                TestInt        = -100,
                TestString     = "abc" + Environment.NewLine + "def",
                TestStringNull = null,
                TestEnum       = TestEnum.D
            };

            serializer.Write("basic_wr", write);
            Assert.IsTrue(File.Exists("basic_wr"));

            SerializationTestBasic read = new SerializationTestBasic();

            serializer.Read("basic_wr", read);

            Assert.IsTrue(read.TestBool);
            Assert.AreEqual(-100, read.TestInt);
            Assert.AreEqual("abc" + Environment.NewLine + "def", read.TestString);
            Assert.IsNull(read.TestStringNull);
            Assert.AreEqual(TestEnum.D, read.TestEnum);
        }