Exemple #1
0
        public void HandleResult()
        {
            // Setup
            var handler1 = new TestViewHandler();
            handler1.TypeCatalog.RegisterType<TestView1>("MillionDollars");
            _mvc.RegisterHandler(handler1);
            var handler2 = new TestViewHandler();
            handler2.TypeCatalog.RegisterType<TestView1>("MillionDollars");
            _mvc.RegisterHandler(handler2);

            // Execute
            var controller = new TestController();
            _mvc.HandleResult(controller, new ViewResult { ViewName = "MillionDollars", Model = 1000000.0m });

            // Assert
            Assert.IsNotNull(handler1.LastResolvedView);
            Assert.AreEqual("MillionDollars", handler1.LastResolvedView.Key);
            Assert.AreEqual(1000000.0m, handler1.LastResolvedView.Value);

            Assert.IsNotNull(handler2.LastResolvedView);
            Assert.AreEqual("MillionDollars", handler2.LastResolvedView.Key);
            Assert.AreEqual(1000000.0m, handler2.LastResolvedView.Value);
        }
Exemple #2
0
        public void RegisterBootstrappableViewHandler()
        {
            // Setup
            var viewHandler = new TestViewHandler();

            // Execute
            _mvc.RegisterHandler(viewHandler);

            // Assert
            Assert.IsTrue(viewHandler.IsBootstrapped);
        }
Exemple #3
0
        public void NavigateToView()
        {
            // Setup
            var handler = new TestViewHandler();
            _mvc.RegisterHandler(handler);
            handler.TypeCatalog.RegisterType<TestView1>("Index");

            // Execute
            _mvc.Navigator.Navigate<TestController>(c => c.Index());

            // Assert
            Assert.IsNotNull(handler.LastResolvedView);
        }