Пример #1
0
        public void TournamentCommandHandler_HandleCommand_ProduceTournamentResultCommand_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.GetCompletedTournamentAggregateWithCSSCalculatedAggregate(1, 2, 2, 2, 5, 3));

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

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

            ProduceTournamentResultCommand command = TournamentTestData.GetProduceTournamentResultCommand();

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