public void Given_6_closed_doors_when_third_monkey_runs_through_floor_then_monkey_opens_only_every_third_door() { Floor floor = new Floor(6); Monkey monkey = new Monkey(3); monkey.RunThrough(floor); Assert.That(floor.GetDoor(3).IsOpen); Assert.That(floor.GetDoor(6).IsOpen); Assert.That(floor.GetDoors().Where((door, index) => (index + 1) % 3 != 0).All(door => door.IsClosed)); }
public void Given_an_open_and_a_closed_door_when_a_monkey_runs_through_floor_then_monkey_opens_closed_and_closes_opened_door() { Floor floor = new Floor(2); floor.GetDoor(2).IsOpen = true; Monkey monkey = new Monkey(1); monkey.RunThrough(floor); Assert.That(floor.GetDoor(1).IsOpen); Assert.That(floor.GetDoor(2).IsClosed); }
public void When_Floor_Has_1_Door_Then_Returns_Door_For_Number_1() { var floor = new Floor(1); Assert.That(floor.GetDoor(1) != null); }