Esempio n. 1
0
        public void StructReadWrite()
        {
            var stream = new MemoryStream();
            var writer = new DatWriter(RowLayout.CreateTyped(typeof(TestStructClean)), stream);

            for (var i = 0; i < 100; i++)
            {
                var t = TestStructClean.Create(i);
                writer.Write(t);
            }
            stream.Seek(0, SeekOrigin.Begin);
            var reader = new DatReader(stream);

            for (var i = 0; i < 100; i++)
            {
                var t = new TestStructClean();
                Assert.IsTrue(reader.ReadRow(true, out t));
                Assert.AreEqual(t, TestStructClean.Create(i));
            }
        }