예제 #1
0
        public void TestHitter()
        {
            MockRangeRunGenManual runGen = new MockRangeRunGenManual(new List <int>()
            {
                0, 4, 6
            });
            Batsman hitter = new Batsman(runGen);

            runGen.ChooseRunIdx(0);
            Assert.AreEqual(hitter.HitRun(), 0);
            runGen.ChooseRunIdx(1);
            Assert.AreEqual(hitter.HitRun(), 4);
            runGen.ChooseRunIdx(2);
            Assert.AreEqual(hitter.HitRun(), 6);
        }
예제 #2
0
        public void TestDefensiveBatsmanBehavior()
        {
            MockRangeRunGenManual runGen = new MockRangeRunGenManual(new List <int>()
            {
                0, 1, 2, 3
            });
            Batsman defensiveBatsman = new Batsman(runGen);

            runGen.ChooseRunIdx(0);
            Assert.AreEqual(defensiveBatsman.HitRun(), 0);
            runGen.ChooseRunIdx(1);
            Assert.AreEqual(defensiveBatsman.HitRun(), 1);
            runGen.ChooseRunIdx(2);
            Assert.AreEqual(defensiveBatsman.HitRun(), 2);
            runGen.ChooseRunIdx(3);
            Assert.AreEqual(defensiveBatsman.HitRun(), 3);
        }