public void TestObjectSpeed() { ObjectTag objectTag = Helpers.GenerateObjectTag(); using (MemoryStream ms = new MemoryStream()) { objectTag.WriteTo(ms); ms.Position = 0; Tag.ReadFrom(ms); this.TestTagSpeed(ms, objectTag); } }
public async Task TestObjectSerialization() { ObjectTag objectTag = Helpers.GenerateObjectTag(); using (MemoryStream ms = new MemoryStream()) using (FileStream fs = File.Create(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Object.nbt"))) { objectTag.WriteTo(ms); ms.Position = 0; await ms.CopyToAsync(fs); Console.WriteLine("Finished object serialization."); ms.Position = 0; Assert.IsTrue(objectTag.Equals(Tag.ReadFrom <ObjectTag>(ms))); } }