Exemple #1
0
        public void HandleEvent(RaceFinished raceFinished)
        {
            var xxx  = Stopwatch.StartNew();
            var race = this._raceRepository.Get(raceFinished.RaceId);

            this.FireTeamRaceFinishedEvents(race, raceFinished.Date);
            StatsPrinter.Print("RaceFinished", xxx.ElapsedMilliseconds);
        }
Exemple #2
0
        public void HandleEvent(TeamCreated teamCreated)
        {
            var xxx  = Stopwatch.StartNew();
            var race = _raceRepository.Get(teamCreated.RaceId);

            race.RegisterTeam(teamCreated.TeamId);

            _raceRepository.Update(race);

            StatsPrinter.Print("TeamCreated", xxx.ElapsedMilliseconds);
        }
        public void HandleEvent(TeamRaceFinished teamRaceFinished)
        {
            var xxx  = Stopwatch.StartNew();
            var team = this._teamRepository.Get(teamRaceFinished.TeamId);

            team.FinishRace();

            var activeTeam = this._activeTeamRepository.Find(team.Id);

            this._activeTeamRepository.Remove(activeTeam);

            StatsPrinter.Print("TeamRaceFinished", xxx.ElapsedMilliseconds);
        }
        public void HandleEvent(LapCompleted lapCompleted)
        {
            var xxx  = Stopwatch.StartNew();
            var race = this._raceRepository.Get(lapCompleted.RaceId);

            var lapStatistic = new LapStatistic(
                lapCompleted.RaceId,
                lapCompleted.TeamId,
                lapCompleted.TeamName,
                race.LapDistanceInMeters,
                lapCompleted.LapLength,
                lapCompleted.CompletedOn);

            this._lapStatisticRepository.AddLapStatistic(lapStatistic);

            StatsPrinter.Print("LapCompleted", xxx.ElapsedMilliseconds);
        }
        public void HandleEvent(TeamRaceStarted teamRaceStarted)
        {
            var xxx  = Stopwatch.StartNew();
            var team = this._teamRepository.Get(teamRaceStarted.TeamId);

            team.StartRace(teamRaceStarted.StartDate);

            this._teamRepository.Update(team);

            var activeTeam = new ActiveTeam
            {
                ChipId = team.ChipId,
                TeamId = team.Id
            };

            this._activeTeamRepository.Add(activeTeam);

            StatsPrinter.Print("TeamRaceStarted", xxx.ElapsedMilliseconds);
        }