Переписаны модули, тесты, обработка ошибок
This commit is contained in:
@@ -10,12 +10,12 @@ public class AccountTests
|
||||
[Fact]
|
||||
public void Create_Should_Create_Account_With_User_Role()
|
||||
{
|
||||
// Arrange & Act
|
||||
// Arrange & Act (Подготовка и Действие)
|
||||
var phone = "1234567890";
|
||||
var passwordHash = "hash";
|
||||
var account = Account.Create(phone, passwordHash);
|
||||
|
||||
// Assert
|
||||
// Assert (Проверка)
|
||||
account.Should().NotBeNull();
|
||||
account.Roles.Should().ContainSingle(r => r == Role.User);
|
||||
account.Roles.Should().HaveCount(1);
|
||||
@@ -24,13 +24,13 @@ public class AccountTests
|
||||
[Fact]
|
||||
public void BecomePerformer_Should_Add_Candidate_Role()
|
||||
{
|
||||
// Arrange
|
||||
// Arrange (Подготовка)
|
||||
var account = Account.Create("123", "hash");
|
||||
|
||||
// Act
|
||||
// Act (Действие)
|
||||
account.BecomePerformer();
|
||||
|
||||
// Assert
|
||||
// Assert (Проверка)
|
||||
account.Roles.Should().Contain(Role.Candidate);
|
||||
account.Roles.Should().Contain(Role.User);
|
||||
account.Roles.Should().HaveCount(2); // User + Candidate
|
||||
@@ -39,14 +39,14 @@ public class AccountTests
|
||||
[Fact]
|
||||
public void BecomePerformer_Should_Do_Nothing_If_Already_Candidate()
|
||||
{
|
||||
// Arrange
|
||||
// Arrange (Подготовка)
|
||||
var account = Account.Create("123", "hash");
|
||||
account.BecomePerformer();
|
||||
|
||||
// Act
|
||||
// Act (Действие)
|
||||
account.BecomePerformer();
|
||||
|
||||
// Assert
|
||||
// Assert (Проверка)
|
||||
account.Roles.Should().ContainSingle(r => r == Role.Candidate);
|
||||
account.Roles.Should().HaveCount(2);
|
||||
}
|
||||
@@ -54,14 +54,14 @@ public class AccountTests
|
||||
[Fact]
|
||||
public void PromoteToMaster_Should_Replace_Candidate_With_Master()
|
||||
{
|
||||
// Arrange
|
||||
// Arrange (Подготовка)
|
||||
var account = Account.Create("123", "hash");
|
||||
account.BecomePerformer(); // Has Candidate
|
||||
|
||||
// Act
|
||||
// Act (Действие)
|
||||
account.PromoteToMaster();
|
||||
|
||||
// Assert
|
||||
// Assert (Проверка)
|
||||
account.Roles.Should().NotContain(Role.Candidate);
|
||||
account.Roles.Should().Contain(Role.Master);
|
||||
account.Roles.Should().Contain(Role.User);
|
||||
|
||||
Reference in New Issue
Block a user