예제 #1
0
        public void TestListSpeed()
        {
            ListTag list = Helpers.GenerateLongList();

            using (MemoryStream ms = new MemoryStream())
            {
                list.WriteTo(ms);
                ms.Position = 0;
                Tag.ReadFrom(ms);

                this.TestTagSpeed(ms, list);
            }
        }
예제 #2
0
        public async Task TestListSerialization()
        {
            ListTag list = Helpers.GenerateLongList();

            using (MemoryStream ms = new MemoryStream())
                using (FileStream fs = File.Create(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "List.nbt")))
                {
                    list.WriteTo(ms);

                    ms.Position = 0;
                    await ms.CopyToAsync(fs);

                    Console.WriteLine("Finished list serialization.");

                    ms.Position = 0;
                    Assert.AreEqual(list, Tag.ReadFrom <ListTag>(ms));
                }
        }