public void TearDown() { var deviceDao = new DeviceDao(); foreach (var device in deviceDao.GetAll(TestTenantID, TestUserID)) { deviceDao.Delete(device.Token); } }
public void SetUp() { var deviceDao = new DeviceDao(); for (int i = 0; i < 3; i++) { deviceDao.Save(new Device { TenantID = TestTenantID, UserID = TestUserID, Token = "device_" + (i + 1) }); } }
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); }
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); }