Пример #1
0
        public void GetNotification_NotificationIsNotNull_ViewResult()
        {
            // Arrange
            var data = new List <Notification>
            {
                new Notification {
                    Id = 1
                }
            }.AsQueryable();

            var mockSet = MockHelper.MockDbSet(data);

            var mockContext = new Mock <Context>();

            mockContext.SetupGet(c => c.Notifications).Returns(mockSet.Object);

            var controller = new NotificationController(mockContext.Object);

            // Act

            var result = controller.GetNotification(1) as ViewResult;

            // Assert

            Assert.IsNotNull(result);
        }
        public static void DoWork()
        {
            while (true)
            {
                Thread.Sleep(30000);

                var notificationController = new NotificationController();
                var notificacion           = notificationController.GetNotification().Result;
                if (notificacion.Count > 0)
                {
                    notificacion.ForEach(n =>
                    {
                        Program.asistimeLogin.Invoke((MethodInvoker) delegate()
                        {
                            new PopupNotification(n.evento, n.message);
                        });
                    });
                }
            }
        }
Пример #3
0
        public static void DoWork()
        {
            while (true)
            {
                Thread.Sleep(30000);

                var notificationController = new NotificationController();
                var notificacion           = notificationController.GetNotification().Result;
                if (notificacion.Count > 0)
                {
                    var userController = new UserController();
                    var tourController = new TourController();

                    Constants.user  = userController.GetUser().Result;
                    Constants.tours = tourController.GetAllToursAsync().Result;

                    Program.asistimeLogin.Invoke((MethodInvoker) delegate()
                    {
                        new PopupNotification("Nuevo tour", "Te asignaron un tour");
                    });
                }
            }
        }