static void Main(string[] args) { var doors = new DoorsCollection(); doors.PassByDoors(times: 100); var firstLetterDoorStatues = doors.Select(d => d.Status.ToString().First()).ToList(); firstLetterDoorStatues.ForEach(s => Console.Write(s)); Console.ReadKey(); }
public void PassByDoors_ThreeTimes_DoorNumber3WithClosedStatus() { // Arrange var doors = new DoorsCollection(); // Act doors.PassByDoors(times: 3); // Assert Assert.That(doors.ElementAt(2).Status, Is.EqualTo(DoorStatus.Closed)); }
public void PassByDoors_OneTime_AllDoorsBecomeWithOpenedStatus() { // Arrange var doors = new DoorsCollection(); // Act doors.PassByDoors(times: 1); // Assert Assert.IsTrue(doors.All(d => d.Status == DoorStatus.Opened)); }
public void _InitialState_EachDoorHasASequencialNumberFrom1To100() { var doors = new DoorsCollection(); for (int i = 0; i < 100; i++) { var expectedDoorNumber = i + 1; Assert.That(doors.ElementAt(i).Number, Is.EqualTo(expectedDoorNumber)); } }
public string PassByDoors_XTimes_DoorsStatusWillBe(int times) { // Arrange var doors = new DoorsCollection(); // Act doors.PassByDoors(times: times); // Assert return DoorsCollectionTestHelper.CreateAStringRepresentingTheFirstLetterOfTheStatusOfEachDoor(doors); }
public string PassByDoors_XTimes_DoorsStatusWillBe(int times) { // Arrange var doors = new DoorsCollection(); // Act doors.PassByDoors(times: times); // Assert return(DoorsCollectionTestHelper.CreateAStringRepresentingTheFirstLetterOfTheStatusOfEachDoor(doors)); }
public void PassByDoors_TwoTimes_2ndDoorsBemoceWithClosedStatus() { // Arrange var doors = new DoorsCollection(); // Act doors.PassByDoors(times: 2); var secondDoors = doors.Where(d => d.Number % 2 == 0); // Assert Assert.IsTrue(secondDoors.All(d => d.Status == DoorStatus.Closed)); }
public void PassByDoors_TwoTimes_1stDoorsBecomeWithOpenedStatus() { // Arrange var doors = new DoorsCollection(); // Act doors.PassByDoors(times: 2); var firstsDoors = doors.Where(d => d.Number % 2 != 0); // Assert Assert.IsTrue(firstsDoors.All(d => d.Status == DoorStatus.Opened)); }
public static string CreateAStringRepresentingTheFirstLetterOfTheStatusOfEachDoor(DoorsCollection doors) { var stringBuilder = new StringBuilder(); doors.ToList().ForEach(d => { var statusFirstLetter = d.Status == DoorStatus.Opened ? "O" : "C"; stringBuilder.Append(statusFirstLetter); }); return stringBuilder.ToString(); }
public void ShouldSetPrizeForOneDoor() { var mockRandomiser = new Mock <IRandom>(); mockRandomiser.Setup(x => x.GenerateRandomNumber(3)).Returns(2); var doors = new DoorsCollection(numberOfDoors); doors.AssignDoorAPrize(mockRandomiser.Object); Assert.True(doors.GetListOfDoors()[2].HasPrize); Assert.False(doors.GetListOfDoors()[1].HasPrize); // TODO: Go through the GitHub questions. }
public void _InitialState_Has100Doors() { var doors = new DoorsCollection(); Assert.That(doors.Count, Is.EqualTo(100)); }
public void _InitialState_AllDoorsWithStatusClosed() { var doors = new DoorsCollection(); Assert.IsTrue(doors.All(d => d.Status == DoorStatus.Closed)); }
public static string CreateAStringRepresentingTheFirstLetterOfTheStatusOfEachDoor(DoorsCollection doors) { var stringBuilder = new StringBuilder(); doors.ToList().ForEach(d => { var statusFirstLetter = d.Status == DoorStatus.Opened ? "O" : "C"; stringBuilder.Append(statusFirstLetter); }); return(stringBuilder.ToString()); }