GetFirstCheckpointId() public method

Gets the first checkpoint.
public GetFirstCheckpointId ( ) : int
return int
Esempio n. 1
0
        public void It_Should_Be_Possible_To_Connect_An_Athlete_To_A_Startnumber()
        {
            Given("we have an athlete and a startnumber registrert", () =>
            {
                athlete.ConnectToRace(race.RaceId);
                timer = CreateNewTimerModelWithCheckpoints(race);
                checkpointOrder = new CheckpointOrderModel();
                checkpointOrder.AddCheckpointOrderDB(timer.CurrentCheckpointId, 1);
                timer.Start();
                timer.AddRuntime(400, timer.GetFirstCheckpointId());
                intermediate = new RaceIntermediateModel(timer.CurrentCheckpointId, checkpointOrder.ID, timer.CheckpointRuntimes[timer.CurrentCheckpointId].First().Key);
                intermediate.Save();
            });

            When("we want to connect athletes to startnumbers", () =>
            {
                RaceIntermediateModel.MergeAthletes(race.RaceId);
            });

            Then("athletes should be connected to raceintermediate", () =>
            {
                RaceIntermediateModel.GetRaceintermediatesForRace(race.RaceId).First().AthleteId.ShouldNotBeNull();

            });
        }
Esempio n. 2
0
 public TimeStartnumberModel(TimerModel timer)
 {
     this.Timer = timer;
     var intermediates = new List<RaceIntermediateModel>();
     CheckpointIntermediates = new Dictionary<int, List<RaceIntermediateModel>>();
     CheckpointIntermediates.Add(timer.GetFirstCheckpointId(), intermediates);
     using (var context = new Entities())
     {
         foreach (var checkpoint in CheckpointModel.GetCheckpoints(timer.RaceID.Value))
         {
             var raceintermediates = context.RaceIntermediates.Where(interm => interm.CheckpointID == checkpoint.Id).Select(interm => new RaceIntermediateModel()
             {
                 AthleteId = interm.AthleteId.HasValue ? interm.AthleteId.Value : 0,
                 CheckpointID = interm.CheckpointID,
                 CheckpointOrderID = interm.CheckpointOrderID,
                 RuntimeId = interm.RuntimeId
             }).ToList();
             if (!CheckpointIntermediates.ContainsKey(checkpoint.Id))
                 CheckpointIntermediates.Add(checkpoint.Id, raceintermediates);
             else
                 CheckpointIntermediates[checkpoint.Id] = raceintermediates;
         }
     }
     this.Intermediates = intermediates;
 }
 public void TestSetup()
 {
     timeMerger = new TimeMergerModel();
     timer = new TimerModel();
     checkpoint1 = new CheckpointModel("Checkpoint1", timer, 1);
     checkpoint2 = new CheckpointModel("Checkpoint2", timer, 2);
     timer.CurrentCheckpointId = timer.GetFirstCheckpointId();
     timer.CheckpointRuntimes.Add(timer.CurrentCheckpointId, new Dictionary<int, int>());
     checkpointOrderModel = new CheckpointOrderModel();
 }
Esempio n. 4
0
 public void TestSetup()
 {
     timer = new TimerModel();
     eventModel = new EventModel("TestEvent", DateTime.Today);
     eventModel.Save();
     race = new RaceModel("SomeRace", new DateTime(2007, 10, 3));
     race.EventId = eventModel.EventId;
     race.Save();
     checkpoint = new CheckpointModel("Checkpoint1", timer, race, 1);
     checkpoint2 = new CheckpointModel("Checkpoint2", timer, race, 2);
     timer.CurrentCheckpointId = timer.GetFirstCheckpointId();
     timer.CheckpointRuntimes.Add(timer.CurrentCheckpointId, new Dictionary<int, int>());
 }
Esempio n. 5
0
 /// <summary>
 /// Creates the new timer model with checkpoints.
 /// </summary>
 /// <returns></returns>
 private void Setup()
 {
     eventModel = new EventModel("Testevent", DateTime.Today);
     eventModel.Save();
     race = new RaceModel("Testrace", DateTime.Today);
     race.EventId = eventModel.EventId;
     race.Save();
     timer = new TimerModel();
     timer.RaceID = race.RaceId;
     checkpoint = new CheckpointModel("Checkpoint1", timer, race, 1);
     checkpoint.SaveToDb();
     checkpointorder = new CheckpointOrderModel();
     checkpointorder.AddCheckpointOrderDB(checkpoint.Id, 12);
     checkpointorder.StartingNumber = 12;
     timer.CurrentCheckpointId = timer.GetFirstCheckpointId();
     timer.CheckpointRuntimes.Add(timer.CurrentCheckpointId, new Dictionary<int, int>());
     timer.SaveToDb();
     timestart = new TimeStartnumberModel(timer);
     timestart.CheckpointOrder = checkpointorder;
     //timestart.AddStartnumber(checkpoint.Id, checkpointorder.StartingNumber, 500);
 }
Esempio n. 6
0
 /// <summary>
 /// Creates the new timer model with checkpoints.
 /// </summary>
 /// <returns></returns>
 private TimerModel CreateNewTimerModelWithCheckpoints(RaceModel race)
 {
     timer = new TimerModel();
     timer.RaceID = race.RaceId;
     checkpoint = new CheckpointModel("Checkpoint1", timer, race, 1);
     timer.CurrentCheckpointId = timer.GetFirstCheckpointId();
     timer.CheckpointRuntimes.Add(timer.CurrentCheckpointId, new Dictionary<int, int>());
     return timer;
 }
Esempio n. 7
0
 public void TestSetup()
 {
     timeMerger = new TimeMergerModel();
     timer = new TimerModel();
     eventModel = new EventModel("Testevent", DateTime.Today);
     eventModel.Save();
     race = new RaceModel("SomeRace", new DateTime(2007, 10, 3));
     race.EventId = eventModel.EventId;
     race.Save();
     checkpoint1 = new CheckpointModel("Checkpoint1", timer, race, 1);
     checkpoint2 = new CheckpointModel("Checkpoint2", timer, race, 2);
     timer.RaceID = race.RaceId;
     timer.CurrentCheckpointId = timer.GetFirstCheckpointId();
     timer.CheckpointRuntimes.Add(timer.CurrentCheckpointId, new Dictionary<int, int>());
     checkpointOrderModel = new CheckpointOrderModel();
     timestartnumberModel = new TimeStartnumberModel(timer);
     timestartnumberModel.ChangeCheckpoint(timer.GetFirstCheckpointId());
     timestartnumberModel.CheckpointOrder = checkpointOrderModel;
 }