Ejemplo n.º 1
0
        public void ControllerManager_GetControllerName_NullDocumentMetadataReturnsNull()
        {
            var stubAllowedWebpage = new StubAllowedWebpage { PublishOn = CurrentRequestData.Now.AddDays(-1) };
            _controllerManager.GetMetadata = document => null;

            _controllerManager.GetControllerName(stubAllowedWebpage, "GET").Should().BeNull();
        }
        public void ControllerManager_GetActionName_NullDocumentMetadataReturnsNull()
        {
            var stubAllowedWebpage = new StubAllowedWebpage {
                PublishOn = CurrentRequestData.Now.AddDays(-1)
            };

            _controllerManager.GetMetadata = document => null;

            _controllerManager.GetActionName(stubAllowedWebpage, "GET").Should().BeNull();
        }
Ejemplo n.º 3
0
        public void ControllerManager_GetControllerName_HttpMethodIsPOSTReturnsWebGetController()
        {
            var metadata = new DocumentMetadata
            {
                WebPostController = "test-controller"
            };
            var stubAllowedWebpage = new StubAllowedWebpage { Published = true };
            _controllerManager.GetMetadata = document => metadata;

            _controllerManager.GetControllerName(stubAllowedWebpage, "POST").Should().Be("test-controller");
        }
Ejemplo n.º 4
0
        public void ControllerManager_GetControllerName_HttpMethodIsAnotherTypeReturnsNull()
        {
            var metadata = new DocumentMetadata
            {
                WebPostController = "test-controller"
            };
            var stubAllowedWebpage = new StubAllowedWebpage { PublishOn = CurrentRequestData.Now.AddDays(-1) };
            _controllerManager.GetMetadata = document => metadata;


            _controllerManager.GetControllerName(stubAllowedWebpage, "PUT").Should().BeNull();
        }
        public void ControllerManager_GetActionName_ReturnsNullIfHttpMethodIsSomethingElse()
        {
            var metadata = new DocumentMetadata
            {
                WebPostAction = "test-post-action"
            };
            var webpage = new StubAllowedWebpage {
                PublishOn = CurrentRequestData.Now.AddDays(-1)
            };

            _controllerManager.GetMetadata = document => metadata;

            _controllerManager.GetActionName(webpage, "PUT").Should().BeNull();
        }
        public void ControllerManager_GetActionName_ReturnsDefinitionWebGetActionIfHttpMethodIsPOST()
        {
            var metadata = new DocumentMetadata
            {
                WebPostAction = "test-post-action"
            };
            var webpage = new StubAllowedWebpage {
                Published = true
            };

            _controllerManager.GetMetadata = document => metadata;

            _controllerManager.GetActionName(webpage, "POST").Should().Be("test-post-action");
        }
        public void ControllerManager_GetControllerName_HttpMethodIsPOSTReturnsWebGetController()
        {
            var metadata = new DocumentMetadata
            {
                WebPostController = "test-controller"
            };
            var stubAllowedWebpage = new StubAllowedWebpage {
                Published = true
            };

            _controllerManager.GetMetadata = document => metadata;

            _controllerManager.GetControllerName(stubAllowedWebpage, "POST").Should().Be("test-controller");
        }
        public void ControllerManager_GetControllerName_HttpMethodIsAnotherTypeReturnsNull()
        {
            var metadata = new DocumentMetadata
            {
                WebPostController = "test-controller"
            };
            var stubAllowedWebpage = new StubAllowedWebpage {
                PublishOn = CurrentRequestData.Now.AddDays(-1)
            };

            _controllerManager.GetMetadata = document => metadata;


            _controllerManager.GetControllerName(stubAllowedWebpage, "PUT").Should().BeNull();
        }
        public void ControllerManager_SetFormData_IfTheFormDataIsNotNullSetTheRouteData()
        {
            var nameValueCollection = new NameValueCollection {
                { "test", "data" }
            };
            var controller = A.Fake <Controller>();
            var routeData  = new RouteData();

            controller.ControllerContext = new ControllerContext {
                RouteData = routeData
            };
            var webpage = new StubAllowedWebpage();

            _controllerManager.SetFormData(webpage, controller, nameValueCollection);

            routeData.Values["form"].Should().NotBeNull();
        }
Ejemplo n.º 10
0
        public void ControllerManager_SetFormData_IfTheFormDataIsNotNullSetTheRouteData()
        {
            var nameValueCollection = new NameValueCollection { { "test", "data" } };
            var controller = A.Fake<Controller>();
            var routeData = new RouteData();
            controller.ControllerContext = new ControllerContext { RouteData = routeData };
            var webpage = new StubAllowedWebpage();

            _controllerManager.SetFormData(webpage, controller, nameValueCollection);

            routeData.Values["form"].Should().NotBeNull();
        }
Ejemplo n.º 11
0
        public void ControllerManager_GetActionName_ReturnsNullIfHttpMethodIsSomethingElse()
        {
            var metadata = new DocumentMetadata
            {
                WebPostAction = "test-post-action"
            };
            var webpage = new StubAllowedWebpage { PublishOn = CurrentRequestData.Now.AddDays(-1) };

            _controllerManager.GetMetadata = document => metadata;

            _controllerManager.GetActionName(webpage, "PUT").Should().BeNull();
        }
Ejemplo n.º 12
0
        public void ControllerManager_GetActionName_ReturnsDefinitionWebGetActionIfHttpMethodIsPOST()
        {
            var metadata = new DocumentMetadata
            {
                WebPostAction = "test-post-action"
            };
            var webpage = new StubAllowedWebpage { Published = true };

            _controllerManager.GetMetadata = document => metadata;

            _controllerManager.GetActionName(webpage, "POST").Should().Be("test-post-action");
        }