test(expense): assert Form990LineCode projection resolves
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -63,15 +63,18 @@ public class ExpenseCategoryServiceTests
|
|||||||
public async Task CreateAndGet_RoundTrips_Form990LineId()
|
public async Task CreateAndGet_RoundTrips_Form990LineId()
|
||||||
{
|
{
|
||||||
using var db = BuildDb();
|
using var db = BuildDb();
|
||||||
|
db.Form990ExpenseLines.Add(new ROLAC.API.Entities.Form990ExpenseLine { Id = 1, LineCode = "24", Name_en = "Other" });
|
||||||
db.Form990ExpenseLines.Add(new ROLAC.API.Entities.Form990ExpenseLine { Id = 7, LineCode = "7", Name_en = "Salaries" });
|
db.Form990ExpenseLines.Add(new ROLAC.API.Entities.Form990ExpenseLine { Id = 7, LineCode = "7", Name_en = "Salaries" });
|
||||||
await db.SaveChangesAsync();
|
await db.SaveChangesAsync();
|
||||||
var svc = new ExpenseCategoryService(db);
|
var svc = new ExpenseCategoryService(db);
|
||||||
var gid = await svc.CreateGroupAsync(new CreateExpenseGroupRequest { Name_en = "Personnel", Form990LineId = 24 });
|
var gid = await svc.CreateGroupAsync(new CreateExpenseGroupRequest { Name_en = "Personnel", Form990LineId = 1 });
|
||||||
var sid = await svc.CreateSubCategoryAsync(new CreateExpenseSubCategoryRequest { GroupId = gid, Name_en = "Salary & Wages", Form990LineId = 7 });
|
var sid = await svc.CreateSubCategoryAsync(new CreateExpenseSubCategoryRequest { GroupId = gid, Name_en = "Salary & Wages", Form990LineId = 7 });
|
||||||
|
|
||||||
var all = await svc.GetAllAsync(includeInactive: true);
|
var all = await svc.GetAllAsync(includeInactive: true);
|
||||||
var sub = all.Single(g => g.Id == gid).SubCategories.Single(s => s.Id == sid);
|
var sub = all.Single(g => g.Id == gid).SubCategories.Single(s => s.Id == sid);
|
||||||
Assert.Equal(7, sub.Form990LineId);
|
Assert.Equal(7, sub.Form990LineId);
|
||||||
Assert.Equal(24, all.Single(g => g.Id == gid).Form990LineId);
|
Assert.Equal("7", sub.Form990LineCode);
|
||||||
|
Assert.Equal(1, all.Single(g => g.Id == gid).Form990LineId);
|
||||||
|
Assert.Equal("24", all.Single(g => g.Id == gid).Form990LineCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user