|
|
@@ -0,0 +1,39 @@
|
|
|
+using Xunit;
|
|
|
+
|
|
|
+namespace Admin.NET.Plugin.AiDOP.Tests.DataPlatform;
|
|
|
+
|
|
|
+public class EmployeeEmploymentStatusMappingTests
|
|
|
+{
|
|
|
+ [Fact]
|
|
|
+ public void NativeAndInbound_MapAcToActive_AndDcToLeft()
|
|
|
+ {
|
|
|
+ var native = File.ReadAllText(Path.Combine(RepoRoot(),
|
|
|
+ "server", "Plugins", "Admin.NET.Plugin.AiDOP", "DataPlatform", "NativeNeutralProjectionService.cs"));
|
|
|
+ var inbound = File.ReadAllText(Path.Combine(RepoRoot(),
|
|
|
+ "server", "Plugins", "Admin.NET.Plugin.AiDOP", "DataPlatform", "Inbound", "MdmMirrorUpsertService.cs"));
|
|
|
+ Assert.Contains("'ACTIVE','ONJOB','ON_JOB','AC'", native);
|
|
|
+ Assert.Contains("'LEFT','LEAVE','RESIGNED','TERMINATED','QUIT','DC'", native);
|
|
|
+ Assert.Contains("ELSE 'UNKNOWN'", native);
|
|
|
+ Assert.Contains("\"AC\"", inbound);
|
|
|
+ Assert.Contains("\"DC\"", inbound);
|
|
|
+ Assert.Contains("return \"UNKNOWN\"", inbound);
|
|
|
+ }
|
|
|
+
|
|
|
+ [Fact]
|
|
|
+ public void T8Projection_AlreadyMapsChineseStatus_AndIsNotEditedForAc()
|
|
|
+ {
|
|
|
+ var t8 = File.ReadAllText(Path.Combine(RepoRoot(),
|
|
|
+ "server", "Plugins", "Admin.NET.Plugin.AiDOP", "DataPlatform", "T8BaseInboundMdpSyncService.NeutralProjection.cs"));
|
|
|
+ Assert.Contains("zzzt='在职'", t8);
|
|
|
+ Assert.Contains("zzzt LIKE '%离职%'", t8);
|
|
|
+ Assert.DoesNotContain("'AC'", t8);
|
|
|
+ }
|
|
|
+
|
|
|
+ private static string RepoRoot()
|
|
|
+ {
|
|
|
+ var dir = new DirectoryInfo(AppContext.BaseDirectory);
|
|
|
+ while (dir != null && !File.Exists(Path.Combine(dir.FullName, "AGENTS.md")))
|
|
|
+ dir = dir.Parent;
|
|
|
+ return dir?.FullName ?? throw new InvalidOperationException("repo root not found");
|
|
|
+ }
|
|
|
+}
|