示例#1
0
        private void btnStartTimer_Click(object sender, RoutedEventArgs e)
        {
            _startTime = DateTime.Now;
            SetTimer();

            _race.StartDateTime = _startTime;
            _race.StartTime     = _startTime.ToString("hh.mm.ss.ff");

            _raceRepository.Add(_race);
            _raceRepository.Save();
            _rfidManager.Start(_race);
            _timer.Start();

            btnStartTimer.IsEnabled = false;
            btnStopTimer.IsEnabled  = true;
        }
        public void Simple_Status_Race()
        {
            IElectionRepository electionRepository = Substitute.For <IElectionRepository>();
            var f        = new Fixture();
            var election = f.Create <Election>();
            var race     = Create(election.GetMasterDataRef());

            electionRepository.GetById(Arg.Any <Guid>()).Returns(election);
            var raceRepository = new RaceRepository(ContextConnection(), electionRepository);

            raceRepository.Save(race);
            raceRepository.SetInactive(race);
            var inactive = raceRepository.GetById(race.Id);

            Assert.That(inactive.Status == EntityStatus.Inactive);

            raceRepository.SetActive(race);
            var active = raceRepository.GetById(race.Id);

            Assert.That(active.Status == EntityStatus.Active);

            raceRepository.SetAsDeleted(race);
            var deleted = raceRepository.GetById(race.Id);

            Assert.That(deleted.Status == EntityStatus.Deleted);
        }
        public void SimpeHydrate_Race()
        {
            IElectionRepository electionRepository = Substitute.For <IElectionRepository>();
            var f        = new Fixture();
            var election = f.Create <Election>();
            var race     = Create(election.GetMasterDataRef());

            electionRepository.GetById(Arg.Any <Guid>()).Returns(election);
            var raceRepository = new RaceRepository(ContextConnection(), electionRepository);
            var id             = raceRepository.Save(race);

            Assert.IsNotNull(id);
            Assert.AreEqual(id, race.Id);
        }
        public void SimpeDeHydrateAll_Race()
        {
            IElectionRepository electionRepository = Substitute.For <IElectionRepository>();
            var f        = new Fixture();
            var election = f.Create <Election>();
            var race     = Create(election.GetMasterDataRef());

            electionRepository.GetById(Arg.Any <Guid>()).Returns(election);
            var raceRepository = new RaceRepository(ContextConnection(), electionRepository);

            raceRepository.Save(race);
            var owner = raceRepository.GetAll();

            Assert.That(owner.Any());
        }
 public ActionResult <Race> PostRace(Race race)
 {
     _raceRepository.Save(race);
     return(CreatedAtAction("GetRace", new { id = race.Id }, race));
 }