Beispiel #1
0
        /// <summary>
        ///  Perform operations that should take place when the application becomes visible rather than
        ///  when it is prelaunched, such as building a what's new feed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        static void WindowVisibilityChangedEventHandler(object sender, Windows.UI.Core.VisibilityChangedEventArgs e)
        {
            if (!e.Visible)   // app losing focus
            {
                return;
            }

            TodayController.CheckHeroQuote();
        }
Beispiel #2
0
        public void RenderDefaultView()
        {
            //Arrange
            var mockedToDoListTaskService = new Mock <IToDoListTaskService>();

            var listId = Guid.NewGuid();
            var tasks  = new List <ToDoListTask>();

            mockedToDoListTaskService.Setup(s => s.GetAllByUserId(It.IsAny <string>())).Returns(tasks);
            var controller = new TodayController(mockedToDoListTaskService.Object);

            var controllerContext = new Mock <ControllerContext>();
            var principal         = new Mock <IPrincipal>();

            principal.SetupGet(x => x.Identity.Name).Returns("Username");
            controllerContext.SetupGet(x => x.HttpContext.User).Returns(principal.Object);
            controller.ControllerContext = controllerContext.Object;

            //Act&Assert
            controller.WithCallTo(c => c.Index()).ShouldRenderDefaultView();
        }
Beispiel #3
0
        public void CallToDoListModelServiceMethodGetListById_OnlyOnce()
        {
            //Arrange
            var mockedToDoListTaskService = new Mock <IToDoListTaskService>();

            var listId = Guid.NewGuid();

            var controller = new TodayController(mockedToDoListTaskService.Object);

            var controllerContext = new Mock <ControllerContext>();
            var principal         = new Mock <IPrincipal>();

            principal.SetupGet(x => x.Identity.Name).Returns("Username");
            controllerContext.SetupGet(x => x.HttpContext.User).Returns(principal.Object);
            controller.ControllerContext = controllerContext.Object;

            //Act
            controller.Index();

            //Assert
            mockedToDoListTaskService.Verify(u => u.GetAllByUserId(It.IsAny <string>()), Times.Once);
        }