Migrate from User to Account domain concept
Renames core domain entities and services from "User" to "Account" Refactors project-wide namespaces, classes, and database tables to use "Account" terminology Updates related components, services, and database schema to reflect new domain naming Standardizes naming conventions across authentication and organization setup features
This commit is contained in:
parent
e5e7c1c19f
commit
88812177a9
29 changed files with 288 additions and 298 deletions
|
|
@ -5,40 +5,41 @@ using PlanTempus.X.Services;
|
|||
using Shouldly;
|
||||
|
||||
namespace PlanTempus.X.BDD.FeatureFixtures;
|
||||
[TestClass]
|
||||
|
||||
[TestClass]
|
||||
[FeatureDescription(@"As a registered user
|
||||
I want to confirm my email
|
||||
So I can activate my account")]
|
||||
public partial class EmailConfirmationSpecs : FeatureFixture
|
||||
{
|
||||
IUserService _userService;
|
||||
IAccountService _accountService;
|
||||
IEmailService _emailService;
|
||||
IOrganizationService _organizationService;
|
||||
|
||||
protected User _currentUser;
|
||||
protected Account _currentAccount;
|
||||
protected string _currentEmail;
|
||||
protected string _confirmationLink;
|
||||
protected bool _redirectedToWelcome;
|
||||
protected string _errorMessage;
|
||||
|
||||
public async Task Given_a_user_exists_with_unconfirmed_email(string email)
|
||||
public async Task Given_an_account_exists_with_unconfirmed_email(string email)
|
||||
{
|
||||
_currentUser = await _userService.CreateUserAsync(email, "Test User");
|
||||
_currentUser.EmailConfirmed.ShouldBeFalse();
|
||||
_currentAccount = await _accountService.CreateAccountAsync(email, "TestPassword123!");
|
||||
_currentAccount.EmailConfirmed.ShouldBeFalse();
|
||||
_currentEmail = email;
|
||||
}
|
||||
|
||||
public async Task When_I_click_the_valid_confirmation_link_for(string email)
|
||||
{
|
||||
_confirmationLink = await _emailService.GetConfirmationLinkForEmail(email);
|
||||
await _userService.ConfirmEmailAsync(_confirmationLink);
|
||||
await _accountService.ConfirmEmailAsync(_confirmationLink);
|
||||
_redirectedToWelcome = true; // Simulate redirect
|
||||
}
|
||||
|
||||
public async Task Then_the_users_email_confirmed_should_be_true()
|
||||
public async Task Then_the_accounts_email_confirmed_should_be_true()
|
||||
{
|
||||
_currentUser = _userService.GetUserByEmail(_currentEmail);
|
||||
_currentUser.EmailConfirmed.ShouldBeTrue();
|
||||
_currentAccount = _accountService.GetAccountByEmail(_currentEmail);
|
||||
_currentAccount.EmailConfirmed.ShouldBeTrue();
|
||||
}
|
||||
|
||||
public async Task And_I_should_be_redirected_to_the_welcome_page()
|
||||
|
|
@ -50,7 +51,7 @@ public partial class EmailConfirmationSpecs : FeatureFixture
|
|||
{
|
||||
try
|
||||
{
|
||||
await _userService.ConfirmEmailAsync("invalid-confirmation-token");
|
||||
await _accountService.ConfirmEmailAsync("invalid-confirmation-token");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
@ -65,9 +66,9 @@ public partial class EmailConfirmationSpecs : FeatureFixture
|
|||
|
||||
public async Task And_my_email_remains_unconfirmed()
|
||||
{
|
||||
if (_currentUser != null)
|
||||
if (_currentAccount != null)
|
||||
{
|
||||
_currentUser.EmailConfirmed.ShouldBeFalse();
|
||||
_currentAccount.EmailConfirmed.ShouldBeFalse();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue