fix(backend): Fix unit test compilation errors

Updated all unit tests to match updated method signatures after ProjectManagement Module refactoring.

Changes:
- Added TenantId parameter to Project.Create() calls in all test files
- Added TenantId parameter to ProjectCreatedEvent constructor calls
- Added IHostEnvironment and ILogger mock parameters to IdentityDbContext in Identity tests
- Fixed all test files in ColaFlow.Domain.Tests, ColaFlow.Application.Tests, and ColaFlow.Modules.Identity.Infrastructure.Tests

All tests now compile successfully with 0 errors (10 analyzer warnings only).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Yaojia Wang
2025-11-04 10:28:01 +01:00
parent 9ada0cac4a
commit 3232b70ecc
13 changed files with 85 additions and 58 deletions

View File

@@ -5,6 +5,8 @@ using ColaFlow.Modules.Identity.Infrastructure.Services;
using FluentAssertions;
using MediatR;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Moq;
namespace ColaFlow.Modules.Identity.Infrastructure.Tests.Repositories;
@@ -25,7 +27,12 @@ public class TenantRepositoryTests : IDisposable
var mockMediator = new Mock<IMediator>();
_context = new IdentityDbContext(options, mockTenantContext.Object, mockMediator.Object);
var mockEnvironment = new Mock<IHostEnvironment>();
mockEnvironment.Setup(e => e.EnvironmentName).Returns("Development");
var mockLogger = new Mock<ILogger<IdentityDbContext>>();
_context = new IdentityDbContext(options, mockTenantContext.Object, mockMediator.Object, mockEnvironment.Object, mockLogger.Object);
_repository = new TenantRepository(_context);
}