コード例 #1
0
        public void TestDAT()
        {
            var layout = RowLayout.CreateTyped(typeof(TestStruct));
            var t1     = new TestStruct();

            t1.Init(TimeSpan.MinValue);
            var t2 = new TestStruct();

            t2.Init(TimeSpan.MaxValue);
            var t3 = new TestStruct();

            t3.Init(DateTime.Now.TimeOfDay);
            var ms = new MemoryStream();
            var w  = new DatWriter(layout, ms);

            w.Write(t1);
            w.Write(t2);
            w.Write(t3);
            w.Close();
            var ms2  = new MemoryStream(ms.ToArray());
            var r    = new DatReader(ms2);
            var list = r.ReadList <TestStruct>();

            Assert.AreEqual(3, list.Count);
            Assert.AreEqual(t1, list[0]);
            Assert.AreEqual(t2, list[1]);
            Assert.AreEqual(t3, list[2]);
        }