public void Read_ZeroLength_ReturnsEmptyArray() { var data = new byte[10]; var container = new ByteArrayContainer(data); CollectionAssert.AreEqual(container.Read(0, 0), new byte[0]); }
public void Read_TooCloseToEnd_ReturnsTruncatedArray() { var data = new byte[10]; var container = new ByteArrayContainer(data); CollectionAssert.AreEqual(container.Read(5, 10), new byte[5]); }
public void Read_NegativeOffset_ThrowsArgumentOutOfRangeException() { var data = new byte[0]; var container = new ByteArrayContainer(data); Assert.Throws <ArgumentOutOfRangeException>(() => container.Read(-1, 0)); }
public void Read_BeyondEnd_ReturnsEmptyArray() { var data = new byte[10]; var container = new ByteArrayContainer(data); CollectionAssert.AreEqual(container.Read(20, 10), new byte[0]); }
public void Read_Contents_ReturnsCorrectContents() { var data = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; var container = new ByteArrayContainer(data); CollectionAssert.AreEqual( container.Read(5, 10), new byte[] { 6, 7, 8, 9, 10 }); }