Ejemplo n.º 1
0
        public void OnStartId_ShouldSaveEvent()
        {
            Beacon beacon  = new Beacon(new byte[] { 0, 0, 0, 0, 0, 1 }, 0);
            Rider  martijn = new Rider("Martijn", beacon);

            startId.EmitIdEvent(martijn, new DateTime(2000, 1, 1, 1, 1, 1));

            source.Cancel();

            RaceSummary summary = race.Result;
            var         state   = subject.GetState;

            Assert.AreEqual(1, summary.Events.Count);

            IdEvent entered = summary.Events[0] as IdEvent;

            Assert.AreEqual(entered, state.waiting[0]);

            Assert.AreEqual("Martijn", entered.Rider.Name);
            CollectionAssert.AreEqual(new byte[] { 0, 0, 0, 0, 0, 1 }, entered.Rider.Beacon.Identifier);
            Assert.AreEqual(new DateTime(2000, 1, 1, 1, 1, 1), entered.Time);
        }
Ejemplo n.º 2
0
        public void OnEndId_WithoutRiderOnTrack_ShouldIgnoreEvent()
        {
            Beacon beacon  = new Beacon(new byte[] { 0, 0, 0, 0, 0, 1 }, 0);
            Rider  martijn = new Rider("Martijn", beacon);

            endId.EmitIdEvent(martijn, new DateTime(2000, 1, 1, 1, 1, 1));

            source.Cancel();

            RaceSummary summary = race.Result;
            var         state   = subject.GetState;

            Assert.AreEqual(0, summary.Events.Count);
            Assert.AreEqual(0, state.onTrack.Count);
            Assert.AreEqual(0, state.waiting.Count);
            Assert.AreEqual(0, state.unmatchedIds.Count);
            Assert.AreEqual(0, state.unmatchedTimes.Count);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Makes events for a lap finish at start + 1 minute
 /// </summary>
 /// <param name="riderName"></param>
 /// <param name="sensorId"></param>
 /// <param name="end"></param>
 /// <param name="id"></param>
 /// <param name="time"></param>
 private void MakeEndEvents(Rider rider, DateTime end, MockRiderIdUnit id, MockTimingUnit time)
 {
     id.EmitIdEvent(rider, end);
     time.EmitTriggerEvent(100, "Timer", 1, end);
     id.EmitExitEvent(rider, end);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Makes events for a lap begin at start
 /// </summary>
 /// <param name="riderName"></param>
 /// <param name="sensorId"></param>
 /// <param name="start"></param>
 /// <param name="id"></param>
 /// <param name="time"></param>
 private void MakeStartEvents(Rider rider, DateTime start, MockRiderIdUnit id, MockTimingUnit time)
 {
     id.EmitIdEvent(rider, start);
     time.EmitTriggerEvent(100, "Timer", 0, start);
     id.EmitExitEvent(rider, start);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Makes events for a lap finish at start + 1 minute
 /// </summary>
 /// <param name="riderName"></param>
 /// <param name="sensorId"></param>
 /// <param name="end"></param>
 /// <param name="id"></param>
 /// <param name="time"></param>
 private void MakeEndEvents(Rider rider, DateTime end, long microseconds, MockRiderIdUnit id, MockTimingUnit time)
 {
     id.EmitIdEvent(rider, end);
     time.EmitTriggerEvent(microseconds, "Timer", 1, end);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Makes events for a lap begin at start
 /// </summary>
 /// <param name="riderName"></param>
 /// <param name="sensorId"></param>
 /// <param name="start"></param>
 /// <param name="id"></param>
 /// <param name="time"></param>
 private void MakeStartEvents(Rider rider, DateTime start, long microseconds, MockRiderIdUnit id, MockTimingUnit time)
 {
     id.EmitIdEvent(rider, start);
     time.EmitTriggerEvent(microseconds, "Timer", 0, start);
 }