示例#1
0
        public void TestCannonShootIncorrectAngle()
        {
            Cannon cannon = Cannon.GetInstance();
            var    shot   = cannon.Shoot(95, 100);

            Assert.IsFalse(shot.Item1);
        }
示例#2
0
        public void TestCannonShootVelocityGreaterThanSpeedOfLight()
        {
            Cannon cannon = Cannon.GetInstance();
            var    shot   = cannon.Shoot(45, 300000001);

            Assert.IsFalse(shot.Item1);
        }
示例#3
0
        public void TestCannonMultipleInstances()
        {
            Cannon cannon  = Cannon.GetInstance();
            Cannon cannon2 = Cannon.GetInstance();

            Assert.IsTrue(cannon == cannon2);
        }
示例#4
0
        public void TestCannonCountShots()
        {
            Cannon cannon = Cannon.GetInstance();

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

            Assert.IsTrue(shot.Item2 == "Hit - 1 Shot(s)", "Number of shots:" + cannon.Shots);
        }
示例#5
0
        public void TestCannonShootHit()
        {
            Cannon cannon = Cannon.GetInstance();

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

            Assert.IsTrue(shot.Item2 == "Hit -1 shots(s)");
        }
示例#6
0
        public void TestCannonShootMiss()
        {
            Cannon cannon = Cannon.GetInstance();

            cannon.SetTarget(4000);
            var shot = cannon.Shoot(45, 350);

            Assert.IsFalse(shot.Item2 == "Missed cannonball landed at 12621 meters");
        }
示例#7
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);
        }
示例#8
0
        public void TestCannonShootMiss()
        {
            Cannon cannon = Cannon.GetInstance();

            cannon.SetTarget(4000);
            var shot = cannon.Shoot(45, 350);

            Assert.IsTrue(shot.Item1 == false);
        }
示例#9
0
        public void TestCannonHitPerson()
        {
            Cannon cannon = Cannon.GetInstance();

            cannon.SetTarget(6900);
            cannon.SetPerson(12621);
            var shot = cannon.Shoot(45, 350);

            Assert.IsTrue(shot.Item2 == "You hit a person and killed them. You lose.");//Confirms you hit a person not a target.
        }
示例#10
0
        public void CannonIDVaild()
        {
            Cannon cannon = Cannon.GetInstance();

            Assert.IsNotNull(cannon.ID);
        }