Exemple #1
0
        public void publish_tournament_without_steps_should_throw()
        {
            var tournament = TournamentAggregate.Restore(_tournamentId, _tournamentName, _tournamentDescription, false,
                                                         DateTime.Now, DateTime.Now.AddDays(1), new List <StepEntity>());

            Assert.Throws <DomainException>(() => tournament.Publish());
        }
Exemple #2
0
        public void set_start_date_equals_to_end_date_should_throw()
        {
            var endDate    = DateTime.Now;
            var tournament = TournamentAggregate.Restore(
                _tournamentId, _tournamentName, _tournamentDescription,
                false, endDate.AddDays(-1), endDate, new List <StepEntity>());

            Assert.Throws <DomainException>(() => tournament.SetStartDate(endDate));
        }
Exemple #3
0
        public void publish_tournament_without_end_date_should_throw()
        {
            var steps = new List <StepEntity> {
                GetStep(0, false)
            };
            var tournament = TournamentAggregate.Restore(_tournamentId, _tournamentName, _tournamentDescription, false,
                                                         DateTime.Now, null, steps);

            Assert.Throws <DomainException>(() => tournament.Publish());
        }
Exemple #4
0
        public void publish_tournament_should_works()
        {
            var steps = new List <StepEntity> {
                GetStep(0, false)
            };
            var startDate  = DateTime.Now;
            var tournament = TournamentAggregate.Restore(_tournamentId, _tournamentName, _tournamentDescription, false,
                                                         startDate, startDate.AddDays(1), steps);

            tournament.Publish();
            Assert.AreEqual(true, tournament.IsPublished);
        }
Exemple #5
0
 private TournamentAggregate GetPublishedTournament(DateTime?startDate = null, DateTime?endDate = null)
 {
     return(TournamentAggregate.Restore(
                _tournamentId,
                _tournamentName,
                _tournamentDescription,
                true,
                startDate ?? DateTime.Now,
                endDate ?? DateTime.Now.AddDays(2),
                new List <StepEntity>
     {
         GetStep(0, false),
         GetStep(1, false)
     }));
 }
Exemple #6
0
 private TournamentAggregate GetNewTournamentWithSteps()
 {
     return(TournamentAggregate.Restore(
                _tournamentId,
                _tournamentName,
                _tournamentDescription,
                false,
                null,
                null,
                new List <StepEntity>
     {
         GetStep(0, false),
         GetStep(1, false)
     }));
 }
Exemple #7
0
 private TournamentAggregate ToAggregate(Tournament tournamentEntity)
 {
     return(TournamentAggregate.Restore(
                new TournamentId(tournamentEntity.Id),
                tournamentEntity.Name,
                tournamentEntity.Description,
                tournamentEntity.IsPublished,
                tournamentEntity.StartDate,
                tournamentEntity.EndDate,
                tournamentEntity.TournamentSteps
                .Where(tS => !tS.Step.IsDeleted)
                .Select(tS => new StepEntity(
                            new StepId(tS.StepId),
                            tS.Order,
                            tS.IsOptional
                            ))
                .ToList()
                ));
 }