Exemplo n.º 1
0
        public void GetSelectorsReturnsEmptyCollection()
        {
            // Arrange
            ActionDescriptor ad = GetActionDescriptor();

            // Act
            ICollection <ActionSelector> selectors = ad.GetSelectors();

            // Assert
            Assert.IsInstanceOfType(selectors, typeof(ActionSelector[]), "Should return an immutable collection.");
            Assert.AreEqual(0, selectors.Count);
        }
Exemplo n.º 2
0
        public void GetSelectorsReturnsEmptyCollection()
        {
            // Arrange
            ActionDescriptor ad = GetActionDescriptor();

            // Act
            ICollection <ActionSelector> selectors = ad.GetSelectors();

            // Assert
            Assert.IsType <ActionSelector[]>(selectors);
            Assert.Empty(selectors);
        }
Exemplo n.º 3
0
        protected virtual ControllerContext CreateControllerContext(HttpContextBase httpContext, ControllerBase controller, ActionDescriptor actionDescriptor)
        {
            var requestContext    = GetRequestContext(httpContext, actionDescriptor);
            var controllerContext = new ControllerContext(requestContext, controller);

            controller.ControllerContext     = controllerContext;
            controllerContext.RequestContext = requestContext;

            if (actionDescriptor.GetSelectors().Any(selector => !selector.Invoke(controllerContext)))
            {
                throw new HttpException(404, String.Format("Http method '{0}' is not allowed", controllerContext.HttpContext.Request.HttpMethod));
            }

            Initialize(controllerContext);

            return(controllerContext);
        }
Exemplo n.º 4
0
 public override ICollection <ActionSelector> GetSelectors()
 {
     return(Inner.GetSelectors());
 }