public void GetAllAnnouncements_TwoRecordsExists() { Announcement announcement1 = new Announcement { IDAnnouncement = Guid.NewGuid(), ValidFrom = new DateTime(2018, 10, 1), ValidTo = new DateTime(2018, 11, 15), EventDateTime = new DateTime(2018, 11, 1), Tags = "tags1", Text = "Eventcall1", Title = "Event1" }; Announcement announcement2 = new Announcement { IDAnnouncement = Guid.NewGuid(), ValidFrom = new DateTime(2017, 1, 1), ValidTo = new DateTime(2017, 3, 1), EventDateTime = null, Tags = "tags", Text = "Announcement", Title = "Important" }; clubmembershipDataContext.Announcements.InsertOnSubmit(announcement1); clubmembershipDataContext.Announcements.InsertOnSubmit(announcement2); clubmembershipDataContext.SubmitChanges(); List <AnnouncementModel> result = announcementResource.GetAllAnnouncements(); Assert.AreEqual(2, result.Count); AnnouncementModel announcementModel1 = result.FirstOrDefault(x => x.IDAnnouncement == announcement1.IDAnnouncement); Assert.AreEqual(announcementModel1, announcement1); AnnouncementModel announcementModel2 = result.FirstOrDefault(x => x.IDAnnouncement == announcement2.IDAnnouncement); Assert.AreEqual(announcementModel2, announcement2); }
public ActionResult Index() { List <AnnouncementModel> announcements = announcementRepository.GetAllAnnouncements(); return(View("Index", announcements)); }