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:
@@ -0,0 +1,99 @@
|
||||
using ColaFlow.Modules.ProjectManagement.Domain.Aggregates.ProjectAggregate;
|
||||
using ColaFlow.Modules.ProjectManagement.Domain.ValueObjects;
|
||||
|
||||
namespace ColaFlow.Domain.Tests.Builders;
|
||||
|
||||
/// <summary>
|
||||
/// Test Data Builder for creating test entities with default values.
|
||||
/// Simplifies test setup by providing consistent test data.
|
||||
/// </summary>
|
||||
public static class TestDataBuilder
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a test TenantId with a random GUID.
|
||||
/// </summary>
|
||||
public static TenantId CreateTestTenantId()
|
||||
=> TenantId.From(Guid.NewGuid());
|
||||
|
||||
/// <summary>
|
||||
/// Creates a test ProjectId with a random GUID.
|
||||
/// </summary>
|
||||
public static ProjectId CreateTestProjectId()
|
||||
=> ProjectId.From(Guid.NewGuid());
|
||||
|
||||
/// <summary>
|
||||
/// Creates a test UserId with a random GUID.
|
||||
/// </summary>
|
||||
public static UserId CreateTestUserId()
|
||||
=> UserId.From(Guid.NewGuid());
|
||||
|
||||
/// <summary>
|
||||
/// Creates a test EpicId with a random GUID.
|
||||
/// </summary>
|
||||
public static EpicId CreateTestEpicId()
|
||||
=> EpicId.Create();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a test StoryId with a random GUID.
|
||||
/// </summary>
|
||||
public static StoryId CreateTestStoryId()
|
||||
=> StoryId.Create();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a test Epic with default or provided values.
|
||||
/// </summary>
|
||||
public static Epic CreateTestEpic(
|
||||
TenantId? tenantId = null,
|
||||
string name = "Test Epic",
|
||||
string description = "Test Epic Description",
|
||||
ProjectId? projectId = null,
|
||||
UserId? createdBy = null)
|
||||
{
|
||||
return Epic.Create(
|
||||
tenantId ?? CreateTestTenantId(),
|
||||
name,
|
||||
description,
|
||||
projectId ?? CreateTestProjectId(),
|
||||
createdBy ?? CreateTestUserId());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a test Story with default or provided values.
|
||||
/// </summary>
|
||||
public static Story CreateTestStory(
|
||||
TenantId? tenantId = null,
|
||||
string title = "Test Story",
|
||||
string description = "Test Story Description",
|
||||
EpicId? epicId = null,
|
||||
TaskPriority? priority = null,
|
||||
UserId? createdBy = null)
|
||||
{
|
||||
return Story.Create(
|
||||
tenantId ?? CreateTestTenantId(),
|
||||
title,
|
||||
description,
|
||||
epicId ?? CreateTestEpicId(),
|
||||
priority ?? TaskPriority.Medium,
|
||||
createdBy ?? CreateTestUserId());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a test WorkTask with default or provided values.
|
||||
/// </summary>
|
||||
public static WorkTask CreateTestTask(
|
||||
TenantId? tenantId = null,
|
||||
string title = "Test Task",
|
||||
string description = "Test Task Description",
|
||||
StoryId? storyId = null,
|
||||
TaskPriority? priority = null,
|
||||
UserId? createdBy = null)
|
||||
{
|
||||
return WorkTask.Create(
|
||||
tenantId ?? CreateTestTenantId(),
|
||||
title,
|
||||
description,
|
||||
storyId ?? CreateTestStoryId(),
|
||||
priority ?? TaskPriority.Medium,
|
||||
createdBy ?? CreateTestUserId());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user