Mike Phares 3355fb3318 Delete SelfHost PackageReference
cellInstanceVersion.EdaConnection.PortNumber
Convert before throwing the error
CA1862 and GetWeekOfYear for WritePDSF
Removed Open Insight API IFX Directory from Save
dotnet_diagnostic
Delete File if Exists
yml ec fix
net8.0
2024-04-09 12:55:04 -07:00

127 lines
7.1 KiB
C#

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) => 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 true
[Ignore]
#endif
[TestMethod]
public void TestJobA()
{
FileHandlers.TIBCO.Transport.Job job;
MethodBase methodBase = new StackFrame().GetMethod();
string barcodeHostFileShare = @"\\mesfs.infineon.com\EC_Metrology_Si\BarcodeHost\API";
string metrologyFileShare = @"\\mesfs.infineon.com\EC_Metrology_Si\WorkMaterialOut\API";
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string lsl2SQLConnectionString = "Data Source=messqlec1.infineon.com\\PROD1,53959;Initial Catalog=LSL2SQL;Persist Security Info=True;User ID=srpadmin;Password=0okm9ijn;";
job = new(lsl2SQLConnectionString, metrologyFileShare, barcodeHostFileShare, "{\"Area\": \"Si\", \"EquipmentType\": \"MET08RESIMAPCDE\", \"MesEntity\": \"CDE4\", \"Sequence\": \"123456789\", \"MID\": \"12-123456-1234\", \"Recipe\": \"Recipe\"}");
Assert.IsTrue(!string.IsNullOrEmpty(job.ProcessType)); // == "21");
Assert.IsTrue(job.LotName == "123456");
Assert.IsTrue(!string.IsNullOrEmpty(job.ProductName)); // == "4609");
job = new(lsl2SQLConnectionString, metrologyFileShare, barcodeHostFileShare, "{\"Area\": \"Si\", \"EquipmentType\": \"MET08RESIMAPCDE\", \"MesEntity\": \"CDE4\", \"Sequence\": \"123456789\", \"MID\": \"-544481-\", \"Recipe\": \"Recipe\"}");
Assert.IsTrue(!string.IsNullOrEmpty(job.ProcessType)); // == "51");
Assert.IsTrue(job.LotName == "544481");
Assert.IsTrue(!string.IsNullOrEmpty(job.ProductName)); // == "5158");
job = new(lsl2SQLConnectionString, metrologyFileShare, barcodeHostFileShare, "{\"Area\": \"Si\", \"EquipmentType\": \"MET08RESIMAPCDE\", \"MesEntity\": \"CDE4\", \"Sequence\": \"123456789\", \"MID\": \"00-544481-0000\", \"Recipe\": \"Recipe\"}");
Assert.IsTrue(!string.IsNullOrEmpty(job.ProcessType)); // == "51");
Assert.IsTrue(job.LotName == "544481");
Assert.IsTrue(!string.IsNullOrEmpty(job.ProductName)); // == "5158");
job = new(lsl2SQLConnectionString, metrologyFileShare, barcodeHostFileShare, "{\"Area\": \"Si\", \"EquipmentType\": \"MET08RESIMAPCDE\", \"MesEntity\": \"CDE4\", \"Sequence\": \"123456789\", \"MID\": \"37\", \"Recipe\": \"Recipe\"}");
Assert.IsTrue(job.ProcessType == "37");
Assert.IsTrue(!string.IsNullOrEmpty(job.LotName)); // == "549918");
Assert.IsTrue(!string.IsNullOrEmpty(job.ProductName)); // == "5101");
job = new(lsl2SQLConnectionString, metrologyFileShare, barcodeHostFileShare, "{\"Area\": \"Si\", \"EquipmentType\": \"MET08RESIMAPCDE\", \"MesEntity\": \"CDE4\", \"Sequence\": \"123456789\", \"MID\": \"00-o171308.1.51-0000\", \"Recipe\": \"Recipe\", \"Slot\": \"11\"}");
Assert.IsTrue(!string.IsNullOrEmpty(job.ProcessType)); // == "54");
Assert.IsTrue(!string.IsNullOrEmpty(job.LotName)); // == "547000");
Assert.IsTrue(!string.IsNullOrEmpty(job.ProductName)); // == "4445");
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
job = new(lsl2SQLConnectionString, metrologyFileShare, barcodeHostFileShare, "{\"Area\": \"Si\", \"EquipmentType\": \"MET08RESIMAPCDE\", \"MesEntity\": \"CDE5\", \"Sequence\": \"638163023363575829\", \"MID\": \"B48\", \"Recipe\": \"lsl_6in \"}");
Assert.IsTrue(!string.IsNullOrEmpty(job.ProcessType)); // == "54");
Assert.IsTrue(!string.IsNullOrEmpty(job.LotName)); // == "547000");
Assert.IsTrue(!string.IsNullOrEmpty(job.ProductName)); // == "4445");
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
NonThrowTryCatch();
}
#if true
[Ignore]
#endif
[TestMethod]
public void TestJobB()
{
MethodBase methodBase = new StackFrame().GetMethod();
FileHandlers.TIBCO.Transport.Job job;
string barcodeHostFileShare = @"\\mesfs.infineon.com\EC_Metrology_Si\BarcodeHost\API";
string metrologyFileShare = @"\\mesfs.infineon.com\EC_Metrology_Si\WorkMaterialOut\API";
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string lsl2SQLConnectionString = "Data Source=messqlec1.infineon.com\\PROD1,53959;Initial Catalog=LSL2SQL;Persist Security Info=True;User ID=srpadmin;Password=0okm9ijn;";
job = new(lsl2SQLConnectionString, metrologyFileShare, barcodeHostFileShare, "{\"Area\": \"Si\", \"EquipmentType\": \"MET08RESIMAPCDE\", \"MesEntity\": \"CDE4\", \"Sequence\": \"123456789\", \"MID\": \"P1234\", \"Recipe\": \"Recipe\"}");
Assert.IsTrue(!string.IsNullOrEmpty(job.ProcessType));
Assert.IsTrue(!string.IsNullOrEmpty(job.LotName));
Assert.IsTrue(!string.IsNullOrEmpty(job.ProductName));
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
NonThrowTryCatch();
}
#if true
[Ignore]
#endif
[TestMethod]
public void TestJobC()
{
MethodBase methodBase = new StackFrame().GetMethod();
FileHandlers.TIBCO.Transport.Job job;
string barcodeHostFileShare = @"\\mesfs.infineon.com\EC_Metrology_Si\BarcodeHost\API";
string metrologyFileShare = @"\\mesfs.infineon.com\EC_Metrology_Si\WorkMaterialOut\API";
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string lsl2SQLConnectionString = "Data Source=messqlec1.infineon.com\\PROD1,53959;Initial Catalog=LSL2SQL;Persist Security Info=True;User ID=srpadmin;Password=0okm9ijn;";
job = new(lsl2SQLConnectionString, metrologyFileShare, barcodeHostFileShare, "{\"Area\": \"Si\", \"EquipmentType\": \"MET08RESIMAPCDE\", \"MesEntity\": \"BIORAD3\", \"Sequence\": \"638234699589174855\", \"MID\": \"33--\", \"Recipe\": \"Recipe\"}");
Assert.IsTrue(!string.IsNullOrEmpty(job.ProcessType));
Assert.IsTrue(!string.IsNullOrEmpty(job.LotName));
Assert.IsTrue(!string.IsNullOrEmpty(job.ProductName));
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
NonThrowTryCatch();
}
}