Ejemplo n.º 1
0
        public void InsertRow_SequentialMiddleRowNoShift_DoesNotIncreaseCountOrMaxRow()
        {
            SafeExecuteTest(
                ExactlyFiveRowsSheetPath,
                (sheetData) =>
                {
                    var target = new ArrayBasedSheetDataIndexer(sheetData);
                    var halfway = target.Rows.ToList().Count / 2;

                    var oldCount = target.Count;
                    var oldMaxRow = target.MaxRowIndex;

                    target.InsertRow(new Row(), halfway);
                    Assert.IsFalse(target.IsEmpty);
                    Assert.AreEqual(oldCount, target.Count);
                    Assert.AreEqual(oldMaxRow, target.MaxRowIndex);
                    ValidateRowSequence(target);
                });
        }
Ejemplo n.º 2
0
        public void InsertRow_SequentialMiddleRowShift_IncreasesCountAndMaxRowByOne()
        {
            SafeExecuteTest(
                ExactlyFiveRowsSheetPath,
                (sheetData) =>
                {
                    var target = new ArrayBasedSheetDataIndexer(sheetData);
                    var halfway = (target.Rows.ToList().Count / 2) + 1;

                    var oldCount = target.Count;
                    var oldMaxRow = target.MaxRowIndex;

                    target.InsertRow(new Row(), halfway, true);
                    Assert.IsFalse(target.IsEmpty);
                    Assert.AreEqual(oldCount + 1, target.Count);
                    Assert.AreEqual(oldMaxRow + 1, target.MaxRowIndex);
                    ValidateRowSequence(target);
                });
        }
Ejemplo n.º 3
0
        public void InsertRow_SequentialMaxRowNoShift_IncreasesCountByOne()
        {
            SafeExecuteTest(
                ExactlyFiveRowsSheetPath,
                (sheetData) =>
                {
                    var target = new ArrayBasedSheetDataIndexer(sheetData);

                    var oldCount = target.Count;
                    var oldMaxRow = target.MaxRowIndex;

                    target.InsertRow(new Row(), target.MaxRowIndex);
                    Assert.IsFalse(target.IsEmpty);
                    Assert.AreEqual(oldCount, target.Count);
                    Assert.AreEqual(oldMaxRow, target.MaxRowIndex);
                    ValidateRowSequence(target);
                });
        }
Ejemplo n.º 4
0
 public void InsertRow_NullRowArgument_ThrowsException()
 {
     SafeExecuteTest(
         EmptySheetPath,
         (sheetData) =>
         {
             var target = new ArrayBasedSheetDataIndexer(sheetData);
             target.InsertRow(null, 1);
         });
 }
Ejemplo n.º 5
0
        public void InsertRow_NonExistingIndexShift_IncreasesCountAndMaxRow()
        {
            SafeExecuteTest(
                FiveEvenRowsSheetPath,
                (sheetData) =>
                {
                    var target = new ArrayBasedSheetDataIndexer(sheetData);

                    var oldCount = target.Count;
                    var oldMaxRow = target.MaxRowIndex;

                    target.InsertRow(new Row(), 1, true); // insert at an odd index, test file has only even rows
                    Assert.IsFalse(target.IsEmpty);
                    Assert.AreEqual(oldCount + 1, target.Count);
                    Assert.AreEqual(oldMaxRow + 1, target.MaxRowIndex);
                    ValidateRowSequence(target);
                });
        }
Ejemplo n.º 6
0
 public void InsertRow_NegativeIndex_ThrowsException()
 {
     SafeExecuteTest(
         ExactlyFiveRowsSheetPath,
         (sheetData) =>
         {
             var target = new ArrayBasedSheetDataIndexer(sheetData);
             target.InsertRow(new Row(), -1);
         });
 }
Ejemplo n.º 7
0
 public void InsertRow_IndexOverCapacity_ThrowsException()
 {
     SafeExecuteTest(
         ExactlyFiveRowsSheetPath,
         (sheetData) =>
         {
             var target = new ArrayBasedSheetDataIndexer(sheetData);
             target.InsertRow(new Row(), ArrayBasedSheetDataIndexer.Capacity + 1);
         });
 }