Example #1
0
        public void GetBestLaps_WithoutLaps_ShouldReturnEmptyList()
        {
            MockRaceTracker tracker = new MockRaceTracker();
            RaceManager     manager = new RaceManager();

            manager.Start(tracker, new List <IDisplayUnit> {
            });

            List <Lap> laps = manager.GetBestLaps();

            Assert.AreEqual(0, laps.Count);
        }
Example #2
0
        public void GetBestLaps_ShouldReturn_SortedShortestTimes()
        {
            List <Lap> laps = subject.GetBestLaps();

            //4 riders means 4 best laps
            Assert.AreEqual(4, laps.Count);

            Assert.AreEqual("Rider-1", laps[0].Rider.Name);
            Assert.AreEqual(10000000, laps[0].GetLapTime());

            Assert.AreEqual("Rider-3", laps[1].Rider.Name);
            Assert.AreEqual(15000000, laps[1].GetLapTime());

            Assert.AreEqual("Rider-2", laps[2].Rider.Name);
            Assert.AreEqual(20000000, laps[2].GetLapTime());

            Assert.AreEqual("Rider-0", laps[3].Rider.Name);
            Assert.AreEqual(50000000, laps[3].GetLapTime());
        }
Example #3
0
 public JsonResult GetLapsByRider()
 {
     return(new JsonResult(JArray.FromObject(manager.GetBestLaps())));
 }