public async Task PilotRegistrationStorageCmdInteractor_UnRegisterPilotsForContestAsync_NullParameter() { var prci = new PilotRegistrationStorageCmdInteractor(mockPilotRegistrationRepository.Object, mockLogger.Object); var result = await prci.UnRegisterPilotsForContestAsync(null); Assert.IsTrue(result.IsFaulted); Assert.IsNotNull(result.Error); Assert.IsFalse(string.IsNullOrEmpty(result.Error.ErrorMessage)); }
public async Task PilotRegistrationStorageCmdInteractor_UnRegisterPilotsForContestAsync_HappyPath() { var pilotRegistrations = new List <PilotRegistration>(GenerateValidPilotRegistration(10)); mockPilotRegistrationRepository.Setup(prr => prr.DeleteAsync(It.IsAny <IEnumerable <PilotRegistration> >())) .Returns(Task.FromResult(new Result <bool>(true))); var prci = new PilotRegistrationStorageCmdInteractor(mockPilotRegistrationRepository.Object, mockLogger.Object); var result = await prci.UnRegisterPilotsForContestAsync(pilotRegistrations); Assert.IsFalse(result.IsFaulted); Assert.IsNotNull(result.Value); }
public async Task PilotRegistrationStorageCmdInteractor_UnRegisterPilotsForContestAsync_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.UnRegisterPilotsForContestAsync(pilotRegistrations); Assert.IsTrue(result.IsFaulted); Assert.IsNotNull(result.Error); Assert.IsFalse(string.IsNullOrEmpty(result.Error.ErrorMessage)); }
public async Task PilotRegistrationStorageCmdInteractor_UnRegisterPilotsForContestAsync_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.UnRegisterPilotsForContestAsync(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")); }