Переписаны модули, тесты, обработка ошибок

This commit is contained in:
Халимов Рустам
2026-03-10 21:08:03 +03:00
parent 5c9c6ab975
commit 4e06e48657
126 changed files with 6549 additions and 803 deletions
@@ -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);