Пример #1
0
        public void CanARoleBeUpdated()
        {
            var maxid = _testRepo.FindAll().Min(m => m.roleid);

            Role a = new Role()
            {
                roleid = maxid,
                title  = $"Some text from text from test{maxid}",

                permissions = new List <RolePermissions>(),
            };

            a.permissions.Add(new RolePermissions()
            {
                keyid = "Some Role Name",
                value = "Some value to the role name"
            }
                              );
            a.permissions.Add(new RolePermissions()
            {
                keyid = "Some other Role Name",
                value = "Some other value to the role name"
            }
                              );
            _testRepo.Update(a);


            var updatedRole = _testRepo.FindByID(maxid);

            Assert.AreEqual(a.title, updatedRole.title);
        }
Пример #2
0
 public IActionResult GetRole(int id)
 {
     return(Ok(RoleRepo.FindByID(id)));
 }