Ejemplo n.º 1
0
        public void TestMessageRegistration()
        {
            IocContainer.IoCContainer.Kernel.Unbind <IMediator>();
            IocContainer.IoCContainer.Kernel.Bind <IMediator>().To <MyMessageMediator>().InSingletonScope();

            ChangeTracker.Setup(x => x.LoadedTicketcheckSum).Returns("");
            ChangeTracker.Setup(x => x.LoadedTicket).Returns("");
            var mediator = (MyMessageMediator)IocContainer.IoCContainer.Kernel.Get <IMediator>();

            var model = new TicketCheckerViewModel();

            model.OnNavigationCompleted();
            var count = 0;

            foreach (var handler in mediator._registeredHandlers)
            {
                foreach (var actionDetailse in handler.Value)
                {
                    count++;
                }
            }
            Assert.AreEqual(4, count);

            model.Close();


            count = 0;
            foreach (var handler in mediator._registeredHandlers)
            {
                foreach (var actionDetailse in handler.Value)
                {
                    count++;
                }
            }

            Assert.AreEqual(0, count);

            model = new TicketCheckerViewModel();
            model.OnNavigationCompleted();

            count = 0;
            foreach (var handler in mediator._registeredHandlers)
            {
                foreach (var actionDetailse in handler.Value)
                {
                    count++;
                }
            }

            Assert.AreEqual(4, count);
        }
Ejemplo n.º 2
0
        public void OnPinButtonMethodTestWithNullValue()
        {
            IocContainer.IoCContainer.Kernel.Unbind <IMediator>();
            IocContainer.IoCContainer.Kernel.Bind <IMediator>().To <MyMessageMediator>().InSingletonScope();

            ChangeTracker.Setup(x => x.LoadedTicketcheckSum).Returns("");
            ChangeTracker.Setup(x => x.LoadedTicket).Returns("");
            var mediator = (MyMessageMediator)IocContainer.IoCContainer.Kernel.Get <IMediator>();

            var model = new TicketCheckerViewModel();

            model.OnNavigationCompleted();

            string testString = null;

            model.OnPinButtonTest(testString);
        }