public void Should_Add_Both_Driver_To_First_StartGrid() { var startGrids = new Stack <Section>(); var track = _competition.Tracks.Dequeue(); var race = new Race(track, _competition.Participants); race.AddParticipantsToTrack(track, _competition.Participants, DateTime.Now); foreach (var section in track.Sections) { if (section.SectionType == SectionTypes.StartGrid) { startGrids.Push(section); } } var result = startGrids.Pop(); Assert.IsTrue(race.GetSectionData(result).Left != null && race.GetSectionData(result).Right != null); }
public void Should_Not_Add_Driver_To_First_StartGrid() { _competition.Participants.Add(new Driver("Ricciardo", 0, new Car(0, 0, 0, false), TeamColors.Yellow)); _competition.Participants.Add(new Driver("Vettel", 0, new Car(0, 0, 0, false), TeamColors.Yellow)); _competition.Participants.Add(new Driver("Sainz", 0, new Car(0, 0, 0, false), TeamColors.Yellow)); _competition.Participants.Add(new Driver("Norris", 0, new Car(0, 0, 0, false), TeamColors.Yellow)); var startGrids = new Stack <Section>(); var track = _competition.Tracks.Dequeue(); var remainingDrivers = _competition.Participants.Count; var race = new Race(track, _competition.Participants); race.AddParticipantsToTrack(track, _competition.Participants, DateTime.Now); foreach (var section in track.Sections) { if (section.SectionType == SectionTypes.StartGrid) { startGrids.Push(section); } } //loop through start grids if found drivers found ++; while (startGrids.Count > 0) { var section = startGrids.Pop(); if (race.GetSectionData(section).Left != null) { remainingDrivers--; } if (race.GetSectionData(section).Right != null) { remainingDrivers--; } } Assert.IsTrue(remainingDrivers > 0); }
public void Should_Not_Add_Drivers_If_Less_Than_Three() { _competition.Participants.RemoveAt(2); var startGrids = new Stack <Section>(); var track = _competition.Tracks.Dequeue(); var race = new Race(track, _competition.Participants); race.AddParticipantsToTrack(track, _competition.Participants, DateTime.Now); foreach (var section in track.Sections) { if (section.SectionType == SectionTypes.StartGrid) { startGrids.Push(section); } } var result = startGrids.Pop(); Assert.IsTrue(race.GetSectionData(result).Left == null); }
public void Should_Add_All_Drivers_To_StarGrid() { var startGrids = new Stack <Section>(); var track = _competition.Tracks.Dequeue(); var remainingDrivers = _competition.Participants.Count; var race = new Race(track, _competition.Participants); race.AddParticipantsToTrack(track, _competition.Participants, DateTime.Now); foreach (var section in track.Sections) { if (section.SectionType == SectionTypes.StartGrid) { startGrids.Push(section); } } //loop through start grids if found drivers found ++; while (startGrids.Count > 0) { var section = startGrids.Pop(); if (race.GetSectionData(section).Left != null) { remainingDrivers--; } if (race.GetSectionData(section).Right != null) { remainingDrivers--; } } Assert.IsTrue(remainingDrivers == 0); }