Exemplo n.º 1
0
    public void RotateIPieceCCW()
    {
        CommonInstall();
        // Use the Assert class to test conditions.

        TetrisPiece piece = factory.Create();

        piece.Init(TetrisPiece.PieceType.I);

        piece.Rotate(TetrisPiece.Rotation.CCW);
        piece.ApplyChange();
        Assert.AreEqual(
            "0100\n" +
            "0100\n" +
            "0100\n" +
            "0100",
            piece.GetString(), "Failed CCW rotate once");

        piece.Rotate(TetrisPiece.Rotation.CCW);
        piece.ApplyChange();
        Assert.AreEqual(
            "0000\n" +
            "0000\n" +
            "1111\n" +
            "0000",
            piece.GetString(), "Failed CCW rotate twice");

        piece.Rotate(TetrisPiece.Rotation.CCW);
        piece.ApplyChange();
        Assert.AreEqual(
            "0010\n" +
            "0010\n" +
            "0010\n" +
            "0010",
            piece.GetString(), "Failed CCW rotate three times");

        piece.Rotate(TetrisPiece.Rotation.CCW);
        piece.ApplyChange();
        Assert.AreEqual(
            "0000\n" +
            "1111\n" +
            "0000\n" +
            "0000",
            piece.GetString(), "Failed CCW rotate four times");
    }