using System; namespace HanvonF710XAttendanceService { internal static class HrmsEmployeePhotoClientTests { public static int RunAll() { int failed = 0; failed += Run("1 build portal photo URL", TestBuildPhotoUrl); failed += Run("2 disabled source returns false", TestDisabledSource); return failed; } private static int Run(string name, Func test) { try { if (!test()) { Console.WriteLine("FAIL: " + name); return 1; } Console.WriteLine("PASS: " + name); return 0; } catch (Exception ex) { Console.WriteLine("FAIL: " + name + " err=" + ex.Message); return 1; } } private static bool TestBuildPhotoUrl() { // Photo path uses employees.id (84321), not device serial (15057). string url = HrmsEmployeePhotoClient.BuildPhotoUrl( "https://portal.utopiaindustries.pk/uind/employee-photo/", "84321"); return string.Equals( url, "https://portal.utopiaindustries.pk/uind/employee-photo/84321.jpeg", StringComparison.OrdinalIgnoreCase); } private static bool TestDisabledSource() { return !string.IsNullOrWhiteSpace(EmployeePhotoSourceSettings.GetBaseUrl()); } } }