Пример #1
0
        public void SerDeser_OneSimplePerson()
        {
            var row1 = new SimplePersonRow
            {
                Age = 123, Bool1 = true, ID = new GDID(12, 234), Name = "Jacques Jabakz", Salary = 143098, Str1 = "Tryten", Date = new DateTime(1980, 08, 12, 13, 45, 11)
            };
            var writer = SlimFormat.Instance.GetWritingStreamer();
            var reader = SlimFormat.Instance.GetReadingStreamer();

            using (var ms = new MemoryStream())
            {
                writer.BindStream(ms);
                ArowSerializer.Serialize(row1, writer);
                writer.UnbindStream();

                ms.Position = 0;

                var row2 = new SimplePersonRow();
                reader.BindStream(ms);
                ArowSerializer.Deserialize(row2, reader);
                reader.UnbindStream();

                Aver.AreEqual(row1.ID, row2.ID);
                Aver.AreEqual(row1.Bool1, row2.Bool1);
                Aver.AreEqual(row1.Name, row2.Name);
                Aver.AreEqual(row1.Age, row2.Age);
                Aver.AreEqual(row1.Salary, row2.Salary);
                Aver.AreEqual(row1.Str1, row2.Str1);
                Aver.AreEqual(row1.Date, row2.Date);
            }
        }
Пример #2
0
        public void SerDeserSubarray_OneSimplePerson()
        {
            var row1 = new SimplePersonRow
            {
                Age    = 123,
                Bool1  = true,
                ID     = new GDID(12, 234),
                Name   = "Jacques Shiraquez",
                Salary = 143098,
                Str1   = "Zoloto",
                Date   = new DateTime(1980, 08, 12, 13, 45, 11)
            };

            var data = ArowSerializer.SerializeToSubarray(row1);


            var row2 = new SimplePersonRow();

            ArowSerializer.Deserialize(row2, data.Array, 0);

            Aver.AreEqual(row1.ID, row2.ID);
            Aver.AreEqual(row1.Bool1, row2.Bool1);
            Aver.AreEqual(row1.Name, row2.Name);
            Aver.AreEqual(row1.Age, row2.Age);
            Aver.AreEqual(row1.Salary, row2.Salary);
            Aver.AreEqual(row1.Str1, row2.Str1);
            Aver.AreEqual(row1.Date, row2.Date);
        }