Exemplo n.º 1
0
        public async Task ChangeUserPasswordCommand_UserPasswordAndSaltChanged()
        {
            // Arrange
            const string        userName           = "******";
            Guid                userId             = Guid.NewGuid();
            const string        userPassword       = "******";
            const string        passwordSalt       = "SaltySalt";
            User                user               = new User(userId, userName, "Dirk", "Gently", "*****@*****.**", userPassword, passwordSalt, "555-1234");
            IAccountsRepository accountsRepository = _container.Resolve <IAccountsRepository>();
            await accountsRepository.Add(user);

            // Act
            ICommandBus  commandBus  = _container.Resolve <ICommandBus>();
            const string newPassword = "******";
            await commandBus.Send(new ChangeUserPasswordCommand
            {
                UserId   = userId,
                Password = newPassword
            });

            IAccountsPerspective        accountsPerspective = _container.Resolve <IAccountsPerspective>();
            AccountWithCredentialsModel userWithCredentials = await accountsPerspective.GetUserWithCredentials(userName);

            // Assert
            userWithCredentials.PasswordHash
            .Should().NotBeNullOrWhiteSpace("Password should be hashed and contained")
            .And.NotBe(userPassword)
            .And.NotBe(newPassword);

            userWithCredentials.PasswordSalt
            .Should().NotBeEmpty()
            .And.NotBe(passwordSalt);
        }
Exemplo n.º 2
0
 public GetAccountHandler(IAccountsPerspective perspective)
 {
     _perspective = perspective;
 }