public void ReadingAtWithExplicitBuffer() { var buffer = new ConsoleInputBuffer(); buffer.Insert("abcd"); var outBuffer = new char[4]; buffer.ReadAt(0, outBuffer, 0, 2); outBuffer[0].Should().Be('a'); outBuffer[1].Should().Be('b'); buffer.ReadAt(2, outBuffer, 0, 2); outBuffer[0].Should().Be('c'); outBuffer[1].Should().Be('d'); outBuffer[0] = 'x'; buffer.ReadAt(0, outBuffer, 1, 1); outBuffer[0].Should().Be('x'); outBuffer[1].Should().Be('a'); buffer.Invoking(b => b.ReadAt(0, null, 0, 2)).Should().Throw <ArgumentNullException>(); buffer.Invoking(b => b.ReadAt(2, outBuffer, 0, 4)).Should().Throw <ArgumentException>(); buffer.Invoking(b => b.ReadAt(2, outBuffer, 3, 2)).Should().Throw <ArgumentException>(); }
public void ReadingAt() { var buffer = new ConsoleInputBuffer(); buffer.Insert("abcd"); buffer.ReadAt(0, 2).Should().Equal('a', 'b'); buffer.ReadAt(2, 2).Should().Equal('c', 'd'); buffer.Invoking(b => b.ReadAt(2, 4)).Should().Throw <ArgumentException>(); buffer.Invoking(b => b.ReadAt(3, 2)).Should().Throw <ArgumentException>(); }
public void ReadingAt() { var buffer = new ConsoleInputBuffer(); buffer.Insert("abcd"); buffer.ReadAt(0, 2).Should().ContainInOrder('a', 'b'); buffer.ReadAt(2, 2).Should().ContainInOrder('c', 'd'); ((Action)(() => buffer.ReadAt(2, 4))).ShouldThrow <ArgumentException>(); ((Action)(() => buffer.ReadAt(3, 2))).ShouldThrow <ArgumentException>(); }