public void TournamentAggregate_RecordPlayerScore_TournamentNotCreated_ErrorThrown()
        {
            TournamentAggregate aggregate = TournamentTestData.GetEmptyTournamentAggregate();

            Should.Throw <InvalidOperationException>(() =>
            {
                aggregate.RecordPlayerScore(TournamentTestData.PlayerId,
                                            TournamentTestData.PlayingHandicap,
                                            TournamentTestData.HoleScores);
            });
        }
        public void TournamentAggregate_RecordPlayerScore_InvalidData_ErrorThrown(Boolean validPlayerId,
                                                                                  Int32 playingHandicap,
                                                                                  Boolean validHoleScores,
                                                                                  Type exceptionType)
        {
            TournamentAggregate aggregate = TournamentTestData.GetEmptyTournamentAggregate();

            Guid playerId = validPlayerId ? TournamentTestData.PlayerId : Guid.Empty;
            Dictionary <Int32, Int32> holeScores = validHoleScores ? TournamentTestData.HoleScores : null;

            Should.Throw(() => { aggregate.RecordPlayerScore(playerId, playingHandicap, holeScores); }, exceptionType);
        }
        public void TournamentAggregate_CreateTournament_InvalidData_ErrorThrown(Boolean validTournamentDate,
                                                                                 Boolean validGolfClubId,
                                                                                 Boolean validMeasuredCourseId,
                                                                                 Int32 measuredCourseSSS,
                                                                                 String name,
                                                                                 PlayerCategory memberCategory,
                                                                                 TournamentFormat tournamentFormat,
                                                                                 Type exceptionType)
        {
            TournamentAggregate aggregate = TournamentTestData.GetEmptyTournamentAggregate();

            DateTime tournamentDate   = validTournamentDate ? TournamentTestData.TournamentDate : DateTime.MinValue;
            Guid     golfClubId       = validGolfClubId ? TournamentTestData.GolfClubId : Guid.Empty;
            Guid     measuredCourseId = validMeasuredCourseId ? TournamentTestData.MeasuredCourseId : Guid.Empty;

            Should.Throw(() => { aggregate.CreateTournament(tournamentDate, golfClubId, measuredCourseId, measuredCourseSSS, name, memberCategory, tournamentFormat); },
                         exceptionType);
        }
        public void TournamentAggregate_CreateTournament_TournamentCreated()
        {
            TournamentAggregate aggregate = TournamentTestData.GetEmptyTournamentAggregate();

            aggregate.CreateTournament(TournamentTestData.TournamentDate,
                                       TournamentTestData.GolfClubId,
                                       TournamentTestData.MeasuredCourseId,
                                       TournamentTestData.MeasuredCourseSSS,
                                       TournamentTestData.Name,
                                       TournamentTestData.PlayerCategoryEnum,
                                       TournamentTestData.TournamentFormatEnum);

            aggregate.TournamentDate.ShouldBe(TournamentTestData.TournamentDate);
            aggregate.GolfClubId.ShouldBe(TournamentTestData.GolfClubId);
            aggregate.MeasuredCourseId.ShouldBe(TournamentTestData.MeasuredCourseId);
            aggregate.MeasuredCourseSSS.ShouldBe(TournamentTestData.MeasuredCourseSSS);
            aggregate.Name.ShouldBe(TournamentTestData.Name);
            aggregate.PlayerCategory.ShouldBe(TournamentTestData.PlayerCategoryEnum);
            aggregate.Format.ShouldBe(TournamentTestData.TournamentFormatEnum);
            aggregate.HasBeenCreated.ShouldBeTrue();
        }
        public void TournamentAggregate_CalculateCSS_TournamentNotCreated_ErrorThrown()
        {
            TournamentAggregate aggregate = TournamentTestData.GetEmptyTournamentAggregate();

            Should.Throw <InvalidOperationException>(() => { aggregate.CalculateCSS(); });
        }
        public void TournamentAggregate_SignUpForTournament_TournamentNotCreated_ErrorThrown()
        {
            TournamentAggregate tournament = TournamentTestData.GetEmptyTournamentAggregate();

            Should.Throw <InvalidOperationException>(() => { tournament.SignUpForTournament(TournamentTestData.PlayerId); });
        }
        public void TournamentAggregate_CompleteTournament_TournamentNotCreated_ErrorThrown()
        {
            TournamentAggregate aggregate = TournamentTestData.GetEmptyTournamentAggregate();

            Should.Throw <InvalidOperationException>(() => { aggregate.CompleteTournament(TournamentTestData.CompletedDateTime); });
        }