예제 #1
0
        private async Task <int> assignRole(IHubActionTester tester, AppUser user, AppRole role)
        {
            var assignRoleTester = tester.Create(hubApi => hubApi.AppUserMaintenance.AssignRole);
            var adminUser        = await assignRoleTester.AdminUser();

            var hubAppModifier = await tester.HubAppModifier();

            var userRoleID = await assignRoleTester.Execute(new UserRoleRequest
            {
                UserID = user.ID.Value,
                RoleID = role.ID.Value
            }, adminUser, hubAppModifier.ModKey());

            return(userRoleID);
        }
        private async Task <AppUser> addUser(IHubActionTester tester, string userName)
        {
            var addUserTester = tester.Create(hubApi => hubApi.Users.AddUser);
            var adminUser     = await addUserTester.AdminUser();

            var userID = await addUserTester.Execute(new AddUserModel
            {
                UserName = userName,
                Password = "******"
            }, adminUser);

            var factory = tester.Services.GetService <AppFactory>();
            var user    = await factory.Users().User(new AppUserName(userName));

            return(user);
        }