public void TestClearLines() { FakeBoard c = createInstance() as FakeBoard; IShape current = null; while (!(current is ShapeI)) { c = createInstance() as FakeBoard; current = c.shape; } ShapeProxy z = getProxy(c); Console.WriteLine("Board before drop of ShapeI"); UtilityClass.DrawFakeBoardContents(c); z.Drop(); Console.WriteLine("Button line should be clear and everthing should shft"); UtilityClass.DrawFakeBoardContents(c); //check if line got cleared Assert.AreEqual(c[19, 0], Color.Transparent); //check if the top piece shifted 1 down Assert.AreEqual(c[1, 0], Color.DarkRed); }
public void TestGameOver() { FakeBoard board = createInstance() as FakeBoard; board.GameOver += FakeGameOverHandler; ShapeProxy z = getProxy(board); //shapes will be dropped so after 6-7 pieces the board should be full for (int i = 0; i < 15; i++) { z.Drop(); UtilityClass.DrawFakeBoardContents(board); } }
public void TestBoardAddToPile() { FakeBoard board = createInstance() as FakeBoard; ShapeProxy a = getProxy(board); //make it so IShape wont clear line when dropped board.board[19, 0] = Color.Transparent; int index = 19; bool filled = false; IShape current = board.shape; Console.WriteLine("Board before the drop"); UtilityClass.DrawFakeBoardContents(board); Console.WriteLine(); for (int i = 0; i < 12; i++) { a.Drop(); Console.WriteLine("Board AFTER the drop"); UtilityClass.DrawFakeBoardContents(board); //check the middle or 1 to the right or left if (board[index, 5] != Color.Transparent || board[index, 5 + 1] != Color.Transparent || board[index, 5 - 1] != Color.Transparent) { filled = true; } else { filled = false; } index = index - 1; Console.WriteLine("Checking index = " + index); Assert.AreEqual(true, filled); } }
public void DropProxyTest() { ShapeProxy b = createInstance(); bool bottomLineFilled = false; //to avoid clearlines if ShapeI spawns boardInstance.board[19, 0] = Color.Transparent; //two places down Console.WriteLine("Board before drop\n"); UtilityClass.DrawFakeBoardContents(boardInstance); //move down once //act b.Drop(); String afterDrop = b.ToString(); Console.WriteLine("board After drop\n"); UtilityClass.DrawFakeBoardContents(boardInstance); if (boardInstance[19, 3] != Color.Transparent || boardInstance[19, 4] != Color.Transparent || boardInstance[19, 5] != Color.Transparent || boardInstance[19, 6] != Color.Transparent) { bottomLineFilled = true; } else { bottomLineFilled = false; } Assert.AreEqual(true, bottomLineFilled); }