using Adaptation._Tests.Shared; using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Diagnostics; using System.Reflection; namespace Adaptation._Tests.Static; [TestClass] public class Job : LoggingUnitTesting, IDisposable { #pragma warning disable CA2254 #pragma warning disable IDE0060 internal static Job LoggingUnitTesting { get; private set; } public Job() : base(testContext: null, declaringType: null) { if (LoggingUnitTesting is null) throw new Exception(); } public Job(TestContext testContext) : base(testContext, new StackFrame().GetMethod().DeclaringType) { } [ClassInitialize] public static void ClassInitialize(TestContext testContext) { if (LoggingUnitTesting is null) LoggingUnitTesting = new Job(testContext); } [ClassCleanup()] public static void ClassCleanup() { if (LoggingUnitTesting.Logger is not null) LoggingUnitTesting.Logger.LogInformation("Cleanup"); if (LoggingUnitTesting is not null) LoggingUnitTesting.Dispose(); } #if true [Ignore] #endif [TestMethod] public void TestJob() { FileHandlers.TIBCO.Transport.Job job; MethodBase methodBase = new StackFrame().GetMethod(); LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration")); string conn = "Data Source=10.95.128.28\\PROD1,53959;Initial Catalog=LSL2SQL;Persist Security Info=True;User ID=srpadmin;Password=;"; job = new(conn, string.Empty, "00-544481-0000"); Assert.IsTrue(string.IsNullOrEmpty(job.LotName)); job = new(conn, string.Empty, "{\"Area\": \"Si\", \"EquipmentType\": \"MET08RESIMAPCDE\", \"MesEntity\": \"CDE4\", \"Sequence\": \"123456789\", \"MID\": \"-544481-\", \"Recipe\": \"Recipe\"}"); Assert.IsTrue(job.LotName == "544481"); Assert.IsTrue(job.EpiLayer == "1"); LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); } }