예제 #1
0
        public void GetAnnouncementById_AnnouncementExists()
        {
            Guid         ID = Guid.NewGuid();
            Announcement expectedAnnouncement = new Announcement
            {
                IDAnnouncement = ID,
                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(expectedAnnouncement);
            clubmembershipDataContext.Announcements.InsertOnSubmit(announcement2);
            clubmembershipDataContext.SubmitChanges();

            AnnouncementModel result = announcementResource.GetAnnouncementByID(ID);

            Assert.AreEqual(result, expectedAnnouncement);
        }
 // GET: Announcement/Details/5
 public ActionResult Details(Guid id)
 {
     Models.AnnouncementModel announcementModel = announcementRepository.GetAnnouncementByID(id);
     return(View("Details", announcementModel));
 }