Files
met08ddupsp1tbi/Adaptation/_Tests/Static/Job.cs
Mike Phares ff006cb792 Now relying on pipeline to copy files from file shares for ghost-pcl and linc-pdfc
Now using entered-date-time-filter and load-signature-date-time-filter for logistics query
2025-06-27 12:31:46 -07:00

349 lines
19 KiB
C#

using Adaptation._Tests.Shared;
using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Diagnostics;
using System.Net.Http;
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) => LoggingUnitTesting ??= new Job(testContext);
[ClassCleanup()]
public static void ClassCleanup()
{
LoggingUnitTesting?.Logger?.LogInformation("Cleanup");
LoggingUnitTesting?.Dispose();
}
private static void NonThrowTryCatch()
{
try
{ throw new Exception(); }
catch (Exception) { }
}
#if !Always
[Ignore]
#endif
[TestMethod]
public void TestJobA()
{
string mid;
FileHandlers.TIBCO.Transport.Job job;
DateTime enteredDateTimeFilter = new(2023, 05, 01);
MethodBase methodBase = new StackFrame().GetMethod();
DateTime loadSignatureDateTimeFilter = new(2023, 05, 01);
string metrologyFileShare = FileHandlers.TIBCO.FileRead.MetrologyFileShare;
string barcodeHostFileShare = FileHandlers.TIBCO.FileRead.BarcodeHostFileShare;
string lsl2SQLConnectionString = FileHandlers.TIBCO.FileRead.LSL2SQLConnectionString;
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
HttpClient httpClient = new() { BaseAddress = new(FileHandlers.TIBCO.FileRead.OpenInsightApplicationProgrammingInterface) };
mid = """
{"Area": "Si", "EquipmentType": "MET08RESIMAPCDE", "MesEntity": "CDE4", "Sequence": "123456789", "MID": "12-123456-1234", "Recipe": "Recipe"}
""";
job = new(lsl2SQLConnectionString, metrologyFileShare, barcodeHostFileShare, httpClient, mid, enteredDateTimeFilter, loadSignatureDateTimeFilter);
Assert.IsFalse(string.IsNullOrEmpty(job.ProcessType)); // == "21");
Assert.AreEqual("123456", job.LotName);
Assert.IsFalse(string.IsNullOrEmpty(job.ProductName)); // == "4609");
mid = """
{"Area": "Si", "EquipmentType": "MET08RESIMAPCDE", "MesEntity": "CDE4", "Sequence": "123456789", "MID": "12-1234567-1234", "Recipe": "Recipe"}
""";
job = new(lsl2SQLConnectionString, metrologyFileShare, barcodeHostFileShare, httpClient, mid, enteredDateTimeFilter, loadSignatureDateTimeFilter);
Assert.IsFalse(string.IsNullOrEmpty(job.ProcessType)); // == "21");
Assert.AreEqual("1234567", job.LotName);
Assert.IsFalse(string.IsNullOrEmpty(job.ProductName)); // == "4609");
mid = """
{"Area": "Si", "EquipmentType": "MET08RESIMAPCDE", "MesEntity": "CDE4", "Sequence": "123456789", "MID": "-544481-", "Recipe": "Recipe"}
""";
job = new(lsl2SQLConnectionString, metrologyFileShare, barcodeHostFileShare, httpClient, mid, enteredDateTimeFilter, loadSignatureDateTimeFilter);
Assert.IsFalse(string.IsNullOrEmpty(job.ProcessType)); // == "51");
Assert.AreEqual("544481", job.LotName);
Assert.IsFalse(string.IsNullOrEmpty(job.ProductName)); // == "5158");
mid = """
{"Area": "Si", "EquipmentType": "MET08RESIMAPCDE", "MesEntity": "CDE4", "Sequence": "123456789", "MID": "00-544481-0000", "Recipe": "Recipe"}
""";
job = new(lsl2SQLConnectionString, metrologyFileShare, barcodeHostFileShare, httpClient, mid, enteredDateTimeFilter, loadSignatureDateTimeFilter);
Assert.IsFalse(string.IsNullOrEmpty(job.ProcessType)); // == "51");
Assert.AreEqual("544481", job.LotName);
Assert.IsFalse(string.IsNullOrEmpty(job.ProductName)); // == "5158");
mid = """
{"Area": "Si", "EquipmentType": "MET08RESIMAPCDE", "MesEntity": "CDE4", "Sequence": "123456789", "MID": "00-o171308.1.51-0000", "Recipe": "Recipe", "Slot": "11"}
""";
job = new(lsl2SQLConnectionString, metrologyFileShare, barcodeHostFileShare, httpClient, mid, enteredDateTimeFilter, loadSignatureDateTimeFilter);
Assert.IsFalse(string.IsNullOrEmpty(job.ProcessType)); // == "54");
Assert.IsFalse(string.IsNullOrEmpty(job.LotName)); // == "547000");
Assert.IsFalse(string.IsNullOrEmpty(job.ProductName)); // == "4445");
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
mid = """
{"Area": "Si", "EquipmentType": "MET08RESIMAPCDE", "MesEntity": "CDE5", "Sequence": "638163023363575829", "MID": "B48", "Recipe": "lsl_6in "}
""";
job = new(lsl2SQLConnectionString, metrologyFileShare, barcodeHostFileShare, httpClient, mid, enteredDateTimeFilter, loadSignatureDateTimeFilter);
Assert.IsFalse(string.IsNullOrEmpty(job.ProcessType)); // == "54");
Assert.IsFalse(string.IsNullOrEmpty(job.LotName)); // == "547000");
Assert.IsFalse(string.IsNullOrEmpty(job.ProductName)); // == "4445");
NonThrowTryCatch();
}
#if !Always
[Ignore]
#endif
[TestMethod]
public void TestJobAA()
{
FileHandlers.TIBCO.Transport.Job job;
DateTime enteredDateTimeFilter = new(2023, 05, 01);
MethodBase methodBase = new StackFrame().GetMethod();
DateTime loadSignatureDateTimeFilter = new(2023, 05, 01);
string metrologyFileShare = FileHandlers.TIBCO.FileRead.MetrologyFileShare;
string barcodeHostFileShare = FileHandlers.TIBCO.FileRead.BarcodeHostFileShare;
string lsl2SQLConnectionString = FileHandlers.TIBCO.FileRead.LSL2SQLConnectionString;
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
HttpClient httpClient = new() { BaseAddress = new(FileHandlers.TIBCO.FileRead.OpenInsightApplicationProgrammingInterface) };
string mid = """
{"Area": "Si", "EquipmentType": "MET08THFTIRQS408M", "MesEntity": "BIORAD2", "Sequence": "123456789", "MID": "37--", "Recipe": "Recipe"}
""";
job = new(lsl2SQLConnectionString, metrologyFileShare, barcodeHostFileShare, httpClient, mid, enteredDateTimeFilter, loadSignatureDateTimeFilter);
Assert.AreEqual("37", job.ProcessType);
Assert.IsFalse(string.IsNullOrEmpty(job.LotName)); // == "549918");
Assert.IsFalse(string.IsNullOrEmpty(job.ProductName)); // == "5101");
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
NonThrowTryCatch();
}
#if !Always
[Ignore]
#endif
[TestMethod]
public void TestJobB()
{
FileHandlers.TIBCO.Transport.Job job;
DateTime enteredDateTimeFilter = new(2023, 05, 01);
MethodBase methodBase = new StackFrame().GetMethod();
DateTime loadSignatureDateTimeFilter = new(2023, 05, 01);
string metrologyFileShare = FileHandlers.TIBCO.FileRead.MetrologyFileShare;
string barcodeHostFileShare = FileHandlers.TIBCO.FileRead.BarcodeHostFileShare;
string lsl2SQLConnectionString = FileHandlers.TIBCO.FileRead.LSL2SQLConnectionString;
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
HttpClient httpClient = new() { BaseAddress = new(FileHandlers.TIBCO.FileRead.OpenInsightApplicationProgrammingInterface) };
string mid = """
{"Area": "Si", "EquipmentType": "MET08RESIMAPCDE", "MesEntity": "CDE4", "Sequence": "123456789", "MID": "P1234", "Recipe": "Recipe"}
""";
job = new(lsl2SQLConnectionString, metrologyFileShare, barcodeHostFileShare, httpClient, mid, enteredDateTimeFilter, loadSignatureDateTimeFilter);
Assert.IsFalse(string.IsNullOrEmpty(job.ProcessType));
Assert.IsFalse(string.IsNullOrEmpty(job.LotName));
Assert.IsFalse(string.IsNullOrEmpty(job.ProductName));
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
NonThrowTryCatch();
}
#if !Always
[Ignore]
#endif
[TestMethod]
public void TestJobC()
{
FileHandlers.TIBCO.Transport.Job job;
DateTime enteredDateTimeFilter = new(2023, 05, 01);
MethodBase methodBase = new StackFrame().GetMethod();
DateTime loadSignatureDateTimeFilter = new(2023, 05, 01);
string metrologyFileShare = FileHandlers.TIBCO.FileRead.MetrologyFileShare;
string barcodeHostFileShare = FileHandlers.TIBCO.FileRead.BarcodeHostFileShare;
string lsl2SQLConnectionString = FileHandlers.TIBCO.FileRead.LSL2SQLConnectionString;
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
HttpClient httpClient = new() { BaseAddress = new(FileHandlers.TIBCO.FileRead.OpenInsightApplicationProgrammingInterface) };
string mid = """
{"Area": "Si", "EquipmentType": "MET08RESIMAPCDE", "MesEntity": "BIORAD3", "Sequence": "638234699589174855", "MID": "33--", "Recipe": "Recipe"}
""";
job = new(lsl2SQLConnectionString, metrologyFileShare, barcodeHostFileShare, httpClient, mid, enteredDateTimeFilter, loadSignatureDateTimeFilter);
Assert.IsFalse(string.IsNullOrEmpty(job.ProcessType));
Assert.IsFalse(string.IsNullOrEmpty(job.LotName));
Assert.IsFalse(string.IsNullOrEmpty(job.ProductName));
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
NonThrowTryCatch();
}
#if !Always
[Ignore]
#endif
[TestMethod]
public void TestJobD()
{
FileHandlers.TIBCO.Transport.Job job;
DateTime enteredDateTimeFilter = new(2023, 05, 01);
MethodBase methodBase = new StackFrame().GetMethod();
DateTime loadSignatureDateTimeFilter = new(2023, 05, 01);
string metrologyFileShare = FileHandlers.TIBCO.FileRead.MetrologyFileShare;
string barcodeHostFileShare = FileHandlers.TIBCO.FileRead.BarcodeHostFileShare;
string lsl2SQLConnectionString = FileHandlers.TIBCO.FileRead.LSL2SQLConnectionString;
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
HttpClient httpClient = new() { BaseAddress = new(FileHandlers.TIBCO.FileRead.OpenInsightApplicationProgrammingInterface) };
string mid = """
{"Area": "Si", "EquipmentType": "DEP08CEPIEPSILON", "MesEntity": "R32", "Sequence": "", "MID": "32--", "Recipe": "Recipe"}
""";
job = new(lsl2SQLConnectionString, metrologyFileShare, barcodeHostFileShare, httpClient, mid, enteredDateTimeFilter, loadSignatureDateTimeFilter);
Assert.IsFalse(string.IsNullOrEmpty(job.ProcessType));
Assert.IsFalse(string.IsNullOrEmpty(job.LotName));
Assert.IsFalse(string.IsNullOrEmpty(job.ProductName));
Assert.IsFalse(string.IsNullOrEmpty(job.Equipment));
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
NonThrowTryCatch();
}
#if !Always
[Ignore]
#endif
[TestMethod]
public void TestJobE()
{
FileHandlers.TIBCO.Transport.Job job;
DateTime enteredDateTimeFilter = new(2023, 05, 01);
MethodBase methodBase = new StackFrame().GetMethod();
DateTime loadSignatureDateTimeFilter = new(2023, 05, 01);
string metrologyFileShare = FileHandlers.TIBCO.FileRead.MetrologyFileShare;
string barcodeHostFileShare = FileHandlers.TIBCO.FileRead.BarcodeHostFileShare;
string lsl2SQLConnectionString = FileHandlers.TIBCO.FileRead.LSL2SQLConnectionString;
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
HttpClient httpClient = new() { BaseAddress = new(FileHandlers.TIBCO.FileRead.OpenInsightApplicationProgrammingInterface) };
string mid = """
{"Area": "Si", "EquipmentType": "MET08RESIMAPCDE", "MesEntity": "CDE5", "Sequence": "638756365880000000", "MID": "38-660275-5095.1", "Recipe": "IRC6mm"}
""";
job = new(lsl2SQLConnectionString, metrologyFileShare, barcodeHostFileShare, httpClient, mid, enteredDateTimeFilter, loadSignatureDateTimeFilter);
Assert.IsFalse(string.IsNullOrEmpty(job.ProcessType));
Assert.IsFalse(string.IsNullOrEmpty(job.LotName));
Assert.IsFalse(string.IsNullOrEmpty(job.ProductName));
Assert.IsFalse(string.IsNullOrEmpty(job.Equipment));
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
NonThrowTryCatch();
}
#if !Always
[Ignore]
#endif
[TestMethod]
public void TestJobF()
{
FileHandlers.TIBCO.Transport.Job job;
DateTime enteredDateTimeFilter = new(2023, 05, 01);
MethodBase methodBase = new StackFrame().GetMethod();
DateTime loadSignatureDateTimeFilter = new(2023, 05, 01);
string metrologyFileShare = FileHandlers.TIBCO.FileRead.MetrologyFileShare;
string barcodeHostFileShare = FileHandlers.TIBCO.FileRead.BarcodeHostFileShare;
string lsl2SQLConnectionString = FileHandlers.TIBCO.FileRead.LSL2SQLConnectionString;
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
HttpClient httpClient = new() { BaseAddress = new(FileHandlers.TIBCO.FileRead.OpenInsightApplicationProgrammingInterface) };
string mid = """
{"Area": "Si", "EquipmentType": "MET08THFTIRQS408M", "MesEntity": "BIORAD2", "Sequence": "638757112479659597", "MID": "173308.1.5", "Recipe": "6inTHICK"}
""";
job = new(lsl2SQLConnectionString, metrologyFileShare, barcodeHostFileShare, httpClient, mid, enteredDateTimeFilter, loadSignatureDateTimeFilter);
Assert.IsFalse(string.IsNullOrEmpty(job.ProcessType));
Assert.IsFalse(string.IsNullOrEmpty(job.LotName));
Assert.IsFalse(string.IsNullOrEmpty(job.ProductName));
Assert.IsFalse(string.IsNullOrEmpty(job.Equipment));
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
NonThrowTryCatch();
}
#if !Always
[Ignore]
#endif
[TestMethod]
public void TestJobG()
{
FileHandlers.TIBCO.Transport.Job job;
DateTime enteredDateTimeFilter = new(2023, 05, 01);
MethodBase methodBase = new StackFrame().GetMethod();
DateTime loadSignatureDateTimeFilter = new(2023, 05, 01);
string metrologyFileShare = FileHandlers.TIBCO.FileRead.MetrologyFileShare;
string barcodeHostFileShare = FileHandlers.TIBCO.FileRead.BarcodeHostFileShare;
string lsl2SQLConnectionString = FileHandlers.TIBCO.FileRead.LSL2SQLConnectionString;
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
HttpClient httpClient = new() { BaseAddress = new(FileHandlers.TIBCO.FileRead.OpenInsightApplicationProgrammingInterface) };
string mid = """
{"Area": "Si", "EquipmentType": "MET08DDUPSFS6420", "MesEntity": "TENCOR1", "Sequence": "638765945581765554", "MID": "1T661282", "Recipe": "8IN_THIN ROTR"}
""";
job = new(lsl2SQLConnectionString, metrologyFileShare, barcodeHostFileShare, httpClient, mid, enteredDateTimeFilter, loadSignatureDateTimeFilter);
Assert.IsFalse(string.IsNullOrEmpty(job.ProcessType));
Assert.IsFalse(string.IsNullOrEmpty(job.LotName));
Assert.IsFalse(string.IsNullOrEmpty(job.ProductName));
Assert.IsFalse(string.IsNullOrEmpty(job.Equipment));
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
NonThrowTryCatch();
}
#if !Always
[Ignore]
#endif
[TestMethod]
public void TestJobH()
{
FileHandlers.TIBCO.Transport.Job job;
DateTime enteredDateTimeFilter = new(2023, 05, 01);
MethodBase methodBase = new StackFrame().GetMethod();
DateTime loadSignatureDateTimeFilter = new(2023, 05, 01);
string metrologyFileShare = FileHandlers.TIBCO.FileRead.MetrologyFileShare;
string barcodeHostFileShare = FileHandlers.TIBCO.FileRead.BarcodeHostFileShare;
string lsl2SQLConnectionString = FileHandlers.TIBCO.FileRead.LSL2SQLConnectionString;
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
HttpClient httpClient = new() { BaseAddress = new(FileHandlers.TIBCO.FileRead.OpenInsightApplicationProgrammingInterface) };
string mid = """
{"Area": "Si", "EquipmentType": "MET08DDUPSFS6420", "MesEntity": "TENCOR1", "Sequence": "638765945581765554", "MID": "AK1PL2", "Recipe": "8INCLEAN"}
""";
job = new(lsl2SQLConnectionString, metrologyFileShare, barcodeHostFileShare, httpClient, mid, enteredDateTimeFilter, loadSignatureDateTimeFilter);
Assert.IsFalse(string.IsNullOrEmpty(job.ProcessType));
Assert.IsFalse(string.IsNullOrEmpty(job.LotName));
Assert.IsFalse(string.IsNullOrEmpty(job.ProductName));
Assert.IsFalse(string.IsNullOrEmpty(job.Equipment));
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
NonThrowTryCatch();
}
#if !Always
[Ignore]
#endif
[TestMethod]
public void TestJobI()
{
FileHandlers.TIBCO.Transport.Job job;
DateTime enteredDateTimeFilter = new(2023, 05, 01);
MethodBase methodBase = new StackFrame().GetMethod();
DateTime loadSignatureDateTimeFilter = new(2023, 05, 01);
string metrologyFileShare = FileHandlers.TIBCO.FileRead.MetrologyFileShare;
string barcodeHostFileShare = FileHandlers.TIBCO.FileRead.BarcodeHostFileShare;
string lsl2SQLConnectionString = FileHandlers.TIBCO.FileRead.LSL2SQLConnectionString;
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
HttpClient httpClient = new() { BaseAddress = new(FileHandlers.TIBCO.FileRead.OpenInsightApplicationProgrammingInterface) };
string mid = """
{"Area": "Si", "EquipmentType": "MET08RESIMAPCDE", "MesEntity": "CDE5", "Sequence": "638163023363575829", "MID": "23-111111-5053", "Recipe": "lsl_6in "}
""";
job = new(lsl2SQLConnectionString, metrologyFileShare, barcodeHostFileShare, httpClient, mid, enteredDateTimeFilter, loadSignatureDateTimeFilter);
Assert.IsFalse(string.IsNullOrEmpty(job.ProcessType)); // == "23");
Assert.IsFalse(string.IsNullOrEmpty(job.LotName)); // == "111111");
Assert.IsFalse(string.IsNullOrEmpty(job.ProductName)); // == "5053");
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
NonThrowTryCatch();
}
}