public void SetPasswordByAdminId_should_set_password_correctly() { using var transaction = new TransactionScope(); // Given const string?password = "******"; const int adminId = 1; // When passwordDataService.SetPasswordByAdminId(adminId, password); var result = userDataService.GetAdminUserById(1) !.Password; // Then result.Should().Be(password); }
public async Task Setting_password_by_email_sets_password_for_matching_admins() { using var transaction = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled); // Given var existingAdminUser = UserTestHelper.GetDefaultAdminUser(); var newPasswordHash = PasswordHashNotYetInDb; // When await passwordDataService.SetPasswordByEmailAsync(existingAdminUser.EmailAddress !, newPasswordHash); // Then userDataService.GetAdminUserById(existingAdminUser.Id)?.Password.Should() .Be(PasswordHashNotYetInDb); }
public async Task Removing_reset_hash_sets_ResetPasswordId_to_null_for_admin_user() { using var transactionScope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled); // Given var userId = UserTestHelper.GetDefaultAdminUser().Id; var userRef = new UserReference(userId, UserType.AdminUser); var resetPasswordId = await GivenResetPasswordWithHashExistsForUsersAsync(HashNotYetInDb, new[] { userRef }); // When await service.RemoveResetPasswordAsync(resetPasswordId); // Then var userAfterRemoval = userDataService.GetAdminUserById(userId); userAfterRemoval.Should().NotBeNull(); userAfterRemoval?.ResetPasswordId.Should().BeNull(); }