Пример #1
0
        public void IncrementScore_AfterPlayerHitsACoin()
        {
            var startscore = 0;

            //subscribe to coinevent
            _collisionDetecter.CoinCollision += _collisionDetecter_CoinCollision;

            //simulate player hitting a coint
            _player.NextMove = Move.Right;
            _collisionDetecter.ObjectCollision(_playgroundObjects, _player, _player.NextMove);

            Assert.True(startscore == 1);

            void _collisionDetecter_CoinCollision(object sender, ImmovableEventArgs e)
            {
                startscore++;
            }
        }
Пример #2
0
        public void PlayerMovesInFreeArea_NoCollsion(Move move)
        {
            //move player to a nice empty area
            _player.X = 100;
            _player.Y = 100;

            //test if the player can move free
            Assert.AreEqual(Collision.Clear, _collisionDetector.ObjectCollision(_playgroundObjects, _player, move));
        }
Пример #3
0
 public void PlayerMovesInFreeArea_NoCollsion(Move move)
 {
     Assert.AreEqual(Collision.Clear, _collisionDetector.ObjectCollision(_playgroundObjects, _player, move));
 }