Example #1
0
 public void TestStartup()
 {
     eventModel = new EventModel("Test", DateTime.Today);
     eventModel.Save();
     race = new RaceModel("testrace", DateTime.Today);
     race.EventId = eventModel.EventId;
     race.Save();
     athlete = new AthleteModel("Test", "Testesen");
 }
Example #2
0
 public void TestSetup()
 {
     eventModel = new EventModel("TestEvent", DateTime.Today);
     eventModel.Save();
     race = new RaceModel("TestRace", DateTime.Today);
     race.EventId = eventModel.EventId;
     race.Save();
     timer = new TimerModel();
     timer.SaveToDb();
 }
Example #3
0
 public void TestSetup()
 {
     ctxDBTest = new Entities();
     newEvent = new EventModel("TestEvent", DateTime.Today);
     newEvent.Save();
     newRace = new RaceModel("RaceModelTestRace", new DateTime(2009, 2, 3));
     newRace.EventId = newEvent.EventId;
     newRace.Save();
     raceDB = new Race();
     raceDB.EventId = newEvent.EventId;
     raceDB.Name = "TestingRaceModel";
     raceDB.Distance = 200;
     raceDB.StartDate = DateTime.Parse("10/03/2020");
     ctxDBTest.Races.AddObject(raceDB);
     ctxDBTest.SaveChanges();
 }
Example #4
0
 public void TestSetup()
 {
     club = new ClubModel("Test IK");
     eventModel = new EventModel("TestEvent", DateTime.Today);
     eventModel.Save();
     athlete = new AthleteModel("Tester", "Test");
     athlete.StartNumber = 1;
     athlete.Club = club;
     athlete.SaveToDb();
     race = new RaceModel("TestRace", DateTime.Today);
     race.EventId = eventModel.EventId;
     race.Save();
     checkpointOrder = null;
     intermediate = null;
     checkpoint = null;
 }
Example #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);
 }
Example #6
0
        public void We_Should_Be_Able_A_Race_With_Same_Name_In_The_Same_Event()
        {
            string exp = "";
            var raceDup = new RaceModel();
            string raceName = newRace.Name;
            Given("We want to create a race with the same name as a previous race in the same race", () =>
            {
                raceDup.Name = raceName;
                raceDup.EventId = newEvent.EventId;
            });

            When("we save the race", () =>
            {
                try
                {
                    raceDup.Save();
                }
                catch (Exception ex)
                {
                    exp = ex.Message;
                }
            });
            Then("we should get an exception", () =>
            {
                exp.ShouldBe("Det eksisterer allerede et løp med samme navn for dette stevnet");
            });
        }
Example #7
0
        public void We_Should_Be_Able_To_Add_New_Race_In_Database()
        {
            int racesBefore = 0;
            int racesAfter = 0;
            RaceModel newTestRace = null;

            Given("We want to insert new Race in the database", () =>
                {
                    newTestRace = new RaceModel("test" + DateTime.Now.Ticks.ToString(), DateTime.Today);
                });

            When("We insert a new Race in database", () =>
                {
                    racesBefore = ctxDBTest.Races.Count();
                    newTestRace.EventId = newEvent.EventId;
                    newTestRace.Save();
                });

            Then("The new Race should exist in database", () =>
                {
                    racesAfter = ctxDBTest.Races.Count();
                    racesAfter.ShouldBe(racesBefore + 1);
                });
        }
Example #8
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>());
 }
Example #9
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;
 }
Example #10
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;
 }