public void Insert_throws_expected_exceptions() { // ARRANGE var instance = new MdTable(new MdTableRow(MdEmptySpan.Instance)); // ACT / ASSERT Assert.Throws <ArgumentNullException>(() => instance.Insert(0, null !)); Assert.Throws <ArgumentOutOfRangeException>(() => instance.Insert(-1, new MdTableRow(MdEmptySpan.Instance))); Assert.Throws <ArgumentOutOfRangeException>(() => instance.Insert(2, new MdTableRow(MdEmptySpan.Instance))); }
public void Insert_inserts_a_row_at_the_specifed_index_01() { // ARRANGE var instance = new MdTable(new MdTableRow(MdEmptySpan.Instance)); var row = new MdTableRow(MdEmptySpan.Instance); // ACT instance.Insert(0, row); // ASSERT Assert.Equal(1, instance.RowCount); Assert.Same(row, instance.Rows.Single()); }
public void Insert_inserts_a_row_at_the_specifed_index_03(int insertAt) { // ARRANGE var instance = new MdTable(new MdTableRow(MdEmptySpan.Instance)) { new MdTableRow(MdEmptySpan.Instance), new MdTableRow(MdEmptySpan.Instance) }; var row = new MdTableRow(MdEmptySpan.Instance); // ACT instance.Insert(insertAt, row); // ASSERT Assert.Equal(3, instance.RowCount); Assert.Same(row, instance.Rows.Skip(insertAt).First()); }