Exemplo n.º 1
0
        public void GetLapTimes_WithoutArgument_ShouldReturnAllLaps()
        {
            List <Lap> laps = subject.GetLapTimes();

            //first set of laps
            //DNFs ar also counted as a kind of lap
            Assert.AreEqual(8, laps.Count);

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

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

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

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

            //second set of laps
            Assert.AreEqual("Rider-0", laps[4].Rider.Name);
            Assert.AreEqual(50000000, laps[4].GetLapTime());

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

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

            Assert.AreEqual("Rider-3", laps[7].Rider.Name);
            Assert.AreEqual(15000000, laps[7].GetLapTime());
        }
Exemplo n.º 2
0
        public void GetLapTimes_WithoutLaps_ShouldReturnEmptyList()
        {
            MockRaceTracker tracker = new MockRaceTracker();
            RaceManager     manager = new RaceManager();

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

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

            Assert.AreEqual(0, laps.Count);
        }
Exemplo n.º 3
0
 public JsonResult GetLaps(int start = 0)
 {
     return(new JsonResult(manager.GetLapTimes(start), new JsonSerializerSettings {
         TypeNameHandling = TypeNameHandling.All
     }));
 }