public void Execute(IJobExecutionContext context)
        {
            DateTime date = DateTimeHelper.RemoveSecondsFromDateTime(DateTime.Now);
            List <ItemNotification> notifications = itemNotificationRepository.FindNotNotifiedByNotificationDate(date);

            ShowNotificationWindow(notifications);
        }
Example #2
0
        public void ShoulReturnNotNotifiedItemsNotificaitonsByDateTime()
        {
            // arrange
            Item             firstItem          = PrepareItem("name1", "descritpion1", TODAY, false);
            ItemNotification firstNotification  = PrepareItemNotification(firstItem, TODAY, false);
            Item             secondItem         = PrepareItem("name2", "descritpion2", TODAY, false);
            ItemNotification secondNotification = PrepareItemNotification(secondItem, TODAY, true);

            dbContext.Items.Add(firstItem);
            dbContext.Items.Add(secondItem);
            dbContext.ItemNotifications.Add(firstNotification);
            dbContext.ItemNotifications.Add(secondNotification);
            dbContext.SaveChanges();

            // act
            List <ItemNotification> returnedNotifications = itemNotificationRepository.FindNotNotifiedByNotificationDate(TODAY);

            // assert
            Assert.AreEqual(1, returnedNotifications.Count);
            CollectionAssert.Contains(returnedNotifications, firstNotification);
        }