test(backend): Fix all compilation errors in Domain.Tests after Day 15 multi-tenant changes
Fixed 73 compilation errors caused by Epic/Story/WorkTask.Create() now requiring TenantId parameter. Changes: - Created TestDataBuilder helper class for test data creation - Updated EpicTests.cs: Added TenantId to all Epic.Create() calls (10 tests) - Updated StoryTests.cs: Added TenantId to all Story.Create() calls (26 tests) - Updated WorkTaskTests.cs: Added TenantId to all WorkTask.Create() calls (37 tests) - Added using ColaFlow.Domain.Tests.Builders to all test files Test Results: - Build: 0 errors, 9 warnings (xUnit analyzer warnings only) - Tests: 192/192 passed in ColaFlow.Domain.Tests - Full Suite: 427/431 passed (4 skipped as expected) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using ColaFlow.Modules.ProjectManagement.Domain.Aggregates.ProjectAggregate;
|
||||
using ColaFlow.Modules.ProjectManagement.Domain.ValueObjects;
|
||||
using ColaFlow.Modules.ProjectManagement.Domain.Exceptions;
|
||||
using ColaFlow.Domain.Tests.Builders;
|
||||
using FluentAssertions;
|
||||
|
||||
namespace ColaFlow.Domain.Tests.Aggregates;
|
||||
@@ -16,16 +17,18 @@ public class EpicTests
|
||||
public void Create_WithValidData_ShouldCreateEpic()
|
||||
{
|
||||
// Arrange
|
||||
var tenantId = TestDataBuilder.CreateTestTenantId();
|
||||
var name = "Epic 1";
|
||||
var description = "Epic Description";
|
||||
var projectId = ProjectId.Create();
|
||||
var createdBy = UserId.Create();
|
||||
|
||||
// Act
|
||||
var epic = Epic.Create(name, description, projectId, createdBy);
|
||||
var epic = Epic.Create(tenantId, name, description, projectId, createdBy);
|
||||
|
||||
// Assert
|
||||
epic.Should().NotBeNull();
|
||||
epic.TenantId.Should().Be(tenantId);
|
||||
epic.Name.Should().Be(name);
|
||||
epic.Description.Should().Be(description);
|
||||
epic.ProjectId.Should().Be(projectId);
|
||||
@@ -41,13 +44,14 @@ public class EpicTests
|
||||
public void Create_WithNullDescription_ShouldCreateEpicWithEmptyDescription()
|
||||
{
|
||||
// Arrange
|
||||
var tenantId = TestDataBuilder.CreateTestTenantId();
|
||||
var name = "Epic 1";
|
||||
string? description = null;
|
||||
var projectId = ProjectId.Create();
|
||||
var createdBy = UserId.Create();
|
||||
|
||||
// Act
|
||||
var epic = Epic.Create(name, description!, projectId, createdBy);
|
||||
var epic = Epic.Create(tenantId, name, description!, projectId, createdBy);
|
||||
|
||||
// Assert
|
||||
epic.Should().NotBeNull();
|
||||
@@ -61,11 +65,12 @@ public class EpicTests
|
||||
public void Create_WithEmptyName_ShouldThrowDomainException(string invalidName)
|
||||
{
|
||||
// Arrange
|
||||
var tenantId = TestDataBuilder.CreateTestTenantId();
|
||||
var projectId = ProjectId.Create();
|
||||
var createdBy = UserId.Create();
|
||||
|
||||
// Act
|
||||
Action act = () => Epic.Create(invalidName, "Description", projectId, createdBy);
|
||||
Action act = () => Epic.Create(tenantId, invalidName, "Description", projectId, createdBy);
|
||||
|
||||
// Assert
|
||||
act.Should().Throw<DomainException>()
|
||||
@@ -76,12 +81,13 @@ public class EpicTests
|
||||
public void Create_WithNameExceeding200Characters_ShouldThrowDomainException()
|
||||
{
|
||||
// Arrange
|
||||
var tenantId = TestDataBuilder.CreateTestTenantId();
|
||||
var name = new string('A', 201);
|
||||
var projectId = ProjectId.Create();
|
||||
var createdBy = UserId.Create();
|
||||
|
||||
// Act
|
||||
Action act = () => Epic.Create(name, "Description", projectId, createdBy);
|
||||
Action act = () => Epic.Create(tenantId, name, "Description", projectId, createdBy);
|
||||
|
||||
// Assert
|
||||
act.Should().Throw<DomainException>()
|
||||
@@ -92,12 +98,13 @@ public class EpicTests
|
||||
public void Create_WithNameExactly200Characters_ShouldSucceed()
|
||||
{
|
||||
// Arrange
|
||||
var tenantId = TestDataBuilder.CreateTestTenantId();
|
||||
var name = new string('A', 200);
|
||||
var projectId = ProjectId.Create();
|
||||
var createdBy = UserId.Create();
|
||||
|
||||
// Act
|
||||
var epic = Epic.Create(name, "Description", projectId, createdBy);
|
||||
var epic = Epic.Create(tenantId, name, "Description", projectId, createdBy);
|
||||
|
||||
// Assert
|
||||
epic.Should().NotBeNull();
|
||||
@@ -112,7 +119,8 @@ public class EpicTests
|
||||
public void CreateStory_WithValidData_ShouldCreateStory()
|
||||
{
|
||||
// Arrange
|
||||
var epic = Epic.Create("Epic 1", "Description", ProjectId.Create(), UserId.Create());
|
||||
var tenantId = TestDataBuilder.CreateTestTenantId();
|
||||
var epic = Epic.Create(tenantId, "Epic 1", "Description", ProjectId.Create(), UserId.Create());
|
||||
var storyTitle = "Story 1";
|
||||
var storyDescription = "Story Description";
|
||||
var priority = TaskPriority.High;
|
||||
@@ -136,7 +144,8 @@ public class EpicTests
|
||||
public void CreateStory_MultipleStories_ShouldAddToCollection()
|
||||
{
|
||||
// Arrange
|
||||
var epic = Epic.Create("Epic 1", "Description", ProjectId.Create(), UserId.Create());
|
||||
var tenantId = TestDataBuilder.CreateTestTenantId();
|
||||
var epic = Epic.Create(tenantId, "Epic 1", "Description", ProjectId.Create(), UserId.Create());
|
||||
var createdBy = UserId.Create();
|
||||
|
||||
// Act
|
||||
@@ -157,7 +166,8 @@ public class EpicTests
|
||||
public void UpdateDetails_WithValidData_ShouldUpdateEpic()
|
||||
{
|
||||
// Arrange
|
||||
var epic = Epic.Create("Original Name", "Original Description", ProjectId.Create(), UserId.Create());
|
||||
var tenantId = TestDataBuilder.CreateTestTenantId();
|
||||
var epic = Epic.Create(tenantId, "Original Name", "Original Description", ProjectId.Create(), UserId.Create());
|
||||
var originalCreatedAt = epic.CreatedAt;
|
||||
var newName = "Updated Name";
|
||||
var newDescription = "Updated Description";
|
||||
@@ -177,7 +187,8 @@ public class EpicTests
|
||||
public void UpdateDetails_WithNullDescription_ShouldSetEmptyDescription()
|
||||
{
|
||||
// Arrange
|
||||
var epic = Epic.Create("Original Name", "Original Description", ProjectId.Create(), UserId.Create());
|
||||
var tenantId = TestDataBuilder.CreateTestTenantId();
|
||||
var epic = Epic.Create(tenantId, "Original Name", "Original Description", ProjectId.Create(), UserId.Create());
|
||||
|
||||
// Act
|
||||
epic.UpdateDetails("Updated Name", null!);
|
||||
@@ -193,7 +204,8 @@ public class EpicTests
|
||||
public void UpdateDetails_WithEmptyName_ShouldThrowDomainException(string invalidName)
|
||||
{
|
||||
// Arrange
|
||||
var epic = Epic.Create("Original Name", "Original Description", ProjectId.Create(), UserId.Create());
|
||||
var tenantId = TestDataBuilder.CreateTestTenantId();
|
||||
var epic = Epic.Create(tenantId, "Original Name", "Original Description", ProjectId.Create(), UserId.Create());
|
||||
|
||||
// Act
|
||||
Action act = () => epic.UpdateDetails(invalidName, "Updated Description");
|
||||
@@ -207,7 +219,8 @@ public class EpicTests
|
||||
public void UpdateDetails_WithNameExceeding200Characters_ShouldThrowDomainException()
|
||||
{
|
||||
// Arrange
|
||||
var epic = Epic.Create("Original Name", "Original Description", ProjectId.Create(), UserId.Create());
|
||||
var tenantId = TestDataBuilder.CreateTestTenantId();
|
||||
var epic = Epic.Create(tenantId, "Original Name", "Original Description", ProjectId.Create(), UserId.Create());
|
||||
var name = new string('A', 201);
|
||||
|
||||
// Act
|
||||
@@ -226,7 +239,8 @@ public class EpicTests
|
||||
public void UpdateStatus_WithValidStatus_ShouldUpdateStatus()
|
||||
{
|
||||
// Arrange
|
||||
var epic = Epic.Create("Epic 1", "Description", ProjectId.Create(), UserId.Create());
|
||||
var tenantId = TestDataBuilder.CreateTestTenantId();
|
||||
var epic = Epic.Create(tenantId, "Epic 1", "Description", ProjectId.Create(), UserId.Create());
|
||||
var newStatus = WorkItemStatus.InProgress;
|
||||
|
||||
// Act
|
||||
@@ -242,7 +256,8 @@ public class EpicTests
|
||||
public void UpdateStatus_ToAllStatuses_ShouldSucceed()
|
||||
{
|
||||
// Arrange
|
||||
var epic = Epic.Create("Epic 1", "Description", ProjectId.Create(), UserId.Create());
|
||||
var tenantId = TestDataBuilder.CreateTestTenantId();
|
||||
var epic = Epic.Create(tenantId, "Epic 1", "Description", ProjectId.Create(), UserId.Create());
|
||||
|
||||
// Act & Assert
|
||||
epic.UpdateStatus(WorkItemStatus.InProgress);
|
||||
@@ -269,7 +284,8 @@ public class EpicTests
|
||||
public void UpdatePriority_WithValidPriority_ShouldUpdatePriority()
|
||||
{
|
||||
// Arrange
|
||||
var epic = Epic.Create("Epic 1", "Description", ProjectId.Create(), UserId.Create());
|
||||
var tenantId = TestDataBuilder.CreateTestTenantId();
|
||||
var epic = Epic.Create(tenantId, "Epic 1", "Description", ProjectId.Create(), UserId.Create());
|
||||
var newPriority = TaskPriority.Urgent;
|
||||
|
||||
// Act
|
||||
@@ -285,7 +301,8 @@ public class EpicTests
|
||||
public void UpdatePriority_ToAllPriorities_ShouldSucceed()
|
||||
{
|
||||
// Arrange
|
||||
var epic = Epic.Create("Epic 1", "Description", ProjectId.Create(), UserId.Create());
|
||||
var tenantId = TestDataBuilder.CreateTestTenantId();
|
||||
var epic = Epic.Create(tenantId, "Epic 1", "Description", ProjectId.Create(), UserId.Create());
|
||||
|
||||
// Act & Assert
|
||||
epic.UpdatePriority(TaskPriority.Low);
|
||||
@@ -309,7 +326,8 @@ public class EpicTests
|
||||
public void Stories_Collection_ShouldBeReadOnly()
|
||||
{
|
||||
// Arrange
|
||||
var epic = Epic.Create("Epic 1", "Description", ProjectId.Create(), UserId.Create());
|
||||
var tenantId = TestDataBuilder.CreateTestTenantId();
|
||||
var epic = Epic.Create(tenantId, "Epic 1", "Description", ProjectId.Create(), UserId.Create());
|
||||
|
||||
// Act & Assert
|
||||
epic.Stories.Should().BeAssignableTo<IReadOnlyCollection<Story>>();
|
||||
@@ -319,10 +337,11 @@ public class EpicTests
|
||||
public void Epic_ShouldHaveUniqueId()
|
||||
{
|
||||
// Arrange & Act
|
||||
var tenantId = TestDataBuilder.CreateTestTenantId();
|
||||
var projectId = ProjectId.Create();
|
||||
var createdBy = UserId.Create();
|
||||
var epic1 = Epic.Create("Epic 1", "Description", projectId, createdBy);
|
||||
var epic2 = Epic.Create("Epic 2", "Description", projectId, createdBy);
|
||||
var epic1 = Epic.Create(tenantId, "Epic 1", "Description", projectId, createdBy);
|
||||
var epic2 = Epic.Create(tenantId, "Epic 2", "Description", projectId, createdBy);
|
||||
|
||||
// Assert
|
||||
epic1.Id.Should().NotBe(epic2.Id);
|
||||
|
||||
Reference in New Issue
Block a user