public IEnumerator NegativeOutOfGridRangeIndex()
    {
        yield return(null);

        var winDetector = GetWinDetector();
        var move        = new MoveData();
        var coordinate  = new GridCoordinate(0, 0);

        move.SetupFirstMoveToGrid(coordinate, BoardCellColor.Blue);
        winDetector.DoMove(move);
        coordinate.SetColumn(1);
        move.SetupFirstMoveToGrid(coordinate, BoardCellColor.White);
        winDetector.DoMove(move);
        coordinate.SetColumn(7);
        move.SetupFirstMoveToGrid(coordinate, BoardCellColor.Blue);

        Assert.That(() => winDetector.DoMove(move), Throws.TypeOf <Exception>());
    }
Exemple #2
0
    private void PopulateIndexes(GameObject placholderGameObject)
    {
        var name   = placholderGameObject.name;
        var size   = name.Length;
        var row    = int.Parse(name[size - 2].ToString());
        var column = int.Parse(name[size - 1].ToString());

        m_coordinate.SetRow(row);
        m_coordinate.SetColumn(column);
    }
    public IEnumerator NegativeWinOnFirstRow()
    {
        yield return(null);

        var winDetector = GetWinDetector();
        var move        = new MoveData();
        var coordinate  = new GridCoordinate(0, 0);

        move.SetupFirstMoveToGrid(coordinate, BoardCellColor.Blue);
        winDetector.DoMove(move);
        coordinate.SetColumn(1);
        move.SetupFirstMoveToGrid(coordinate, BoardCellColor.White);
        winDetector.DoMove(move);
        coordinate.SetColumn(2);
        move.SetupFirstMoveToGrid(coordinate, BoardCellColor.Blue);
        winDetector.DoMove(move);

        const bool expectedValue = false;

        Assert.AreEqual(expectedValue, winDetector.IsWinDetected(BoardCellColor.Blue));
    }