public void register_with_Func() {
     var factory = new BasicControllerFactory();
     var controller = new MissingController();
     factory.RegisterController("Foo", () => controller);
 
     Check.That(() => object.ReferenceEquals(factory.CreateController(EmptyContext(), "Foo"), controller));
 }
Exemplo n.º 2
0
        public void sets_response_StatusCode_to_404() {
            var controller = new MissingController();
            var response = new Mock<HttpResponseBase>();
            var httpContext = new Mock<HttpContextBase>();
            httpContext.Setup(x => x.Response).Returns(response.Object);
            var request = new RequestContext(httpContext.Object, new RouteData());               
            controller.Execute(request);

            response.VerifySet(x => x.StatusCode = 404);
        }