Exemplo n.º 1
0
        public async Task GetUserRights()
        {
            var userId = _dbFaker.UserRights.First().UserId;

            var response = await _securityData.GetUserRights(userId);

            var expected = _mapper.Map <Models.UserRights>(_dbFaker.UserRights.SingleOrDefault(l => l.UserId == userId));

            Assert.AreEqual(ActionStatus.Success, response.Status);
            CollectionAssert.AreEqual(expected.AccessRights, response.UserRights.AccessRights, new AccessRightComparer());
            CollectionAssert.AreEqual(expected.DeniedRights, response.UserRights.DeniedRights, new AccessRightComparer());
            CollectionAssert.AreEqual(expected.AccessFunctions, response.UserRights.AccessFunctions, new FunctionComparer());
            CollectionAssert.AreEqual(expected.Roles, response.UserRights.Roles, new RoleComparer());
            _mock.Verify(data => data.GetUserRights(It.Is <string>(i => i == userId)), () => Times.Exactly(1));
        }
Exemplo n.º 2
0
 public IEnumerable <UserRight> GetUserRights(int id)
 {
     return(_logic.GetUserRights(id).ToList());
 }
Exemplo n.º 3
0
        public async Task <IActionResult> GetUserRights(string id)
        {
            var result = _securityService.GetUserRights(id);

            return(Ok(await result));
        }