public async Task PilotRegistrationStorageCmdInteractor_UnRegisterPilotForContestAsync_BadPilotToUnregisterParam() { var pilotRegistration = GenerateValidPilotRegistration(1).First(); pilotRegistration.PilotId = string.Empty; var prci = new PilotRegistrationStorageCmdInteractor(mockPilotRegistrationRepository.Object, mockLogger.Object); var result = await prci.UnRegisterPilotForContestAsync(pilotRegistration); // Bad pilot Id Assert.IsTrue(result.IsFaulted); Assert.IsNotNull(result.Error); Assert.IsFalse(string.IsNullOrEmpty(result.Error.ErrorMessage)); pilotRegistration.PilotId = "21341"; pilotRegistration.ContestId = string.Empty; prci = new PilotRegistrationStorageCmdInteractor(mockPilotRegistrationRepository.Object, mockLogger.Object); result = await prci.UnRegisterPilotForContestAsync(pilotRegistration); // Bad Contest id Assert.IsTrue(result.IsFaulted); Assert.IsNotNull(result.Error); Assert.IsFalse(string.IsNullOrEmpty(result.Error.ErrorMessage)); }
public async Task PilotRegistrationStorageCmdInteractor_UnRegisterPilotForContestAsync_NullParameter() { var prci = new PilotRegistrationStorageCmdInteractor(mockPilotRegistrationRepository.Object, mockLogger.Object); var result = await prci.UnRegisterPilotForContestAsync(null); Assert.IsTrue(result.IsFaulted); Assert.IsNotNull(result.Error); Assert.IsFalse(string.IsNullOrEmpty(result.Error.ErrorMessage)); }
public async Task PilotRegistrationStorageCmdInteractor_UnRegisterPilotForContestAsync_HappyPath() { var pilotRegistration = GenerateValidPilotRegistration(1).First(); pilotRegistration.PilotId = "23092wefsdf"; mockPilotRegistrationRepository.Setup(prr => prr.DeleteAsync(It.IsAny <string>())) .Returns(Task.FromResult(new Result <bool>(true))); var prci = new PilotRegistrationStorageCmdInteractor(mockPilotRegistrationRepository.Object, mockLogger.Object); var result = await prci.UnRegisterPilotForContestAsync(pilotRegistration); Assert.IsFalse(result.IsFaulted); Assert.IsNotNull(result.Value); }
public async Task PilotRegistrationStorageCmdInteractor_UnRegisterPilotForContestAsync_RepositoryFailure() { var pilotRegistration = GenerateValidPilotRegistration(1).First(); pilotRegistration.PilotId = "2342342"; mockPilotRegistrationRepository.Setup(prr => prr.DeleteAsync(It.IsAny <string>())) .ThrowsAsync(new Exception()); var prci = new PilotRegistrationStorageCmdInteractor(mockPilotRegistrationRepository.Object, mockLogger.Object); var result = await prci.UnRegisterPilotForContestAsync(pilotRegistration); Assert.IsTrue(result.IsFaulted); Assert.IsNotNull(result.Error.Exception); }