Пример #1
0
        public void Repo_Users_CreateV1_Success()
        {
            var result = UoW.Users.Create(
                Mapper.Map <tbl_User>(new UserV1()
            {
                UserName     = TestDefaultConstants.UserName,
                Email        = TestDefaultConstants.UserName,
                PhoneNumber  = NumberAs.CreateString(11),
                FirstName    = "First-" + Base64.CreateString(4),
                LastName     = "Last-" + Base64.CreateString(4),
                IsLockedOut  = false,
                IsHumanBeing = true,
                IsDeletable  = false,
            }));

            UoW.Commit();

            result.Should().BeAssignableTo <tbl_User>();
        }
Пример #2
0
        public void CreateUsers()
        {
            /*
             * create test users
             */

            foundUser = _uow.Users.Get(QueryExpressionFactory.GetQueryExpression <tbl_User>()
                                       .Where(x => x.UserName == TestDefaultConstants.UserName).ToLambda())
                        .SingleOrDefault();

            if (foundUser == null)
            {
                foundUser = _uow.Users.Create(
                    _map.Map <tbl_User>(new UserV1()
                {
                    UserName     = TestDefaultConstants.UserName,
                    Email        = TestDefaultConstants.UserName,
                    PhoneNumber  = NumberAs.CreateString(11),
                    FirstName    = "First-" + AlphaNumeric.CreateString(4),
                    LastName     = "Last-" + AlphaNumeric.CreateString(4),
                    IsHumanBeing = true,
                    IsLockedOut  = false,
                    IsDeletable  = true,
                }), TestDefaultConstants.UserPassCurrent);

                _uow.Commit();

                _uow.AuthActivity.Create(
                    _map.Map <tbl_AuthActivity>(new AuthActivityV1()
                {
                    UserId       = foundUser.Id,
                    LoginType    = GrantFlowType.ResourceOwnerPasswordV2.ToString(),
                    LoginOutcome = GrantFlowResultType.Success.ToString(),
                }));

                _uow.Users.SetConfirmedEmail(foundUser, true);
                _uow.Users.SetConfirmedPhoneNumber(foundUser, true);
                _uow.Users.SetConfirmedPassword(foundUser, true);

                _uow.Commit();
            }
        }