Пример #1
0
        public IEnumerator TestWhenLoseAllBallsLoseLife()
        {
            platform.AutoPlay = false;

            MultiBallsPowerUp multiBallsPowerUp = GameObject.FindObjectOfType <MultiBallsPowerUp>();

            Block powerUp = GameObject.FindGameObjectWithTag("PowerUpMultiBalls").GetComponent <Block>();

            ball.transform.position = new Vector2(powerUp.transform.position.x - 0.5f, platform.transform.position.y);
            ball.ThrowBall();

            yield return(new WaitForSeconds(0.5f));

            Ball[] balls = GameObject.FindObjectsOfType <Ball>();

            while (balls.Length != 0 && balls[0].getGameStarted() == true)
            {
                balls = GameObject.FindObjectsOfType <Ball>();

                yield return(new WaitForSeconds(0.1f));
            }

            Assert.AreEqual(1, balls.Length);
            Assert.AreEqual(2, lives.getPlayerLives());
        }
Пример #2
0
        public IEnumerator TestVerifyIfHas3Balls()
        {
            MultiBallsPowerUp multiBallsPowerUp = GameObject.FindObjectOfType <MultiBallsPowerUp>();

            Block powerUp = GameObject.FindGameObjectWithTag("PowerUpMultiBalls").GetComponent <Block>();

            ball.transform.position = new Vector2(powerUp.transform.position.x - 0.5f, platform.transform.position.y);
            ball.ThrowBall();

            yield return(new WaitForSeconds(0.5f));

            Ball[] balls = GameObject.FindObjectsOfType <Ball>();

            Assert.AreEqual(3, balls.Length);
        }
Пример #3
0
        public IEnumerator TestIfExecutePowerUpIsCalledWhenBlockIsDestroyed()
        {
            MultiBallsPowerUp multiBallsPowerUp = GameObject.FindObjectOfType <MultiBallsPowerUp>();

            var _powerUp = Substitute.For <IPowerUp>();

            multiBallsPowerUp.setPowerUp(_powerUp);

            Block powerUp = GameObject.FindGameObjectWithTag("PowerUpMultiBalls").GetComponent <Block>();

            ball.transform.position = new Vector2(powerUp.transform.position.x - 0.5f, platform.transform.position.y);
            ball.ThrowBall();

            yield return(new WaitForSeconds(0.5f));

            _powerUp.Received(1).ExecutePowerUp(ball.gameObject);
        }