コード例 #1
0
        public override void Setup()
        {
            base.Setup();

            Controller = new HomeController(Session, Metrics);
            ControllerUtilities.SetupControllerContext(Controller);
        }
コード例 #2
0
        public override void Setup()
        {
            base.Setup();

            Controller = new HomeController(Db, Metrics, Cache);
            ControllerUtilities.SetupControllerContext(Controller);
        }
コード例 #3
0
        public void GivenInvalidPermissions_ReturnsEmptyResult()
        {
            var controller = new HomeController(Db, Metrics, Cache);

            ControllerUtilities.SetupControllerContext(controller, new User { Username = "******" });

            var result = controller.Profiler() as EmptyResult;
            result.Should().Not.Be.Null();
        }
コード例 #4
0
        public void GivenAnonymousUser_ReturnsEmptyResult()
        {
            var controller = new HomeController(Db, Metrics, Cache);

            ControllerUtilities.SetupControllerContext(controller);

            var result = controller.Profiler() as EmptyResult;
            result.Should().Not.Be.Null();
        }
コード例 #5
0
        public void GivenValidPermissions_ReturnsStringResult()
        {
            var controller = new HomeController(Db, Metrics, Cache);

            ControllerUtilities.SetupControllerContext(controller, new User
                                                                       {
                                                                           Username = "******",
                                                                           IsAdmin = true
                                                                       });

            // I check for thrown exception, rather than a ViewResult because raven profiler uses HttpContext, which cannot be mocked.
            //Assert.Throws<ArgumentNullException>(() => controller.Profiler());
            var result = controller.Profiler() as ContentResult;
            result.Should().Not.Be.Null();
        }