public void It_should_allow_access_to_the_Request()
        {
            var controllerSpec = new ControllerSpec<MonkeyController>();

            controllerSpec.Request.SetupGet(req => req.HttpMethod).Returns("GET");

            ((MonkeyController)controllerSpec).Request.HttpMethod.ShouldEqual("GET");
        }
        public void It_should_allow_access_to_the_Response()
        {
            var controllerSpec = new ControllerSpec<MonkeyController>();

            controllerSpec.Response.SetupGet(res => res.RedirectLocation).Returns("/home");

            ((MonkeyController)controllerSpec).Response.RedirectLocation.ShouldEqual("/home");
        }
        public void It_should_allow_access_to_the_Session()
        {
            var controllerSpec = new ControllerSpec<MonkeyController>();
            controllerSpec.Session.SetupGet(session => session["Value"]).Returns("42");

            var controller = controllerSpec.Build();

            (controller.SessionAction() as ContentResult)
                .ShouldNotBeNull()
                .Content.ShouldEqual("42");
        }
        public void It_should_allow_access_to_the_User()
        {
            var controllerSpec = new ControllerSpec<MonkeyController>();
            controllerSpec.User.SetupGet(i => i.IsAuthenticated).Returns(true);

            var controller = controllerSpec.Build();

            (controller.Login() as ViewResult)
                .ShouldNotBeNull()
                .ViewName.ShouldEqual("LoggedIn");
        }
        public void It_should_provide_access_to_injected_dependencies()
        {
            var controllerSpec = new ControllerSpec<MonkeyController>();
            controllerSpec.The<ISomeDependency>().Setup(d => d.LookupValue(It.IsAny<int>()))
                .Returns("Monkeys!!");

            var result = controllerSpec.Build().DependencyLookup(42) as ContentResult;

            result.ShouldNotBeNull()
                .Content.ShouldEqual("Monkeys!!");
        }