Files
jobtrackingapp/JobTrackerApi.Tests/JobApplicationsControllerTests.cs
T
cesnimda ea6c3650f3 refactor(api): extract JobApplications DTOs and helpers, fix N+1 aggregation
- Move inline DTOs to JobApplicationDtos.cs, pure static helpers to JobApplicationHelpers.cs
- GetStats aggregates server-side (COUNT/GROUP BY) instead of loading the full table
- Cache RuleSettings via IMemoryCache, keyed per-user (RulesEngine.GetSettings falls back
  to per-user UserRuleSettings overrides, so a single global cache key would leak settings
  across users)
- Add missing AsNoTracking() to read-only GET endpoints (GetAll, GetById, GetBoard,
  GetReminders, GetStatusSuggestion, GetMatchScore, GetCandidateFit, GetFocusPlan,
  GetInterviewPrep, GetReadiness)

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-12 20:08:59 +02:00

35 lines
1.2 KiB
C#

using System.Reflection;
using JobTrackerApi.Controllers;
using Xunit;
namespace JobTrackerApi.Tests;
public sealed class JobApplicationsControllerTests
{
[Fact]
public void Application_package_record_exposes_expected_fields()
{
var type = typeof(GenerateApplicationPackageDto);
Assert.NotNull(type);
var props = type!.GetProperties(BindingFlags.Public | BindingFlags.Instance).Select(x => x.Name).ToHashSet();
Assert.Contains("TailoredCvText", props);
Assert.Contains("CoverLetterDraft", props);
Assert.Contains("ApplicationAnswerDraft", props);
Assert.Contains("RecruiterMessageDraft", props);
Assert.Contains("KeyPoints", props);
}
[Fact]
public void Save_application_drafts_request_supports_cover_letter_and_notes()
{
var type = typeof(SaveApplicationDraftsRequest);
Assert.NotNull(type);
var ctor = type!.GetConstructors().Single();
var parameters = ctor.GetParameters().Select(x => x.Name).Where(x => x is not null).Select(x => x!).ToHashSet(StringComparer.OrdinalIgnoreCase);
Assert.Contains("coverLetterText", parameters);
Assert.Contains("notes", parameters);
}
}