示例#1
0
            public void WhenPostCreateUserAccount_ThenManagerReturnsUserAccount()
            {
                var response = new CreateUserAccountResponse();

                this.useraccountsManager.Setup(man => man.CreateUserAccount(It.IsAny <IRequest>(), It.IsAny <CreateUserAccount>()))
                .Returns(response);

                var result = this.service.Post(new CreateUserAccount());

                this.useraccountsManager.Verify(man => man.CreateUserAccount(It.IsAny <IRequest>(), It.IsAny <CreateUserAccount>()), Times.Once());
                Assert.Equal(response, result);
            }
示例#2
0
            private static UserAccount CreateUserAccount(ServiceClient client, string username, bool hasPassword)
            {
                // Create the account
                client.CurrentUser = Clients.Test.ClientUserAccount.AuthInfo.Username;
                CreateUserAccountResponse result = client.Post(new CreateUserAccount
                {
                    Address = new Address {
                        Town = "atown"
                    },
                    Email        = username + "@test.com",
                    Forenames    = username.Replace(".", string.Empty),
                    Surname      = username.Replace(".", string.Empty),
                    Username     = (hasPassword) ? username : null,
                    PasswordHash = (hasPassword) ? PasswordHasher.CreateHash("apassword") : null,
                });

                return(result.UserAccount);
            }
示例#3
0
 /// <summary>
 ///     Returns the Identifier of the newly created 'UserAccounts' resource.
 /// </summary>
 protected string GetCreateUserAccountResponseId(CreateUserAccountResponse response)
 {
     return((response.UserAccount != null) ? response.UserAccount.Id : null);
 }