コード例 #1
0
        public void Posion_Should_Check_Max()
        {
            //arrange
            int poisonedIndex = 999;
            int day           = 28;
            var mathLogic     = new MathLogic.MathLogic();

            var bottles = new List <Bottle>();

            for (int i = 0; i < 1000; i++)
            {
                bottles.Add(new Bottle(i, i == poisonedIndex));
            }
            var testStrips = new List <TestStrip>();

            for (int i = 0; i < 10; i++)
            {
                testStrips.Add(new TestStrip());
            }

            //act
            var result = mathLogic.Poison(bottles, testStrips);

            //assert
            result[0].ShouldBeEquivalentTo(poisonedIndex);
            result[1].ShouldBeEquivalentTo(day);
        }
コード例 #2
0
        public void Posion_Should_Throw_If_Null()
        {
            //arrange
            var mathLogic = new MathLogic.MathLogic();

            //act
            Action actFirst  = () => mathLogic.Poison(null, new List <TestStrip>());
            Action actSecond = () => mathLogic.Poison(new List <Bottle>(), null);

            //assert
            actFirst.ShouldThrow <ArgumentNullException>();
            actSecond.ShouldThrow <ArgumentNullException>();
        }
コード例 #3
0
        public void Posion_Should_Throw_If_No_Poisoned()
        {
            //arrange
            var mathLogic = new MathLogic.MathLogic();

            var bottles = new List <Bottle>();

            for (int i = 0; i < 1000; i++)
            {
                bottles.Add(new Bottle(i, false));
            }
            var testStrips = new List <TestStrip>();

            for (int i = 0; i < 10; i++)
            {
                testStrips.Add(new TestStrip());
            }

            //act
            Action act = () => mathLogic.Poison(bottles, testStrips);

            //assert
            act.ShouldThrow <ArgumentException>();
        }