public IQuote GetQuotes(int level) { try { IItemPathSettings quotePath = _contextRepository.GetRootItem <IItemPathSettings>(); if (quotePath != null) { var quotes = _contentRepository.GetItem <IQuoteFolder>(new GetItemByPathOptions { Path = quotePath.QuoteUrl }); if (quotes != null) { List <IQuote> quotesList = quotes.Quotes.ToList(); if (quotesList.Count > level) { return(quotesList.ElementAt(level)); } } } } catch (Exception ex) { Sitecore.Diagnostics.Log.Error(ex.Message, ex, this); } return(null); }
public QuoteServiceTests() { itemPathSettings = Substitute.For <IItemPathSettings>(); }