Beispiel #1
0
        public void isWinReturnsFalseWhenContestantLose()
        {
            Monty game = new Monty(2);

            game.PickDoor(Array.IndexOf(game.Doors, game.Doors.Single(d => d.ContainsPrize == false)));
            Assert.False(game.IsWin());
        }
Beispiel #2
0
        public void isWinReturnsTrueWhenContestantWins()
        {
            Monty game = new Monty(2);

            game.PickDoor(Array.IndexOf(game.Doors, game.Doors.Single(d => d.ContainsPrize == true)));
            Assert.True(game.IsWin());
        }
Beispiel #3
0
        public void ContestantCanPickDoor()
        {
            Monty game       = new Monty(3);
            int   doorToPick = 0;

            game.PickDoor(doorToPick);
            Assert.True(game.Doors[doorToPick].Picked == true);
        }
Beispiel #4
0
        public void HostRevealsDoorWhenMultipleToReveal()
        {
            Monty game       = new Monty(10, mockRandom);
            int   doorToPick = 0;

            game.PickDoor(doorToPick);

            game.RevealDoors();

            Assert.True(game.Doors.Where(d => d.Revealed).Count() == 8);
        }
Beispiel #5
0
        public void HostRevealsDoorWhenDudPicked()
        {
            Monty game       = new Monty(3, mockRandom);
            int   doorToPick = 1;

            game.PickDoor(doorToPick);

            game.RevealDoors();

            Assert.True(game.Doors.Where(d => d.Revealed == true).Count() == 1);
        }
Beispiel #6
0
        public void ContestantCanSwitchDoorWhenDudPicked()
        {
            Monty game            = new Monty(3, mockRandom);
            Door  firstDoorToPick = game.Doors[1];

            game.PickDoor(1);

            Assert.True(game.Doors[1].Picked == true);

            game.RevealDoors();

            Door secondDoorToPick = game.Doors.Single(d => d.Picked == false && d.Revealed == false);

            game.SwitchDoor();

            Assert.True(game.Doors.Where(d => d.Picked).Count() == 1);
            Assert.False(firstDoorToPick == secondDoorToPick);
        }