Beispiel #1
0
        public void ChromaTower_GameStart_ShouldStartIdle()
        {
            IScoreKeeper scoreKeeper = new PlayerPrefScoreKeeper();
            IPlayerState playerState = new PlayerState(new PlayerHPStaticRate());
            IDifficulty  difficulty  = new Difficulty(playerState);

            ChromaTower tower = new ChromaTower(scoreKeeper, playerState, difficulty);

            Assert.AreEqual(tower.GameState, GameState.Idle);
        }
Beispiel #2
0
        public void ChromaTower_HitCheck_GameShouldEndOnZeroHP()
        {
            IScoreKeeper scoreKeeper = new PlayerPrefScoreKeeper();
            IPlayerState playerState = new PlayerState(new PlayerHPStaticRate(100, 0.5f, 0.5f));
            IDifficulty  difficulty  = new Difficulty(playerState);

            ChromaTower tower = new ChromaTower(scoreKeeper, playerState, difficulty);

            tower.HitCheck(1, 2); //50% left
            tower.HitCheck(1, 2); //0% left

            Assert.AreEqual(tower.GameState, GameState.GameOver);
        }
Beispiel #3
0
        public void ChromaTower_HitCheck_PlayerShouldTakeDamageOnDifferentColor()
        {
            IScoreKeeper scoreKeeper = new PlayerPrefScoreKeeper();
            IPlayerState playerState = new PlayerState(new PlayerHPStaticRate());
            IDifficulty  difficulty  = new Difficulty(playerState);

            ChromaTower tower    = new ChromaTower(scoreKeeper, playerState, difficulty);
            int         hpBefore = playerState.HP;

            tower.HitCheck(1, 2);

            int hpAfter = playerState.HP;

            Assert.Greater(hpBefore, hpAfter);
        }
Beispiel #4
0
        public void ChromaTower_HitCheck_PlayerShouldRegenHPOnSameColor()
        {
            IScoreKeeper scoreKeeper = new PlayerPrefScoreKeeper();
            IPlayerState playerState = new PlayerState(new PlayerHPStaticRate());
            IDifficulty  difficulty  = new Difficulty(playerState);

            ChromaTower tower = new ChromaTower(scoreKeeper, playerState, difficulty);

            tower.HitCheck(1, 2); //take damage
            int hpBefore = playerState.HP;

            tower.HitCheck(1, 1); //regen
            int hpAfter = playerState.HP;

            Assert.Less(hpBefore, hpAfter);
        }