Ejemplo n.º 1
0
        public void GivenInvalidPermissions_ReturnsEmptyResult()
        {
            var controller = new HomeController(Db, Cache, Metrics);

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

            var result = controller.Profiler() as EmptyResult;
            result.Should().Not.Be.Null();
        }
Ejemplo n.º 2
0
        public void GivenAnonymousUser_ReturnsEmptyResult()
        {
            var controller = new HomeController(Db, Cache, Metrics);

            ControllerUtilities.SetupControllerContext(controller);

            var result = controller.Profiler() as EmptyResult;
            result.Should().Not.Be.Null();
        }
Ejemplo n.º 3
0
        public void GivenValidPermissions_ReturnsStringResult()
        {
            var controller = new HomeController(Db, Cache, Metrics);

            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();
        }