public void Read_Fact() { var mock = new MockIOBuffer(0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f); var output = new byte[8]; mock.ReadInto(output, 3, 2); output.ShouldEnumerateEqual(0, 0, 0, 0x0a, 0x0b, 0, 0, 0); mock.ReadIndex.ShouldEqual(2); mock.ReadInto(output, 3, 3); output.ShouldEnumerateEqual(0, 0, 0, 0x0c, 0x0d, 0x0e, 0, 0); mock.ReadIndex.ShouldEqual(5); mock.ReadInto(output, 0, 1); output.ShouldEnumerateEqual(0x0f, 0, 0, 0x0c, 0x0d, 0x0e, 0, 0); mock.ReadIndex.ShouldEqual(6); }
public void ReadPastEndThrows_Fact() { var mock = new MockIOBuffer(0x0a); var output = new byte[8]; var e = Trap.Exception(() => mock.ReadInto(output, 0, 4)); e.ShouldBeOfType(typeof(IndexOutOfRangeException)); }