Exemple #1
0
        public void NotificationCrudTest()
        {
            var notificationDao = new NotificationDao();
            var deviceDao       = new DeviceDao();

            foreach (var device in deviceDao.GetAll(TestTenantID, TestUserID))
            {
                notificationDao.Save(device.ID, new PushNotification
                {
                    Module = PushModule.Projects,
                    Action = PushAction.Created,
                    Item   = new PushItem(PushItemType.Task, "task" + device.ID, "")
                });

                notificationDao.Save(device.ID, new PushNotification
                {
                    Module = PushModule.Projects,
                    Action = PushAction.InvitedTo,
                    Item   = new PushItem(PushItemType.Project, "project" + device.ID, "")
                });

                notificationDao.Save(device.ID, new PushNotification
                {
                    Module = PushModule.Projects,
                    Action = PushAction.Assigned,
                    Item   = new PushItem(PushItemType.Milestone, "milestone" + device.ID, "")
                });
            }

            List <PushNotification> notifications = notificationDao.GetNotifications(TestTenantID, TestUserID, "device_1", DateTime.MinValue, DateTime.MaxValue);

            Assert.AreEqual(3, notifications.Count);

            notificationDao.Delete(DateTime.MaxValue);

            notifications = notificationDao.GetNotifications(TestTenantID, TestUserID, "device_1", DateTime.MinValue, DateTime.MaxValue);
            Assert.AreEqual(0, notifications.Count);
        }
Exemple #2
0
        public void NotificationCrudTest()
        {
            var notificationDao = new NotificationDao();
            var deviceDao = new DeviceDao();
            foreach (var device in deviceDao.GetAll(TestTenantID, TestUserID))
            {
                notificationDao.Save(device.ID, new PushNotification
                    {
                        Module = PushModule.Projects,
                        Action = PushAction.Created,
                        Item = new PushItem(PushItemType.Task, "task" + device.ID, "")
                    });

                notificationDao.Save(device.ID, new PushNotification
                    {
                        Module = PushModule.Projects,
                        Action = PushAction.InvitedTo,
                        Item = new PushItem(PushItemType.Project, "project" + device.ID, "")
                    });

                notificationDao.Save(device.ID, new PushNotification
                    {
                        Module = PushModule.Projects,
                        Action = PushAction.Assigned,
                        Item = new PushItem(PushItemType.Milestone, "milestone" + device.ID, "")
                    });
            }

            List<PushNotification> notifications = notificationDao.GetNotifications(TestTenantID, TestUserID, "device_1", DateTime.MinValue, DateTime.MaxValue);
            Assert.AreEqual(3, notifications.Count);

            notificationDao.Delete(DateTime.MaxValue);

            notifications = notificationDao.GetNotifications(TestTenantID, TestUserID, "device_1", DateTime.MinValue, DateTime.MaxValue);
            Assert.AreEqual(0, notifications.Count);
        }