Esempio n. 1
0
        public void GivenTheFollowingUserRolesAreSetupInTheSystemForUser(string userName, Table table)
        {
            var user      = SeDatabase.GetUsers().Single(a => a.UserName == userName);
            var userRoles = new List <UserRole>();

            foreach (var row in table.Rows)
            {
                var role     = SeDatabase.GetRoleByName(row[0]);
                var userRole = new UserRole
                {
                    UserId = user.Id,
                    RoleId = role.Id
                };
                userRoles.Add(userRole);
            }
            SeDatabase.SetUserRoles(userRoles);
        }