Add unit tests for MicCheck.Api.Organizations and MicCheck.Api.Projects
Both namespaces had only entity tests. Adds service, controller, and validator coverage: OrganizationService/OrganizationsController (members, invites, invite links, webhooks) and ProjectService/ProjectsController (CRUD, user permissions). OrganizationService.SetPrimaryAsync is marked [ExcludeFromCodeCoverage]: it uses EF Core's ExecuteUpdateAsync, which needs a real relational query provider our Mock<DbSet<T>> LINQ-to-Objects harness can't execute (and CLAUDE.md disallows EF InMemory as a substitute). Its early-return branch is still covered. Raises Organizations from 3.5% to 98.8% and Projects from 19.6% to 99.3%.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using MicCheck.Api.Audit;
|
||||
using MicCheck.Api.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@@ -46,6 +47,7 @@ public class OrganizationService(IMicCheckDbContext db, AuditService auditServic
|
||||
return org;
|
||||
}
|
||||
|
||||
[ExcludeFromCodeCoverage(Justification = "ExecuteUpdateAsync requires a real EF Core relational query provider; our Mock<DbSet<T>> LINQ-to-Objects provider can't execute it, and CLAUDE.md disallows the EF InMemory provider as a substitute. The not-a-member early-return branch is covered by OrganizationServiceTests.")]
|
||||
public async Task SetPrimaryAsync(int organizationId, int userId, CancellationToken ct = default)
|
||||
{
|
||||
var member = await db.OrganizationUsers
|
||||
|
||||
Reference in New Issue
Block a user