示例#1
0
        public void SquareUI_WithPositiveBoardSize_HasRightSize(int row, int column, int boardUISize, int expectedWidth, int expectedHeight)
        {
            SquareUI squareUI = new SquareUI(row, column, boardUISize);

            Size expectedSize = new Size(expectedWidth, expectedHeight);
            Size actualSize   = squareUI.Size;

            Assert.AreEqual(expectedSize, actualSize);
        }
示例#2
0
        public void SquareUI_WithPositiveBoardIndexesAndBoardUISize_HasRightLocation(int row, int column, int boardUISize, int expectedY, int expectedX)
        {
            SquareUI squareUI = new SquareUI(row, column, boardUISize);

            Point expectedPosition = new Point(expectedX, expectedY);
            Point actualPosition   = squareUI.Location;

            Assert.AreEqual(expectedPosition, actualPosition);
        }
示例#3
0
        public void SquareUI_WithPositiveIndexes_HasRightBackgroundColor(int row, int column, int colorIndex)
        {
            Color[] squareColors = new Color[]
            {
                Color.White,
                Color.DimGray
            };
            SquareUI squareUI = new SquareUI(row, column, 0);

            Color expectedColor = squareColors[colorIndex];
            Color actualColor   = squareUI.BackColor;

            Assert.AreEqual(expectedColor, actualColor);
        }
示例#4
0
        public void BoardUI_WithSizeParameter_CreatesRowsWithAlternatingColors()
        {
            BoardUI boardUI = new BoardUI(0, new Board());

            for (int column = 0; column < 10; column++)
            {
                for (int row = 0; row < 9; row++)
                {
                    SquareUI currentSquare = boardUI.Squares[row, column];
                    SquareUI nextSquare    = boardUI.Squares[row + 1, column];

                    if (currentSquare.BackColor == nextSquare.BackColor)
                    {
                        Assert.Fail();
                    }
                }
            }
        }
示例#5
0
 void Awake()
 {
     _instance = this;
 }
示例#6
0
 public void SquareUI_WithIndexesLargerThanMaximumLimit_ThrowsIndexOutOfRangeException(int row, int column)
 {
     SquareUI squareUI = new SquareUI(row, column, 0);
 }
示例#7
0
 public void SquareUI_WithNegativeIndexes_ThrowsIndexOutOfRangeException(int row, int column)
 {
     SquareUI squareUI = new SquareUI(row, column, 0);
 }