public RedirectHandlerTest()
        {
            var request = new Request {
                Method  = "GET",
                Path    = "/redirect",
                Version = "HTTP/1.1"
            };
            var handler = new RedirectHandler();

            _response = handler.Handle(request);
        }
Beispiel #2
0
        public void HandleRedirectResultWithNullResulte()
        {
            // Setup
            var mvc     = new MvcEngine();
            var handler = new RedirectHandler(_mockNavigator.Object);
            var values  = new RouteDictionary();
            var result  = new RedirectResult
            {
                ControllerName = "Test",
                ActionName     = "Index",
                Values         = new RouteDictionary(),
            };

            // Execute
            handler.Handle(a_mvc: mvc, a_controllerName: "AnotherTest", a_result: null);
        }
Beispiel #3
0
        public void HandleRedirectResultWithNullMvcEngine()
        {
            // Setup
            var handler = new RedirectHandler(_mockNavigator.Object);
            var values  = new RouteDictionary();
            var result  = new RedirectResult
            {
                ControllerName = "Test",
                ActionName     = "Index",
                Values         = new RouteDictionary(),
            };

            // Execute
            handler.Handle(a_mvc: null, a_controllerName: "AnotherTest", a_result: result);

            // Assert
            _mockNavigator.Verify(i => i.Navigate("Test", "Index", values), Times.Once);
        }
        public void HandleRedirectResultWithNoControllerName()
        {
            // Setup
            var mvc = new MvcEngine();
            var handler = new RedirectHandler(_mockNavigator.Object);
            var values = new RouteDictionary();
            var result = new RedirectResult
            {
                ControllerName = null,
                ActionName = "Index",
                Values = new RouteDictionary(),
            };

            // Execute
            handler.Handle(mvc, "AnotherTest", result);

            // Assert
            _mockNavigator.Verify(i => i.Navigate("AnotherTest", "Index", values), Times.Once);
        }
        public void HandleRedirectResultWithNullControllerName()
        {
            // Setup
            var mvc = new MvcEngine();
            var handler = new RedirectHandler(_mockNavigator.Object);
            var values = new RouteDictionary();
            var result = new RedirectResult
            {
                ControllerName = "Test",
                ActionName = "Index",
                Values = new RouteDictionary(),
            };

            // Execute
            handler.Handle(a_mvc: mvc, a_controllerName:null, a_result:result);
        }