Пример #1
0
        public void AccessDenied_shows_correct_view()
        {
            var result = _controller.AccessDenied() as ViewResult;

            Assert.That(result, Is.Not.Null);
            Assert.AreEqual("AccessDenied", result.ViewName);
        }
Пример #2
0
        public void CheckAccessDenied_GetAccessDeniedView()
        {
            var controller = new AccountController(userContext.Object, signContext.Object);

            var res = controller.AccessDenied() as ViewResult;

            Assert.AreEqual("AccessDenied", res.ViewName);
        }
        public void AccessDeniedGet_ReturnAViewResult()
        {
            // Arrange
            var controller = new AccountController(userManager, signInManager);

            // Act
            var result = controller.AccessDenied();

            // Assert
            var viewResult = Assert.IsType <ViewResult>(result);
        }
Пример #4
0
        public void AccessDenied_RedirectsToAction()
        {
            //Arrange
            controller.ControllerContext.HttpContext = new DefaultHttpContext();

            //Act
            var result = controller.AccessDenied();

            //Assert
            Assert.IsType <RedirectToActionResult>(result);
        }
        public void AccessDenied_ReturnsViewResult()
        {
            // Arrange
            using var controller = new AccountController(this._accountServiceMock.Object, this._loggerMock.Object);

            // Act
            var result = controller.AccessDenied();

            // Assert
            var viewResult = Assert.IsType <ViewResult>(result);

            Assert.Null(viewResult.Model);
        }
Пример #6
0
        public void Access_Denied_Return_View(AccountController controller, IActionResult result, ViewResult viewResult)
        {
            "Given the account controller"
            .x(() => controller = CreateAccountController());

            "When I enter to access denied"
            .x(() => result = controller.AccessDenied());

            "Then the result is a ViewResult"
            .x(() => viewResult = Assert.IsType <ViewResult>(result));

            "And the view is AccessDenied"
            .x(() => Assert.Equal("AccessDenied", viewResult.ViewName));
        }
Пример #7
0
        public void AccessDenied_Get()
        {
            var context = MakeContext();

            var controller = new AccountController(
                context.UsersDao,
                context.BranchesDao,
                context.CarsDao,
                context.CurrentUserService)
            {
                TempData = context.TempDataDictionary
            };

            var r = controller.AccessDenied() as ViewResult;

            Assert.NotNull(r);
            Assert.Null(r.ViewName);
        }
Пример #8
0
        public void AccessDenied_Test()
        {
            var result = accountController.AccessDenied() as ViewResult;

            Assert.AreEqual("AccessDenied", result.ViewName);
        }
 public void AccessDenied_ReturnsAccessDeniedView()
 {
     var result = Assert.IsType <ViewResult>(_accountController.AccessDenied());
 }
Пример #10
0
        public void AccessDenied_ReturnsViewResult_WhenSucceeded()
        {
            var result = _accountController.AccessDenied();

            Assert.IsType <ViewResult>(result);
        }
Пример #11
0
        public void AccessDenied_ShouldReturnIActionResult_WhenReturnUrl()
        {
            var result = _accountController.AccessDenied("returnUrl") as IActionResult;

            Assert.NotNull(result);
        }