public void ReadLong_ObjectDisposedException() { // Arrange NbtTagInfo tagInfo = (NbtTagInfo)new byte[] { 0x04, 0x00, 0x04 }; byte[] data = new byte[] { 0x61, 0x73, 0x64, 0x66, 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF }; MemoryStream stream = new MemoryStream(data); NbtReader reader = new NbtReader(stream); stream.Close(); // Act NbtLong result = reader.ReadLong(tagInfo); }
public void ReadLong_EndOfStreamException() { // Arrange NbtTagInfo tagInfo = (NbtTagInfo)new byte[] { 0x04, 0x00, 0x04 }; byte[] data = new byte[] { 0x61, 0x73 }; MemoryStream stream = new MemoryStream(data); NbtReader reader = new NbtReader(stream); // Act NbtLong result = reader.ReadLong(tagInfo); }
public void ReadLong_Normal() { // Arrange NbtTagInfo tagInfo = (NbtTagInfo)new byte[] { 0x04, 0x00, 0x04 }; byte[] data = new byte[] { 0x61, 0x73, 0x64, 0x66, 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF }; MemoryStream stream = new MemoryStream(data); NbtReader reader = new NbtReader(stream); NbtTagType expectedTagType = NbtTagType.Long; string expectedName = "asdf"; long expectedValue = 81985529216486895; // Act NbtLong result = reader.ReadLong(tagInfo); // Assert Assert.AreEqual(expectedName, result.Name); Assert.AreEqual(expectedTagType, result.Type); Assert.AreEqual(expectedValue, result.Value); }