コード例 #1
0
        public string CreateRace(string name, int laps)
        {
            var currentRace = RaceFactory.CreateRace(name, laps);

            this.raceRepository.Add(currentRace);

            return(string.Format(OutputMessages.RaceCreated, name));
        }
コード例 #2
0
        public string CreateRace(string name, int laps)
        {
            var race = raceFactory.CreateRace("Race", name, laps);

            var raceInRepo = raceRepo.GetByName(name);

            if (raceInRepo != null)
            {
                throw new InvalidOperationException(String
                                                    .Format(ExceptionMessages.RaceExists, name));
            }

            raceRepo.Add(race);

            return(string.Format(OutputMessages.RaceCreated, name));
        }