Пример #1
0
        public void TestCannonShootVelocityGreaterThanSpeedOfLight()
        {
            Cannon cannon = Cannon.GetInstance();
            var    shot   = cannon.shoot(45, 300000001);

            Assert.IsFalse(shot.Item1);
        }
Пример #2
0
        public void TestCannonShootIncorrectAngle()
        {
            Cannon cannon = Cannon.GetInstance();
            var    shot   = cannon.shoot(95, 100);

            Assert.IsFalse(shot.Item1);
        }
Пример #3
0
        public void TestCannonMissDistance()
        {
            Cannon cannon = Cannon.GetInstance();

            cannon.SetTarget(12621);
            var shot = cannon.shoot(45, 300);

            Assert.IsTrue(cannon.DistanceFromTarget(cannon.DistanceOfTarget, cannon.CalculateDistanceOfCannonShot(45, 300)) == -3288);
        }
Пример #4
0
        public void TestCannonShootMiss()
        {
            Cannon cannon = Cannon.GetInstance();

            cannon.SetTarget(2000);
            var shot = cannon.shoot(45, 350);

            Assert.IsTrue(shot.Item2 == "Missed Cannonball landed at 12621 Meters");
        }
Пример #5
0
        public void TestCannonCountShots()
        {
            Cannon cannon = Cannon.GetInstance();

            cannon.Reset();
            cannon.SetTarget(12621);
            var shot = cannon.shoot(45, 350);

            Assert.IsTrue(shot.Item2 == "Hit - 1 Shot(s)", "Number of shots :" + cannon.Shots);
        }
Пример #6
0
        public void TestCannonShootHit()
        {
            Cannon cannon = Cannon.GetInstance();

            cannon.Reset();
            cannon.SetTarget(12621);
            var shot = cannon.shoot(45, 350);

            Assert.IsTrue(shot.Item2 == "Hit - 1 Shot(s)");
        }