예제 #1
0
        public void RemoveTotalLines()
        {
            var bottomStack = new BottomStack();
            var square1     = new TetriminoO();
            var square2     = new TetriminoO(3);
            var square3     = new TetriminoO(5);
            var square4     = new TetriminoO(7);
            var square5     = new TetriminoO(9);
            var tetriminoJ  = new TetriminoJ(10);

            tetriminoJ.Turn();
            tetriminoJ.MoveRight();

            Call.Action(Game.Height, () => {
                square1.MoveDown();
                square2.MoveDown();
                square3.MoveDown();
                square4.MoveDown();
                square5.MoveDown();
                tetriminoJ.MoveDown();
            });

            bottomStack.Add(square1);
            bottomStack.Add(square2);
            bottomStack.Add(square3);
            bottomStack.Add(square4);
            bottomStack.Add(square5);
            bottomStack.Add(tetriminoJ);

            bottomStack.RemoveCompletedLines();
            bottomStack.CompletedLineCount.Should().Be(0);
            bottomStack.Count().Should().Be(12);

            Check.That(bottomStack).IsEquivalentTo((24, 1), (24, 2), (24, 3), (24, 4), (24, 5), (24, 6), (24, 7), (24, 8), (24, 9), (24, 10), (24, 12), (23, 12));
        }
예제 #2
0
        public void GetTotalLines()
        {
            var bottomStack = new BottomStack();
            var square1     = new TetriminoO();
            var square2     = new TetriminoO(3);
            var square3     = new TetriminoO(5);
            var square4     = new TetriminoO(7);
            var square5     = new TetriminoO(9);
            var square6     = new TetriminoO(11);

            Call.Action(Game.Height, () =>
            {
                square1.MoveDown();
                square2.MoveDown();
                square3.MoveDown();
                square4.MoveDown();
                square5.MoveDown();
                square6.MoveDown();
            });
            bottomStack.Add(square1);
            bottomStack.Add(square2);
            bottomStack.Add(square3);
            bottomStack.Add(square4);
            bottomStack.Add(square5);


            bottomStack.CompletedLineCount.Should().Be(0);
            bottomStack.Add(square6);
            bottomStack.CompletedLineCount.Should().Be(2);
            bottomStack.CompletedLineBlocks.Should().HaveCount(24);
        }