public bool FetchAndStore() { bool result = false; try { List <RateBE> fetchedRates = FetchService.FetchRates(); List <RateDM> ratesToStore = Mapper.MapList <RateBE, RateDM>(fetchedRates); RateRepository.CreateAll(ratesToStore); List <TransactionBE> fetchedTransactions = FetchService.FetchTransactions(); List <TransactionDM> transactionsToStore = Mapper.MapList <TransactionBE, TransactionDM>(fetchedTransactions); TransactionRepository.CreateAll(transactionsToStore); result = true; } #region Exceptions catch (VuelingExamDomainException e) { Log.Error(e.Message); Log.Warning(e.StackTrace); throw new VuelingExamApplicationException(e.Message, e.InnerException); } catch (VuelingExamInfrastructureException e) { Log.Error(e.Message); Log.Warning(e.StackTrace); throw new VuelingExamApplicationException(e.Message, e.InnerException); } #endregion return(result); }
public void FetchRatesTest() { Assert.AreEqual(fetchedRates.GetType(), fetchService.FetchRates().GetType()); }