EmployeeEmploymentStatusMappingTests.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using Xunit;
  2. namespace Admin.NET.Plugin.AiDOP.Tests.DataPlatform;
  3. public class EmployeeEmploymentStatusMappingTests
  4. {
  5. [Fact]
  6. public void NativeAndInbound_MapAcToActive_AndDcToLeft()
  7. {
  8. var native = File.ReadAllText(Path.Combine(RepoRoot(),
  9. "server", "Plugins", "Admin.NET.Plugin.AiDOP", "DataPlatform", "NativeNeutralProjectionService.cs"));
  10. var inbound = File.ReadAllText(Path.Combine(RepoRoot(),
  11. "server", "Plugins", "Admin.NET.Plugin.AiDOP", "DataPlatform", "Inbound", "MdmMirrorUpsertService.cs"));
  12. Assert.Contains("'ACTIVE','ONJOB','ON_JOB','AC'", native);
  13. Assert.Contains("'LEFT','LEAVE','RESIGNED','TERMINATED','QUIT','DC'", native);
  14. Assert.Contains("ELSE 'UNKNOWN'", native);
  15. Assert.Contains("\"AC\"", inbound);
  16. Assert.Contains("\"DC\"", inbound);
  17. Assert.Contains("return \"UNKNOWN\"", inbound);
  18. }
  19. [Fact]
  20. public void T8Projection_AlreadyMapsChineseStatus_AndIsNotEditedForAc()
  21. {
  22. var t8 = File.ReadAllText(Path.Combine(RepoRoot(),
  23. "server", "Plugins", "Admin.NET.Plugin.AiDOP", "DataPlatform", "T8BaseInboundMdpSyncService.NeutralProjection.cs"));
  24. Assert.Contains("zzzt='在职'", t8);
  25. Assert.Contains("zzzt LIKE '%离职%'", t8);
  26. Assert.DoesNotContain("'AC'", t8);
  27. }
  28. private static string RepoRoot()
  29. {
  30. var dir = new DirectoryInfo(AppContext.BaseDirectory);
  31. while (dir != null && !File.Exists(Path.Combine(dir.FullName, "AGENTS.md")))
  32. dir = dir.Parent;
  33. return dir?.FullName ?? throw new InvalidOperationException("repo root not found");
  34. }
  35. }