Beispiel #1
0
        public void CountChance_CheckNumberFirstHigh()
        {
            // arrange
            Battle battleClass = new Battle();

            // act
            // loop through the method 10000 times to get a good span
            int randomNumber;
            for (int i = 0; i < 10000; i++)
            {
                randomNumber = battleClass.CountChance(40,10);

                // assert
                if (randomNumber < 5 || randomNumber > 25)
                {
                    Assert.Fail("CountChance has a chance of giving the wrong number if the first value sent to it is at least 1.5 times higher than the second");
                    return;
                }
            }
            Assert.IsTrue(true);
        }
Beispiel #2
0
        public void CountChance_CheckNumberSecondSlightyHigh()
        {
            // arrange
            Battle battleClass = new Battle();

            // act
            // loop through the method 10000 times to get a good span
            int randomNumber;
            for (int i = 0; i < 10000; i++)
            {
                randomNumber = battleClass.CountChance(10, 12);

                // assert
                if (randomNumber < 5 || randomNumber > 22)
                {
                    Assert.Fail("CountChance has a chance of giving the wrong number if the second value sent to it is slightly higher than first");
                    return;
                }
            }
            Assert.IsTrue(true);
        }
Beispiel #3
0
        public void CountChance_CheckNumberSameValue()
        {
            // arrange
            Battle battleClass = new Battle();

            // act
            // loop through the method 10000 times to get a good span
            int randomNumber;
            for (int i = 0; i < 10000; i++)
            {
                randomNumber = battleClass.CountChance(10,10);

                // assert
                if (randomNumber < 5 || randomNumber > 20)
                {
                    Assert.Fail("CountChance has a chance of giving the wrong number if the values sent to it match");
                    return;
                }
            }
            Assert.IsTrue(true);
        }