public void SearchVersesTest() { VerseRepository target = new VerseRepository(); // TODO: Initialize to an appropriate value string searchTerm = "Thou"; // TODO: Initialize to an appropriate value int startIndex = 0; // TODO: Initialize to an appropriate value List <VerseModel> actual; actual = target.SearchVerses(searchTerm, startIndex); Assert.AreNotEqual(actual.Count, 0); }
public ActionResult Results(string searchTerms, int startIndex) { // Get the list of verses to send to view IVerseRepository repository = new VerseRepository(); List <Models.VerseModel> verseList = repository.SearchVerses(searchTerms, startIndex); // Get the search count ViewBag.Count = repository.GetVerseCountForSearch(searchTerms); // Store the search term viewbag for use by the view ViewBag.SearchTerms = searchTerms; // Store the start index, incremented by 20 for the next 20 results ViewBag.StartIndex = startIndex + 20; // Store a friendly start and end number to display to user // Do this here rather than in view to put as little code in view as necessary ViewBag.FriendlyStart = startIndex + 1; if (startIndex + 20 < ViewBag.Count) { // Set the end value ViewBag.FriendlyEnd = startIndex + 20; } else { // If the end value would be greater than the count, then set end value to count ViewBag.FriendlyEnd = ViewBag.Count; } // Store previous start index to allow for a "previous" link ViewBag.PreviousIndex = startIndex - 20; // Ensure that the previous index is not less than 0 if (ViewBag.PreviousIndex < 0) { ViewBag.PreviousIndex = 0; } return(View(verseList)); }
private void LoadDBVerses() { IVerseRepository verseRepo = new VerseRepository(dbFactory); foreach (var verse in verseRepo.GetAll()) { verseDict.Add(GetVerseCompositeId(verse.Ayah, verse.Chapter), verse); } }
protected override bool CommitChangesInternal() { bool result = false; IVerseRepository verseRepo = new VerseRepository(dbFactory); //update verses first if (result = UpdateVerses(verseRepo)) { //update sajdas if (result = CheckAndUpdateSajdas(dbFactory.Get(), verseRepo)) { //update rukus result = CheckAndUpdateRukus(dbFactory.Get(), verseRepo); } } return result; }
public SnippetService() { this.chapterRepository = new ChapterRepository(); this.verseRepository = new VerseRepository(); }
private IVerseRepository GetRepositoryWithEnrolledUnitOfWork() { IVerseRepository verseRepository = new VerseRepository(WorkUnit); return verseRepository; }