public async Task PilotRegistrationStorageCmdInteractor_RegisterPilotsForContestAsync_NullParameter()
        {
            var prci   = new PilotRegistrationStorageCmdInteractor(mockPilotRegistrationRepository.Object, mockLogger.Object);
            var result = await prci.RegisterPilotsForContestAsync(null);

            Assert.IsTrue(result.IsFaulted);
            Assert.IsNotNull(result.Error);
            Assert.IsFalse(string.IsNullOrEmpty(result.Error.ErrorMessage));
        }
        public async Task PilotRegistrationStorageCmdInteractor_RegisterPilotsForContestAsync_HappyPath()
        {
            var pilotRegistrations = new List <PilotRegistration>(GenerateValidPilotRegistration(10));

            mockPilotRegistrationRepository.Setup(prr => prr.CreateAsync(It.IsAny <IEnumerable <PilotRegistration> >()))
            .Returns(Task.FromResult(new Result <IEnumerable <PilotRegistration> >(pilotRegistrations)));

            var prci   = new PilotRegistrationStorageCmdInteractor(mockPilotRegistrationRepository.Object, mockLogger.Object);
            var result = await prci.RegisterPilotsForContestAsync(pilotRegistrations);

            Assert.IsFalse(result.IsFaulted);
            Assert.IsNotNull(result.Value);
        }
        public async Task PilotRegistrationStorageCmdInteractor_RegisterPilotsForContestAsync_EmptyPilotsToRegisterParameter()
        {
            var pilotRegistrations = new List <PilotRegistration>();

            mockPilotRegistrationRepository.Setup(prr => prr.CreateAsync(It.IsAny <IEnumerable <PilotRegistration> >()))
            .Returns(Task.FromResult(new Result <IEnumerable <PilotRegistration> >(pilotRegistrations)));

            var prci   = new PilotRegistrationStorageCmdInteractor(mockPilotRegistrationRepository.Object, mockLogger.Object);
            var result = await prci.RegisterPilotsForContestAsync(pilotRegistrations);

            Assert.IsTrue(result.IsFaulted);
            Assert.IsNotNull(result.Error);
            Assert.IsFalse(string.IsNullOrEmpty(result.Error.ErrorMessage));
        }
        public async Task PilotRegistrationStorageCmdInteractor_RegisterPilotsForContestAsync_BadPilotsToRegisterParameter()
        {
            var pilotRegistrations = new List <PilotRegistration>(GenerateValidPilotRegistration(10));

            pilotRegistrations[4].ContestId = string.Empty;

            mockPilotRegistrationRepository.Setup(prr => prr.CreateAsync(It.IsAny <IEnumerable <PilotRegistration> >()))
            .Returns(Task.FromResult(new Result <IEnumerable <PilotRegistration> >(pilotRegistrations)));

            var prci   = new PilotRegistrationStorageCmdInteractor(mockPilotRegistrationRepository.Object, mockLogger.Object);
            var result = await prci.RegisterPilotsForContestAsync(pilotRegistrations);

            // One bad contest id should fail the set.
            Assert.IsTrue(result.IsFaulted);
            Assert.IsNotNull(result.Error);
            Assert.IsFalse(string.IsNullOrEmpty(result.Error.ErrorMessage));
            Assert.IsTrue(result.Error.ErrorMessage.Contains("4"));
        }