コード例 #1
0
        public void OneOfTheDoorsHoldsThePrize()
        {
            var doorNumberThatHoldsPrize = 1;
            var prizeSelector            = new PrizeSelectorFake(doorNumberThatHoldsPrize: doorNumberThatHoldsPrize);
            var montyHall = new MontyHall(prizeSelector);

            montyHall.DefineWinningDoor();

            Assert.That(montyHall.WinningDoor.ContainsPrize, Is.EqualTo(true));
            Assert.That(montyHall.WinningDoor.Number, Is.EqualTo(doorNumberThatHoldsPrize));
        }
コード例 #2
0
        public void RevealsDoorWithNoPrize()
        {
            var doorNumberThatHoldsPrize = 1;
            var prizeSelector            = new PrizeSelectorFake(doorNumberThatHoldsPrize: doorNumberThatHoldsPrize);
            var montyHall = new MontyHall(prizeSelector);

            montyHall.DefineWinningDoor();
            var door = montyHall.RevealDoorWithNoPrize();

            Assert.That(door.Number, Is.EqualTo(2));
            Assert.That(door.ContainsPrize, Is.EqualTo(false));
        }