예제 #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);
        }