public void ReadFloat_EndOfStreamException() { // Arrange NbtTagInfo tagInfo = (NbtTagInfo)new byte[] { 0x05, 0x00, 0x04 }; byte[] data = new byte[] { 0x61, 0x73 }; MemoryStream stream = new MemoryStream(data); NbtReader reader = new NbtReader(stream); // Act NbtFloat result = reader.ReadFloat(tagInfo); }
public void ReadFloat_ArgumentException() { // Arrange NbtTagInfo tagInfo = (NbtTagInfo)new byte[] { 0x00 }; byte[] data = new byte[] { 0x61, 0x73, 0x64, 0x66, 0xC0, 0x49, 0x0F, 0xDB }; MemoryStream stream = new MemoryStream(data); NbtReader reader = new NbtReader(stream); // Act NbtFloat result = reader.ReadFloat(tagInfo); }
public void ReadFloat_ObjectDisposedException() { // Arrange NbtTagInfo tagInfo = (NbtTagInfo)new byte[] { 0x05, 0x00, 0x04 }; byte[] data = new byte[] { 0x61, 0x73, 0x64, 0x66, 0xC0, 0x49, 0x0F, 0xDB }; MemoryStream stream = new MemoryStream(data); NbtReader reader = new NbtReader(stream); stream.Close(); // Act NbtFloat result = reader.ReadFloat(tagInfo); }
public void ReadFloat_Normal() { // Arrange NbtTagInfo tagInfo = (NbtTagInfo)new byte[] { 0x05, 0x00, 0x04 }; byte[] data = new byte[] { 0x61, 0x73, 0x64, 0x66, 0xC0, 0x49, 0x0F, 0xDB }; MemoryStream stream = new MemoryStream(data); NbtReader reader = new NbtReader(stream); NbtTagType expectedTagType = NbtTagType.Float; string expectedName = "asdf"; float expectedValue = -3.1415927F; // Act NbtFloat result = reader.ReadFloat(tagInfo); // Assert Assert.AreEqual(expectedName, result.Name); Assert.AreEqual(expectedTagType, result.Type); Assert.AreEqual(expectedValue, result.Value); }