Exemplo n.º 1
0
        public void FakeTableCellSearchTest()
        {
            const int width  = 20;
            const int height = 40;
            var       table  = new FakeTable(width, height);

            var positions    = new[] { new CellPosition(1, 1), new CellPosition(40, 20), new CellPosition(10, 10) };
            var stringValues = new[] { "Test Value", "Test Test", "Another text" };

            for (var i = 0; i < positions.Count(); ++i)
            {
                var cell = table.InsertCell(positions[i]);
                cell.StringValue = stringValues[i];
            }

            var cells      = table.SearchCellByText("Test");
            var cellsArray = cells as ICell[] ?? cells.ToArray();

            cellsArray.Length.Should().Be(2);
            cellsArray[0].Should().NotBeNull();
            cellsArray[1].Should().NotBeNull();

            cellsArray[0].CellPosition.RowIndex.Should().Be(1);
            cellsArray[0].CellPosition.ColumnIndex.Should().Be(1);
            cellsArray[1].CellPosition.RowIndex.Should().Be(40);
            cellsArray[1].CellPosition.ColumnIndex.Should().Be(20);
        }