Exemplo n.º 1
0
        public void RoleManagePermissions_redirects_to_permissions_view()
        {
            //Arrange
            var controller = new RolesController(_configuration, _contextAccessor);

            //Act
            var result = controller.RoleManagePermissions(Guid.NewGuid().ToString(), "RoleName");

            //Assert
            var redirectResult = Assert.IsType <RedirectToActionResult>(result); //Asserting that the return is a View

            Assert.Equal("Permissions", redirectResult.ControllerName);          //Asserting that the returned Controller is "Permissions"
            Assert.Equal("FetchPermissions", redirectResult.ActionName);         //Asserting that the Action Methond of the controller is "FetchPermissions"
        }
Exemplo n.º 2
0
        public void RoleManagePermissions_redirects_to_permissions_view_when_rolename_is_null()
        {
            //Arrange
            var controller = new RolesController(_bosAuthClient);

            //Act
            var result = controller.RoleManagePermissions(null, null);

            //Assert
            var redirectResult = Assert.IsType <RedirectToActionResult>(result); //Asserting that the return is a View

            Assert.Equal("Permissions", redirectResult.ControllerName);          //Asserting that the returned Controller is "Permissions"
            Assert.Equal("FetchPermissions", redirectResult.ActionName);         //Asserting that the Action Methond of the controller is "FetchPermissions"
        }