public void HandicapCalculationProcessAggregate_UpdateProcessToErrored_AlreadyCompleted_ErrorThrown() { HandicapCalculationProcessAggregate handicapCalculationProcessAggregate = HandicapCalculationProcessTestData.GetCompletedHandicapCalculationProcessAggregate(); Should.Throw <InvalidOperationException>(() => { handicapCalculationProcessAggregate.UpdateProcessToErrored(HandicapCalculationProcessTestData.ErroredDateTime, HandicapCalculationProcessTestData.ErrorMessage); }); }
public void HandicapCalculationCommandHandler_HandleCommand_StartHandicapCalculationProcessForTournamentCommand_CommandHandled() { Mock <IAggregateRepository <HandicapCalculationProcessAggregate> > handicapCalculationProcessRepository = new Mock <IAggregateRepository <HandicapCalculationProcessAggregate> >(); handicapCalculationProcessRepository.Setup(h => h.GetLatestVersion(It.IsAny <Guid>(), CancellationToken.None)) .ReturnsAsync(HandicapCalculationProcessTestData.GetEmptyHandicapCalculationProcessAggregate()); Mock <IAggregateRepository <TournamentAggregate> > tournamentRepository = new Mock <IAggregateRepository <TournamentAggregate> >(); tournamentRepository.Setup(t => t.GetLatestVersion(It.IsAny <Guid>(), CancellationToken.None)) .ReturnsAsync(TournamentTestData.GetCompletedTournamentAggregateWithCSSCalculatedAggregate()); HandicapCalculationCommandHandler handler = new HandicapCalculationCommandHandler(handicapCalculationProcessRepository.Object, tournamentRepository.Object); StartHandicapCalculationProcessForTournamentCommand command = HandicapCalculationProcessTestData.GetStartHandicapCalculationProcessForTournamentCommand(); Should.NotThrow(async() => { await handler.Handle(command, CancellationToken.None); }); }
public void HandicapCalculationProcessAggregate_StartHandicapCalculationProcess_TournamentScoresNotPublished() { HandicapCalculationProcessAggregate handicapCalculationProcessAggregate = HandicapCalculationProcessTestData.GetEmptyHandicapCalculationProcessAggregate(); Should.Throw <InvalidOperationException>(() => { handicapCalculationProcessAggregate.StartHandicapCalculationProcess(TournamentTestData .GetCompletedTournamentAggregate(), HandicapCalculationProcessTestData .StartedDateTime); }); }
public void HandicapCalculationProcessAggregate_StartHandicapCalculationProcess_AlreadyErrored_ErrorThrown() { HandicapCalculationProcessAggregate handicapCalculationProcessAggregate = HandicapCalculationProcessTestData.GetErroredHandicapCalculationProcessAggregate(); Should.Throw <InvalidOperationException>(() => { handicapCalculationProcessAggregate.StartHandicapCalculationProcess(TournamentTestData .GetCompletedTournamentAggregateWithCSSCalculatedAggregate(), HandicapCalculationProcessTestData .StartedDateTime); }); }
public void HandicapCalculationProcessAggregate_UpdateProcessToErrored_ProcessSetToErrored() { HandicapCalculationProcessAggregate handicapCalculationProcessAggregate = HandicapCalculationProcessTestData.GetRunningHandicapCalculationProcessAggregate(); handicapCalculationProcessAggregate.UpdateProcessToErrored(HandicapCalculationProcessTestData.ErroredDateTime, HandicapCalculationProcessTestData.ErrorMessage); handicapCalculationProcessAggregate.AggregateId.ShouldBe(handicapCalculationProcessAggregate.AggregateId); handicapCalculationProcessAggregate.StartedDateTime.ShouldBe(handicapCalculationProcessAggregate.StartedDateTime); handicapCalculationProcessAggregate.RunningDateTime.ShouldBe(handicapCalculationProcessAggregate.RunningDateTime); handicapCalculationProcessAggregate.ErroredDateTime.ShouldBe(handicapCalculationProcessAggregate.ErroredDateTime); handicapCalculationProcessAggregate.ErrorMessage.ShouldBe(handicapCalculationProcessAggregate.ErrorMessage); handicapCalculationProcessAggregate.Status.ShouldBe(HandicapProcessStatus.Errored); }
public void HandicapCalculationProcessAggregate_UpdateProcessToComplete_NotRunning_ErrorThrown() { HandicapCalculationProcessAggregate handicapCalculationProcessAggregate = HandicapCalculationProcessTestData.GetStartedHandicapCalculationProcessAggregate(); Should.Throw <InvalidOperationException>(() => { handicapCalculationProcessAggregate.UpdateProcessToComplete(HandicapCalculationProcessTestData .CompletedDateTime); }); }
public void HandicapCalculationProcessAggregate_UpdateProcessToComplete_ProcessSetToCompleted() { HandicapCalculationProcessAggregate handicapCalculationProcessAggregate = HandicapCalculationProcessTestData.GetRunningHandicapCalculationProcessAggregate(); handicapCalculationProcessAggregate.UpdateProcessToComplete(HandicapCalculationProcessTestData.CompletedDateTime); handicapCalculationProcessAggregate.AggregateId.ShouldBe(handicapCalculationProcessAggregate.AggregateId); handicapCalculationProcessAggregate.StartedDateTime.ShouldBe(handicapCalculationProcessAggregate.StartedDateTime); handicapCalculationProcessAggregate.RunningDateTime.ShouldBe(handicapCalculationProcessAggregate.RunningDateTime); handicapCalculationProcessAggregate.CompletedDateTime.ShouldBe(handicapCalculationProcessAggregate.CompletedDateTime); handicapCalculationProcessAggregate.Status.ShouldBe(HandicapProcessStatus.Completed); }
public void HandicapCalculationProcessAggregate_UpdateProcessToRunning_AlreadyErrored_ErrorThrown() { HandicapCalculationProcessAggregate handicapCalculationProcessAggregate = HandicapCalculationProcessTestData.GetErroredHandicapCalculationProcessAggregate(); Should.Throw <InvalidOperationException>(() => { handicapCalculationProcessAggregate.UpdateProcessToRunning(HandicapCalculationProcessTestData .RunningDateTime); }); }
public void HandicapCalculationProcessAggregate_StartHandicapCalculationProcess_ProcessRecordedAsStarted() { HandicapCalculationProcessAggregate handicapCalculationProcessAggregate = HandicapCalculationProcessTestData.GetEmptyHandicapCalculationProcessAggregate(); handicapCalculationProcessAggregate.StartHandicapCalculationProcess(TournamentTestData.GetCompletedTournamentAggregateWithCSSCalculatedAggregate(), HandicapCalculationProcessTestData.StartedDateTime); handicapCalculationProcessAggregate.AggregateId.ShouldBe(handicapCalculationProcessAggregate.AggregateId); handicapCalculationProcessAggregate.StartedDateTime.ShouldBe(handicapCalculationProcessAggregate.StartedDateTime); handicapCalculationProcessAggregate.Status.ShouldBe(HandicapProcessStatus.Started); }