예제 #1
0
        public void TournamentCommandHandler_HandleCommand_RecordMemberTournamentScoreCommand_CommandHandled()
        {
            Mock <IAggregateRepository <GolfClubAggregate> > golfClubRepository = new Mock <IAggregateRepository <GolfClubAggregate> >();

            Mock <IAggregateRepository <TournamentAggregate> > tournamentRepository = new Mock <IAggregateRepository <TournamentAggregate> >();

            tournamentRepository.Setup(t => t.GetLatestVersion(It.IsAny <Guid>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(TournamentTestData.GetCreatedTournamentAggregateWithPlayerSignedUp);

            Mock <ITournamentApplicationService> tournamentApplicationService = new Mock <ITournamentApplicationService>();

            TournamentCommandHandler handler = new TournamentCommandHandler(golfClubRepository.Object,
                                                                            tournamentRepository.Object,
                                                                            tournamentApplicationService.Object);

            RecordPlayerTournamentScoreCommand command = TournamentTestData.GetRecordPlayerTournamentScoreCommand();

            Should.NotThrow(async() => { await handler.Handle(command, CancellationToken.None); });
        }