public override void Load(NbtReader reader, INbtContainerNode parent) { base.Load(reader, parent); Value = reader.ReadDouble(); }
public void ReadDouble_ObjectDisposedException() { // Arrange NbtTagInfo tagInfo = (NbtTagInfo)new byte[] { 0x06, 0x00, 0x04 }; byte[] data = new byte[] { 0x61, 0x73, 0x64, 0x66, 0x40, 0x09, 0x21, 0xFB, 0x54, 0x44, 0x2D, 0x18 }; MemoryStream stream = new MemoryStream(data); NbtReader reader = new NbtReader(stream); stream.Close(); // Act NbtDouble result = reader.ReadDouble(tagInfo); }
public void ReadDouble_EndOfStreamException() { // Arrange NbtTagInfo tagInfo = (NbtTagInfo)new byte[] { 0x06, 0x00, 0x04 }; byte[] data = new byte[] { 0x61, 0x73 }; MemoryStream stream = new MemoryStream(data); NbtReader reader = new NbtReader(stream); // Act NbtDouble result = reader.ReadDouble(tagInfo); }
public void ReadDouble_Normal() { // Arrange NbtTagInfo tagInfo = (NbtTagInfo)new byte[] { 0x06, 0x00, 0x04 }; byte[] data = new byte[] { 0x61, 0x73, 0x64, 0x66, 0x40, 0x09, 0x21, 0xFB, 0x54, 0x44, 0x2D, 0x18 }; MemoryStream stream = new MemoryStream(data); NbtReader reader = new NbtReader(stream); NbtTagType expectedTagType = NbtTagType.Double; string expectedName = "asdf"; double expectedValue = 3.14159265358979311599796346854E0; // Act NbtDouble result = reader.ReadDouble(tagInfo); // Assert Assert.AreEqual(expectedName, result.Name); Assert.AreEqual(expectedTagType, result.Type); Assert.AreEqual(expectedValue, result.Value); }