Ejemplo n.º 1
0
        public void IsNextAdjacentWorksForSameRow()
        {
            var a1 = new CellRef("A1");
            var b1 = new CellRef("B1");

            b1.IsNextAdjacentTo(a1).Should().BeTrue();
        }
Ejemplo n.º 2
0
        public void IsNextAdjacentReturnsFalseForPreviousAdjacentRow()
        {
            var a1 = new CellRef("A1");
            var a2 = new CellRef("A2");

            a1.IsNextAdjacentTo(a2).Should().BeFalse();
        }
Ejemplo n.º 3
0
        public void IsNextAdjacentReturnsFalseFoPreviousAdjacentRow()
        {
            var a1 = new CellRef("A1");
            var b1 = new CellRef("B1");

            a1.IsNextAdjacentTo(b1).Should().BeFalse();
        }
Ejemplo n.º 4
0
        public void IsNextAdjacentWorksForNextRow()
        {
            var a1 = new CellRef("A1");
            var a2 = new CellRef("A2");

            a2.IsNextAdjacentTo(a1).Should().BeTrue();
        }
Ejemplo n.º 5
0
        public void IsNextAdjacentReturnsFalseForNonAdjacent()
        {
            var a1 = new CellRef("A1");
            var c3 = new CellRef("C3");

            a1.IsNextAdjacentTo(c3).Should().BeFalse();
            c3.IsNextAdjacentTo(a1).Should().BeFalse();
        }
Ejemplo n.º 6
0
        private void GetCellAttributesAndReadValue()
        {
            var nextCell = ReadNextCell();

            switch (_readNextBehaviour)
            {
            case ReadNextBehaviour.SkipNulls:
                Address = nextCell.Key;
                Value   = nextCell.Value;
                break;

            case ReadNextBehaviour.ReadAllNulls:
                //If first cell read:
                if (!AddressCelRef.HasValue)
                {
                    Address       = nextCell.Key;
                    Value         = nextCell.Value;
                    AddressCelRef = new CellRef(Address);
                }
                else
                {
                    var nextCellRef = new CellRef(nextCell.Key);
                    //If not first cell read bit adjacent to first cell
                    if (nextCellRef.IsNextAdjacentTo(AddressCelRef))
                    {
                        Address       = nextCell.Key;
                        Value         = nextCell.Value;
                        AddressCelRef = nextCellRef;
                    }
                    //If not first cell read and not adjacent to first cell
                    else
                    {
                        var nextAdjacent =
                            AddressCelRef.Value.GetNextAdjacent(WorksheetDimension.BottomRight.ColumnNumber);
                        Address                = nextAdjacent.ToString();
                        Value                  = null;
                        AddressCelRef          = nextAdjacent;
                        NextPopulatedCellRef   = nextCellRef;
                        NextPopulatedCellValue = nextCell.Value;
                    }
                }
                break;

            default:
                throw new NotImplementedException();
            }
        }