Esempio n. 1
0
        public Guid Create(string name, TimePeriod timePeriod)
        {
            var competition = CompetitionFactory.Create(Sport.Bowling, name, timePeriod);

            _competitions.Add(competition);
            return(competition.CompetitionId);
        }
        public Guid Create(string name, TimePeriod timePeriod)
        {
            var competition = CompetitionFactory.Create(Sport.Bowling, name, timePeriod);

            competition.CompetitionName = name;
            competition.TimePeriod      = timePeriod;
            competition.Players         = new List <Party>();
            competition.Matches         = new List <Match>();
            _context.Add(competition);
            _context.SaveChanges();
            return(competition.CompetitionId);
        }
        public void CanCreateCompetition()
        {
            //Arrange
            var compName = "Bowling All Stars";
            //Act
            var comp = CompetitionFactory.Create(Sport.Bowling, compName, new TimePeriod
            {
                StartDate = new DateTime(2017, 10, 23),
                EndDate   = new DateTime(2017, 11, 23)
            });

            //Assert
            Assert.Equal(compName, comp.CompetitionName);
        }