public void RemoveRow_SequentialMiddleRowShiftUp_DecreasesCountAndMaxRowByOne() { SafeExecuteTest( ExactlyFiveRowsSheetPath, (sheetData) => { var target = new ArrayBasedSheetDataIndexer(sheetData); var oldCount = target.Count; var oldMaxRowIndex = target.MaxRowIndex; Assert.IsTrue(target.RemoveRow(target.Rows.First().RowIndex, true)); Assert.AreEqual(oldCount - 1, target.Count); Assert.AreEqual(oldMaxRowIndex - 1, target.MaxRowIndex); ValidateRowSequence(target); }); }
public void RemoveRow_OverCapacityIndex_ThrowsException() { SafeExecuteTest( EmptySheetPath, (sheetData) => { var target = new ArrayBasedSheetDataIndexer(sheetData); target.RemoveRow(ArrayBasedSheetDataIndexer.Capacity + 2); // Row indices are one based, hence the +2 is needed }); }
public void RemoveRow_NonExistentRow_ReturnsFalse() { SafeExecuteTest( ExactlyFiveRowsSheetPath, (sheetData) => { var target = new ArrayBasedSheetDataIndexer(sheetData); Assert.IsFalse(target.RemoveRow(6)); ValidateRowSequence(target); }); }
public void RemoveRow_NegativeIndex_ThrowsException() { SafeExecuteTest( EmptySheetPath, (sheetData) => { var target = new ArrayBasedSheetDataIndexer(sheetData); target.RemoveRow(-1); }); }
public void RemoveRow_MaxRowShift_DecreasesCountByOne() { SafeExecuteTest( ExactlyFiveRowsSheetPath, (sheetData) => { var target = new ArrayBasedSheetDataIndexer(sheetData); var oldCount = target.Count; var oldMaxRowIndex = target.MaxRowIndex; Assert.IsTrue(target.RemoveRow(target.MaxRowIndex, true)); Assert.AreEqual(oldCount - 1, target.Count); Assert.AreNotEqual(oldMaxRowIndex, target.MaxRowIndex); // Might not necessarily be minus one. ValidateRowSequence(target); }); }
public void RemoveRow_EmptySpreadsheet_DoesNothing() { SafeExecuteTest( EmptySheetPath, (sheetData) => { var target = new ArrayBasedSheetDataIndexer(sheetData); target.RemoveRow(0); }); }