public override void Setup() { base.Setup(); Controller = new HomeController(Session, Metrics); ControllerUtilities.SetupControllerContext(Controller); }
public override void Setup() { base.Setup(); Controller = new HomeController(Db, Metrics, Cache); ControllerUtilities.SetupControllerContext(Controller); }
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(); }
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(); }
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(); }