Esempio n. 1
0
        public void TestSelectedValue()
        {
            BlueBlock blue = new BlueBlock(0, 0);

            Assert.IsFalse(blue.Selected);

            blue.Selected = true;
            Assert.IsTrue(blue.Selected);
        }
Esempio n. 2
0
        public void TestAddBlock()
        {
            RedBlock  red   = new RedBlock(20, 20);
            BlueBlock blue  = new BlueBlock(0, 0);
            Board     board = new Board();

            board.AddBlock(0, 0, red);
            board.AddBlock(0, 1, blue);

            Assert.AreSame(blue, board.Block [0, 1]);
        }
Esempio n. 3
0
        public void TestBlockColor()
        {
            RedBlock    red    = new RedBlock(0, 0);
            GreenBlock  green  = new GreenBlock(0, 0);
            BlueBlock   blue   = new BlueBlock(0, 0);
            YellowBlock yellow = new YellowBlock(0, 20);

            Assert.AreEqual(Color.Yellow, yellow.Color);
            Assert.AreEqual(Color.Red, red.Color);
            Assert.AreEqual(Color.Blue, blue.Color);
            Assert.AreEqual(Color.Green, green.Color);
        }
Esempio n. 4
0
        public void TestSwapNotNeighbour()
        {
            RedBlock  red   = new RedBlock(20, 20);
            BlueBlock blue  = new BlueBlock(0, 0);
            Board     board = new Board();

            //add blocks into board
            board.AddBlock(0, 0, red);
            board.AddBlock(1, 1, blue);

            //the color of both blocks should remain unchanged as they are not neighbour block
            board.Swap(red, blue);
            Assert.AreEqual(Color.Red, red.Color);
            Assert.AreEqual(Color.Blue, blue.Color);
        }
Esempio n. 5
0
        public void TestSwapLeftRight()
        {
            RedBlock  red   = new RedBlock(20, 20);
            BlueBlock blue  = new BlueBlock(0, 0);
            Board     board = new Board();

            //add blocks into board
            //red and blue blocks are next to each other
            board.AddBlock(0, 0, red);
            board.AddBlock(0, 1, blue);

            board.Swap(red, blue);
            Assert.AreEqual(Color.Blue, red.Color);
            Assert.AreEqual(Color.Red, blue.Color);

            board.Swap(red, blue);
            Assert.AreEqual(Color.Red, red.Color);
            Assert.AreEqual(Color.Blue, blue.Color);
        }
Esempio n. 6
0
        public void TestSwapUpDown()
        {
            RedBlock  red   = new RedBlock(20, 20);
            BlueBlock blue  = new BlueBlock(0, 0);
            Board     board = new Board();

            //add blocks into board
            //red block is above blue block
            board.AddBlock(0, 0, red);
            board.AddBlock(1, 0, blue);

            board.Swap(red, blue);
            Assert.AreEqual(Color.Blue, red.Color);
            Assert.AreEqual(Color.Red, blue.Color);

            board.Swap(red, blue);
            Assert.AreEqual(Color.Red, red.Color);
            Assert.AreEqual(Color.Blue, blue.Color);
        }