Esempio n. 1
0
        public void ReloadAfterShotWithNoAmmo()
        {
            // Arrange
            var alien = new Alien();
            var gun   = new Raygun();

            // Act
            while (gun.HasAmmo())
            {
                gun.Shoot(alien);
            }

            gun.Shoot(alien);

            // Assert
            Assert.True(gun.HasAmmo());
        }
Esempio n. 2
0
        public void HaveAmmoAfterReload()
        {
            // Arrange
            var alien = new Alien();
            var gun   = new Raygun();

            // Act
            while (gun.HasAmmo())
            {
                gun.Shoot(alien);
            }

            gun.Reload();

            // Assert
            Assert.True(gun.HasAmmo());
        }
Esempio n. 3
0
        public void TryShootDodgingBug()
        {
            Bug bug = new Bug();

            //Raygun gun = new Raygun();

            bug.Dodge();
            gun.FireAt(bug);

            bug.Dodge();
            gun.FireAt(bug);

            bug.Dodge();
            gun.FireAt(bug);

            Assert.IsFalse(bug.IsDead());
            Assert.IsFalse(gun.HasAmmo());
        }
Esempio n. 4
0
        public void TryShootBug()
        {
            Bug bug = new Bug ();
            Raygun gun = new Raygun ();

            gun.FireAt (bug);

            Assert.True (bug.IsDead ());
            Assert.True (gun.HasAmmo ());
        }
Esempio n. 5
0
        public void ReloadAfterXShots(int shotsCount, bool shouldReload)
        {
            // Arrange
            var alien = new Alien();
            var gun   = new Raygun();

            // Act
            for (int i = 0; i < shotsCount; i++)
            {
                gun.Shoot(alien);
            }

            // Assert
            Assert.Equal(shouldReload, !gun.HasAmmo());
        }
Esempio n. 6
0
        public void TryShootDodgingBug()
        {
            bug.Dodge();
            gun.FireAt(bug);


            bug.Dodge();
            gun.FireAt(bug);

            bug.Dodge();
            gun.FireAt(bug);

            Assert.IsFalse(bug.IsDead());
            Assert.IsFalse(gun.HasAmmo());
        }