Esempio n. 1
0
        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);
                });
        }
Esempio n. 2
0
 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
         });
 }
Esempio n. 3
0
 public void RemoveRow_NonExistentRow_ReturnsFalse()
 {
     SafeExecuteTest(
         ExactlyFiveRowsSheetPath,
         (sheetData) =>
         {
             var target = new ArrayBasedSheetDataIndexer(sheetData);
             Assert.IsFalse(target.RemoveRow(6));
             ValidateRowSequence(target);
         });
 }
Esempio n. 4
0
 public void RemoveRow_NegativeIndex_ThrowsException()
 {
     SafeExecuteTest(
         EmptySheetPath,
         (sheetData) =>
         {
             var target = new ArrayBasedSheetDataIndexer(sheetData);
             target.RemoveRow(-1);
         });
 }
Esempio n. 5
0
        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);
                });
        }
Esempio n. 6
0
 public void RemoveRow_EmptySpreadsheet_DoesNothing()
 {
     SafeExecuteTest(
         EmptySheetPath,
         (sheetData) =>
         {
             var target = new ArrayBasedSheetDataIndexer(sheetData);
             target.RemoveRow(0);
         });
 }