Пример #1
0
        public void TestLeftDiagonallLine()
        {
            Field field = new Field(10, 10);
            int   length;

            Cell[] lineElements;


            field.Cells[1, 1].Contain = BubbleSize.Big;
            field.Cells[1, 1].Color   = BubbleColor.Red;
            field.Cells[2, 2].Contain = BubbleSize.Big;
            field.Cells[2, 2].Color   = BubbleColor.Red;
            field.Cells[3, 3].Contain = BubbleSize.Big;
            field.Cells[3, 3].Color   = BubbleColor.Red;
            field.Cells[4, 4].Contain = BubbleSize.Big;
            field.Cells[4, 4].Color   = BubbleColor.Red;
            field.Cells[5, 5].Contain = BubbleSize.Big;
            field.Cells[5, 5].Color   = BubbleColor.Red;

            CheckLines _checkLines = new CheckLines(field, field.Cells[3, 3]);

            Assert.IsTrue(_checkLines.CheckLine_LeftDiagonal(out length, out lineElements));
            Assert.AreEqual(length, 5);
            Assert.AreSame(lineElements[2], field.Cells[1, 1]);
            Assert.AreSame(lineElements[4], field.Cells[5, 5]);
        }
Пример #2
0
        public void TestDoubleLine()
        {
            Field field = new Field(10, 10);
            int   line1Length;

            Cell[] line1Elements;
            int    line2Length;

            Cell[] line2Elements;

            //left diagonal line
            field.Cells[1, 1].Contain = BubbleSize.Big;
            field.Cells[1, 1].Color   = BubbleColor.Red;
            field.Cells[2, 2].Contain = BubbleSize.Big;
            field.Cells[2, 2].Color   = BubbleColor.Red;
            field.Cells[3, 3].Contain = BubbleSize.Big;
            field.Cells[3, 3].Color   = BubbleColor.Red;
            field.Cells[4, 4].Contain = BubbleSize.Big;
            field.Cells[4, 4].Color   = BubbleColor.Red;
            field.Cells[5, 5].Contain = BubbleSize.Big;
            field.Cells[5, 5].Color   = BubbleColor.Red;
            //+ vertical line
            field.Cells[2, 1].Contain = BubbleSize.Big;
            field.Cells[2, 1].Color   = BubbleColor.Red;
            field.Cells[3, 1].Contain = BubbleSize.Big;
            field.Cells[3, 1].Color   = BubbleColor.Red;
            field.Cells[4, 1].Contain = BubbleSize.Big;
            field.Cells[4, 1].Color   = BubbleColor.Red;
            field.Cells[5, 1].Contain = BubbleSize.Big;
            field.Cells[5, 1].Color   = BubbleColor.Red;

            CheckLines _checkLines = new CheckLines(field, field.Cells[1, 1]);

            Assert.IsTrue(_checkLines.CheckLine_LeftDiagonal(out line1Length, out line1Elements));
            Assert.AreEqual(line1Length, 5);
            Assert.AreSame(line1Elements[0], field.Cells[1, 1]);
            Assert.AreSame(line1Elements[4], field.Cells[5, 5]);

            Assert.IsTrue(_checkLines.CheckLine_Vertical(out line2Length, out line2Elements));
            Assert.AreEqual(line2Length, 5);
            Assert.AreSame(line2Elements[0], field.Cells[1, 1]);
            Assert.AreSame(line2Elements[4], field.Cells[5, 1]);
        }