Пример #1
0
        public void ShootTest()
        {
            var weed   = new Weed(2, 2);
            var bullet = weed.Shoot();

            Assert.AreEqual(bullet.X, 2);
            Assert.AreEqual(bullet.Y, 3);
            bullet.MoveBullet();
            Assert.AreEqual(bullet.Y, 4);
        }
Пример #2
0
        public void BulletKillsPlayerTest()
        {
            var textField = new[]
            {
                "#@#W",
                "####",
                "###P",
                "####"
            };
            var field  = Field.FromLines(textField);
            var player = new Player(field.initialCell);
            var weed   = new Weed(GetCurrentPosition(FieldCellStates.Weed, field).X, GetCurrentPosition(FieldCellStates.Weed, field).Y);
            var bullet = weed.Shoot();

            Assert.AreEqual(false, bullet.DeadInConflict(field, player));
            bullet.MoveBullet();
            Assert.AreEqual(true, bullet.DeadInConflict(field, player));
            Assert.AreEqual(16, player.Health);
        }