Example #1
0
        public void Populate_GetCellForOutOfRangeReturnsNull(string populateText, int getRow, int getCol)
        {
            var grid = new StringSearchGrid(populateText);
            var cell = grid.GetCell(getRow, getCol);

            cell.Should().BeNull();
        }
Example #2
0
        public void Populate_GetCellTest(string populateText, int getRow, int getCol, char expectedValue)
        {
            var grid = new StringSearchGrid(populateText);
            var cell = grid.GetCell(getRow, getCol);

            cell.Should().NotBeNull();
            cell.Value.Should().Be(expectedValue);
        }
        public void ApplyStringToGridTest(string populateText, string applyString, int startRow, int startColumn, CellDirection direction, bool expectedApplied)
        {
            var  grid        = new StringSearchGrid(populateText);
            var  gridCell    = grid.GetCell(startRow, startColumn);
            bool applyResult = gridCell.Apply(applyString, direction);

            applyResult.Should().Be(expectedApplied);
            grid.Contains(applyString).Should().Be(expectedApplied);
        }
        public void CanStringBeAssignedToGridTest(string populateText, int startRow, int startColumn,
                                                  string desiredString, CellDirection direction, bool expectedCanBeAssigned)
        {
            var grid      = new StringSearchGrid(populateText);
            var startCell = grid.GetCell(startRow, startColumn);

            var canBeAssignedResult = startCell.CanBeAssigned(desiredString, direction);

            canBeAssignedResult.Should().Be(expectedCanBeAssigned);
        }
Example #5
0
        public void DirectionTest(string populateText, int getRow, int getCol, CellDirection direction, char?expectedValue)
        {
            var grid       = new StringSearchGrid(populateText);
            var cell       = grid.GetCell(getRow, getCol);
            var resultCell = cell.GetNextCell(direction);

            if (expectedValue == null)
            {
                resultCell.Should().BeNull();
            }
            else
            {
                resultCell.Value.Should().Be(expectedValue);
            }
        }