Пример #1
0
		public void ReadInt_EndOfStreamException()
		{
			// Arrange
			NbtTagInfo tagInfo = (NbtTagInfo)new byte[] { 0x03, 0x00, 0x04 };
			byte[] data = new byte[] { 0x61, 0x73 };

			MemoryStream stream = new MemoryStream(data);

			NbtReader reader = new NbtReader(stream);

			// Act
			NbtInt result = reader.ReadInt(tagInfo);
		}
Пример #2
0
		public void ReadInt_ArgumentException()
		{
			// Arrange
			NbtTagInfo tagInfo = (NbtTagInfo)new byte[] { 0x00 };
			byte[] data = new byte[] { 0x61, 0x73, 0x64, 0x66, 0x12, 0x34, 0x56, 0x78 };

			MemoryStream stream = new MemoryStream(data);

			NbtReader reader = new NbtReader(stream);

			// Act
			NbtInt result = reader.ReadInt(tagInfo);
		}
Пример #3
0
		public void ReadInt_ObjectDisposedException()
		{
			// Arrange
			NbtTagInfo tagInfo = (NbtTagInfo)new byte[] { 0x03, 0x00, 0x04 };
			byte[] data = new byte[] { 0x61, 0x73, 0x64, 0x66, 0x12, 0x34, 0x56, 0x78 };

			MemoryStream stream = new MemoryStream(data);

			NbtReader reader = new NbtReader(stream);

			stream.Close();

			// Act
			NbtInt result = reader.ReadInt(tagInfo);
		}
Пример #4
0
		public void ReadInt_Normal()
		{
			// Arrange
			NbtTagInfo tagInfo = (NbtTagInfo)new byte[] { 0x03, 0x00, 0x04 };
			byte[] data = new byte[] { 0x61, 0x73, 0x64, 0x66, 0x12, 0x34, 0x56, 0x78 };

			MemoryStream stream = new MemoryStream(data);

			NbtReader reader = new NbtReader(stream);

			NbtTagType expectedTagType = NbtTagType.Int;
			string expectedName = "asdf";
			int expectedValue = 305419896;

			// Act
			NbtInt result = reader.ReadInt(tagInfo);

			// Assert
			Assert.AreEqual(expectedName, result.Name);
			Assert.AreEqual(expectedTagType, result.Type);
			Assert.AreEqual(expectedValue, result.Value);
		}