public void TestGetBookmarkedEvents() { // Arrange BookmarkRepository repo = _bookmarkRepo; List <EventRecord> expected1 = events; List <EventRecord> expected2 = new List <EventRecord>(); // Act _loginRepo.IsUserLoginValid("TestUser", "TestPass"); List <EventRecord> result1 = repo.GetAllBookmarkedEvents(); _loginRepo.IsUserLoginValid("User2", "Pass2"); List <EventRecord> result2 = repo.GetAllBookmarkedEvents(); // Assert Assert.AreEqual(expected1.Count, result1.Count); Assert.AreEqual(expected2.Count, result2.Count); for (int i = 0; i < expected1.Count; i++) { Assert.AreEqual(expected1[i].ListingId, result1[i].ListingId); Assert.AreEqual(expected1[i].Title, result1[i].Title); Assert.AreEqual(expected1[i].Description, result1[i].Description); } }
public GetBookmarkedEventsResponseDTO GetAllBookmarkedEvents() { try { List <EventRecord> allEvents = _bookmarkRepo.GetAllBookmarkedEvents(); return(new GetBookmarkedEventsResponseDTO() { EventRecords = allEvents.Select(x => EventRecordTransformer.Transform(x)).ToList() }); } catch (RepoException e) { return(new GetBookmarkedEventsResponseDTO() { Status = e.Message }); } }