public void ScoringContestScoreAggInteractor_GenerateContestScores_EmptyParam()
        {
            var sci    = new ScoringContestScoreAggInteractor(mockContestScoreAggregator.Object, mockLogger.Object);
            var result = sci.GetAggregateRoundScoresForPilots(new ContestScoresCollection());

            Assert.IsTrue(result.IsFaulted);
            Assert.IsNotNull(result.Error);
            Assert.IsNotNull(result.Error.ErrorMessage);
        }
        public void ScoringContestScoreAggInteractor_GetAggregateRoundScoresForPilots_HappyPath()
        {
            var numberOfPilots = 10;
            var numberOfRounds = 10;
            var contestScores  = ScoringTestHelpers.GenerateValidContestRoundScores(numberOfPilots, "SASS October 2017", numberOfRounds, 120, true, true);
            var fakeScores     = GeneratePilotScores(numberOfPilots, numberOfRounds, contestScores);

            mockContestScoreAggregator.Setup(csa => csa.GenerateContestScores(It.IsAny <ContestScoresCollection>())).Returns(fakeScores);

            var sci    = new ScoringContestScoreAggInteractor(mockContestScoreAggregator.Object, mockLogger.Object);
            var result = sci.GetAggregateRoundScoresForPilots(contestScores);

            // Verify all the pilots come back.
            Assert.AreEqual(10, result.Value.Keys.Count);
        }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="F3KContestEngine" /> class.
 /// </summary>
 /// <param name="taskQueryInteractor">The task query interactor.</param>
 /// <param name="contestStorageCmdIntr">The contest storage command intr.</param>
 /// <param name="scoringStorageCmdIntr">The scoring storage command intr.</param>
 /// <param name="logger">The logger.</param>
 public F3KContestEngine(TaskQueryInteractor taskQueryInteractor,
                         ContestStorageCmdInteractor contestStorageCmdIntr,
                         ScoringStorageCmdInteractor scoringStorageCmdIntr,
                         ScoringQueryInteractor scoringQueryInteractor,
                         ScoringContestScoreAggInteractor scoringContestScoreAggIntr,
                         FlightMatrixStorageCmdInteractor flightMatrixStorageCmdIntr,
                         FlightMatrixQueryInteractor flightMatrixQueryIntr,
                         PilotQueryInteractor pilotQueryInteractor,
                         ISortingAlgo sortingAlgo,
                         IFlyOffSelectionAlgo flyOffAlgo,
                         ILoggingService logger) : base(contestStorageCmdIntr, scoringStorageCmdIntr)
 {
     this.taskQueryInteractor        = taskQueryInteractor ?? throw new ArgumentNullException($"{nameof(F3KContestEngine)}:Ctor - {nameof(taskQueryInteractor)} cannot be null");
     this.scoringQueryInteractor     = scoringQueryInteractor ?? throw new ArgumentNullException($"{nameof(F3KContestEngine)}:Ctor - {nameof(scoringQueryInteractor)} cannot be null");
     this.scoringContestScoreAggIntr = scoringContestScoreAggIntr ?? throw new ArgumentNullException($"{nameof(F3KContestEngine)}:Ctor - {nameof(scoringContestScoreAggIntr)} cannot be null");
     this.flightMatrixQueryIntr      = flightMatrixQueryIntr ?? throw new ArgumentNullException($"{nameof(F3KContestEngine)}:Ctor - {nameof(flightMatrixQueryIntr)} cannot be null");
     this.flightMatrixStorageCmdIntr = flightMatrixStorageCmdIntr ?? throw new ArgumentNullException($"{nameof(F3KContestEngine)}:Ctor - {nameof(flightMatrixStorageCmdIntr)} cannot be null");
     this.pilotQueryInteractor       = pilotQueryInteractor ?? throw new ArgumentNullException($"{nameof(F3KContestEngine)}:Ctor - {nameof(pilotQueryInteractor)} cannot be null");
     this.sortingAlgo       = sortingAlgo ?? throw new ArgumentNullException($"{nameof(F3KContestEngine)}:Ctor - {nameof(sortingAlgo)} cannot be null");
     this.flyOffPilotPicker = flyOffAlgo ?? throw new ArgumentException($"{nameof(F3KContestEngine)}:Ctor - {nameof(flyOffAlgo)} cannot be null");
     this.logger            = logger ?? throw new ArgumentNullException($"{nameof(F3KContestEngine)}:Ctor - {nameof(logger)} cannot be null");
 }
 public void ScoringContestScoreAggInteractor_Ctor_NullParam()
 {
     var sci = new ScoringContestScoreAggInteractor(null, mockLogger.Object);
 }