Fixed Archive and Added OpenInsight
This commit is contained in:
@ -15,23 +15,23 @@ public class MET08ANLYSDIFAAST230 : EAFLoggingUnitTesting
|
||||
#pragma warning disable CA2254
|
||||
#pragma warning disable IDE0060
|
||||
|
||||
internal static string DummyRoot { get; private set; }
|
||||
internal static MET08ANLYSDIFAAST230 EAFLoggingUnitTesting { get; private set; }
|
||||
|
||||
public MET08ANLYSDIFAAST230() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false)
|
||||
public MET08ANLYSDIFAAST230() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false)
|
||||
{
|
||||
if (EAFLoggingUnitTesting is null)
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
public MET08ANLYSDIFAAST230(TestContext testContext) : base(testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false)
|
||||
public MET08ANLYSDIFAAST230(TestContext testContext) : base(DummyRoot, testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false)
|
||||
{
|
||||
}
|
||||
|
||||
[ClassInitialize]
|
||||
public static void ClassInitialize(TestContext testContext)
|
||||
{
|
||||
if (EAFLoggingUnitTesting is null)
|
||||
EAFLoggingUnitTesting = new MET08ANLYSDIFAAST230(testContext);
|
||||
EAFLoggingUnitTesting ??= new MET08ANLYSDIFAAST230(testContext);
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(testContext.TestName, " - ClassInitialize"));
|
||||
string[] fileNameAndText = EAFLoggingUnitTesting.AdaptationTesting.GetCSharpText(testContext.TestName);
|
||||
File.WriteAllText(fileNameAndText[0], fileNameAndText[1]);
|
||||
@ -41,12 +41,13 @@ public class MET08ANLYSDIFAAST230 : EAFLoggingUnitTesting
|
||||
[ClassCleanup()]
|
||||
public static void ClassCleanup()
|
||||
{
|
||||
if (EAFLoggingUnitTesting.Logger is not null)
|
||||
EAFLoggingUnitTesting.Logger.LogInformation("Cleanup");
|
||||
if (EAFLoggingUnitTesting is not null)
|
||||
EAFLoggingUnitTesting.Dispose();
|
||||
EAFLoggingUnitTesting.Logger?.LogInformation("Cleanup");
|
||||
EAFLoggingUnitTesting?.Dispose();
|
||||
}
|
||||
|
||||
#if true
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_43_0__MET08ANLYSDIFAAST230__MoveMatchingFiles()
|
||||
{
|
||||
@ -57,6 +58,9 @@ public class MET08ANLYSDIFAAST230 : EAFLoggingUnitTesting
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
|
||||
}
|
||||
|
||||
#if true
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_43_0__MET08ANLYSDIFAAST230__OpenInsightMetrologyViewer()
|
||||
{
|
||||
@ -67,6 +71,9 @@ public class MET08ANLYSDIFAAST230 : EAFLoggingUnitTesting
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
|
||||
}
|
||||
|
||||
#if true
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_43_0__MET08ANLYSDIFAAST230__IQSSi()
|
||||
{
|
||||
@ -77,6 +84,9 @@ public class MET08ANLYSDIFAAST230 : EAFLoggingUnitTesting
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
|
||||
}
|
||||
|
||||
#if true
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_43_0__MET08ANLYSDIFAAST230__OpenInsight()
|
||||
{
|
||||
@ -87,6 +97,9 @@ public class MET08ANLYSDIFAAST230 : EAFLoggingUnitTesting
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
|
||||
}
|
||||
|
||||
#if true
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_43_0__MET08ANLYSDIFAAST230__OpenInsightMetrologyViewerAttachments()
|
||||
{
|
||||
@ -97,6 +110,9 @@ public class MET08ANLYSDIFAAST230 : EAFLoggingUnitTesting
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
|
||||
}
|
||||
|
||||
#if true
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_43_0__MET08ANLYSDIFAAST230__APC()
|
||||
{
|
||||
@ -107,6 +123,9 @@ public class MET08ANLYSDIFAAST230 : EAFLoggingUnitTesting
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
|
||||
}
|
||||
|
||||
#if true
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_43_0__MET08ANLYSDIFAAST230__SPaCe()
|
||||
{
|
||||
@ -117,6 +136,9 @@ public class MET08ANLYSDIFAAST230 : EAFLoggingUnitTesting
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
|
||||
}
|
||||
|
||||
#if true
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_43_0__MET08ANLYSDIFAAST230__Processed()
|
||||
{
|
||||
@ -127,6 +149,9 @@ public class MET08ANLYSDIFAAST230 : EAFLoggingUnitTesting
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
|
||||
}
|
||||
|
||||
#if true
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_43_0__MET08ANLYSDIFAAST230__Archive()
|
||||
{
|
||||
@ -137,6 +162,9 @@ public class MET08ANLYSDIFAAST230 : EAFLoggingUnitTesting
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
|
||||
}
|
||||
|
||||
#if true
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_43_0__MET08ANLYSDIFAAST230__Dummy()
|
||||
{
|
||||
|
@ -0,0 +1,180 @@
|
||||
using Adaptation._Tests.Shared;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Adaptation._Tests.CreateSelfDescription.Staging.v2_47_5;
|
||||
|
||||
[TestClass]
|
||||
public class MET08ANLYSDIFAAST230 : EAFLoggingUnitTesting
|
||||
{
|
||||
|
||||
#pragma warning disable CA2254
|
||||
#pragma warning disable IDE0060
|
||||
|
||||
internal static string DummyRoot { get; private set; }
|
||||
internal static MET08ANLYSDIFAAST230 EAFLoggingUnitTesting { get; private set; }
|
||||
|
||||
static MET08ANLYSDIFAAST230() => DummyRoot = @"\\messv02ecc1.ec.local\EC_Characterization_Si\Dummy";
|
||||
|
||||
public MET08ANLYSDIFAAST230() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false)
|
||||
{
|
||||
if (EAFLoggingUnitTesting is null)
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
public MET08ANLYSDIFAAST230(TestContext testContext) : base(DummyRoot, testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false)
|
||||
{
|
||||
}
|
||||
|
||||
[ClassInitialize]
|
||||
public static void ClassInitialize(TestContext testContext)
|
||||
{
|
||||
EAFLoggingUnitTesting ??= new MET08ANLYSDIFAAST230(testContext);
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(testContext.TestName, " - ClassInitialize"));
|
||||
string[] fileNameAndText = EAFLoggingUnitTesting.AdaptationTesting.GetCSharpText(testContext.TestName);
|
||||
File.WriteAllText(fileNameAndText[0], fileNameAndText[1]);
|
||||
File.WriteAllText(fileNameAndText[2], fileNameAndText[3]);
|
||||
}
|
||||
|
||||
[ClassCleanup()]
|
||||
public static void ClassCleanup()
|
||||
{
|
||||
EAFLoggingUnitTesting.Logger?.LogInformation("Cleanup");
|
||||
EAFLoggingUnitTesting?.Dispose();
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_47_5__MET08ANLYSDIFAAST230__MoveMatchingFiles()
|
||||
{
|
||||
string check = "*.pdsf";
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
|
||||
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_47_5__MET08ANLYSDIFAAST230__OpenInsightMetrologyViewer()
|
||||
{
|
||||
string check = "*.pdsf";
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
|
||||
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_47_5__MET08ANLYSDIFAAST230__IQSSi()
|
||||
{
|
||||
string check = "*.pdsf";
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
|
||||
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_47_5__MET08ANLYSDIFAAST230__OpenInsight()
|
||||
{
|
||||
string check = "*.pdsf";
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
|
||||
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_47_5__MET08ANLYSDIFAAST230__OpenInsightMetrologyViewerAttachments()
|
||||
{
|
||||
string check = "*.pdsf";
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
|
||||
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_47_5__MET08ANLYSDIFAAST230__APC()
|
||||
{
|
||||
string check = "*.pdsf";
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
|
||||
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_47_5__MET08ANLYSDIFAAST230__SPaCe()
|
||||
{
|
||||
string check = "*.pdsf";
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
|
||||
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_47_5__MET08ANLYSDIFAAST230__Processed()
|
||||
{
|
||||
string check = "*.pdsf";
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
|
||||
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_47_5__MET08ANLYSDIFAAST230__Archive()
|
||||
{
|
||||
string check = "*.pdsf";
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
|
||||
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_47_5__MET08ANLYSDIFAAST230__Dummy()
|
||||
{
|
||||
string check = "637400762024374000.zip";
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
|
||||
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
|
||||
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
|
||||
}
|
||||
|
||||
}
|
@ -22,9 +22,15 @@ public class MET08ANLYSDIFAAST230
|
||||
_MET08ANLYSDIFAAST230 = CreateSelfDescription.Staging.v2_43_0.MET08ANLYSDIFAAST230.EAFLoggingUnitTesting;
|
||||
}
|
||||
|
||||
#if true
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_43_0__MET08ANLYSDIFAAST230__MoveMatchingFiles() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__MoveMatchingFiles();
|
||||
|
||||
#if true
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_43_0__MET08ANLYSDIFAAST230__MoveMatchingFiles637710931421087642__Normal()
|
||||
{
|
||||
@ -37,12 +43,21 @@ public class MET08ANLYSDIFAAST230
|
||||
_ = Shared.AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics, validatePDSF: false);
|
||||
}
|
||||
|
||||
#if true
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_43_0__MET08ANLYSDIFAAST230__OpenInsightMetrologyViewer() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__OpenInsightMetrologyViewer();
|
||||
|
||||
#if true
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_43_0__MET08ANLYSDIFAAST230__IQSSi() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__IQSSi();
|
||||
|
||||
#if true
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_43_0__MET08ANLYSDIFAAST230__IQSSi637884771880950000__Normal()
|
||||
{
|
||||
@ -55,24 +70,45 @@ public class MET08ANLYSDIFAAST230
|
||||
_ = Shared.AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics, validatePDSF: false);
|
||||
}
|
||||
|
||||
#if true
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_43_0__MET08ANLYSDIFAAST230__OpenInsight() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__OpenInsight();
|
||||
|
||||
#if true
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_43_0__MET08ANLYSDIFAAST230__OpenInsightMetrologyViewerAttachments() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__OpenInsightMetrologyViewerAttachments();
|
||||
|
||||
#if true
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_43_0__MET08ANLYSDIFAAST230__APC() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__APC();
|
||||
|
||||
#if true
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_43_0__MET08ANLYSDIFAAST230__SPaCe() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__SPaCe();
|
||||
|
||||
#if true
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_43_0__MET08ANLYSDIFAAST230__Processed() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__Processed();
|
||||
|
||||
#if true
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_43_0__MET08ANLYSDIFAAST230__Archive() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__Archive();
|
||||
|
||||
#if true
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_43_0__MET08ANLYSDIFAAST230__Dummy() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__Dummy();
|
||||
|
||||
|
@ -0,0 +1,116 @@
|
||||
using Adaptation._Tests.Shared;
|
||||
using Adaptation.Shared;
|
||||
using Adaptation.Shared.Methods;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Adaptation._Tests.Extract.Staging.v2_47_5;
|
||||
|
||||
[TestClass]
|
||||
public class MET08ANLYSDIFAAST230
|
||||
{
|
||||
|
||||
#pragma warning disable CA2254
|
||||
#pragma warning disable IDE0060
|
||||
|
||||
private static CreateSelfDescription.Staging.v2_47_5.MET08ANLYSDIFAAST230 _MET08ANLYSDIFAAST230;
|
||||
|
||||
[ClassInitialize]
|
||||
public static void ClassInitialize(TestContext testContext)
|
||||
{
|
||||
CreateSelfDescription.Staging.v2_47_5.MET08ANLYSDIFAAST230.ClassInitialize(testContext);
|
||||
_MET08ANLYSDIFAAST230 = CreateSelfDescription.Staging.v2_47_5.MET08ANLYSDIFAAST230.EAFLoggingUnitTesting;
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_47_5__MET08ANLYSDIFAAST230__MoveMatchingFiles() => _MET08ANLYSDIFAAST230.Staging__v2_47_5__MET08ANLYSDIFAAST230__MoveMatchingFiles();
|
||||
|
||||
#if DEBUG
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_47_5__MET08ANLYSDIFAAST230__MoveMatchingFiles637710931421087642__Normal()
|
||||
{
|
||||
string check = "*.pdsf";
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
_MET08ANLYSDIFAAST230.Staging__v2_47_5__MET08ANLYSDIFAAST230__MoveMatchingFiles();
|
||||
string[] variables = _MET08ANLYSDIFAAST230.AdaptationTesting.GetVariables(methodBase, check, validatePDSF: false);
|
||||
IFileRead fileRead = _MET08ANLYSDIFAAST230.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
|
||||
Logistics logistics = new(fileRead);
|
||||
_ = AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics, validatePDSF: false);
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_47_5__MET08ANLYSDIFAAST230__OpenInsightMetrologyViewer() => _MET08ANLYSDIFAAST230.Staging__v2_47_5__MET08ANLYSDIFAAST230__OpenInsightMetrologyViewer();
|
||||
|
||||
#if DEBUG
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_47_5__MET08ANLYSDIFAAST230__IQSSi() => _MET08ANLYSDIFAAST230.Staging__v2_47_5__MET08ANLYSDIFAAST230__IQSSi();
|
||||
|
||||
#if DEBUG
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_47_5__MET08ANLYSDIFAAST230__OpenInsight() => _MET08ANLYSDIFAAST230.Staging__v2_47_5__MET08ANLYSDIFAAST230__OpenInsight();
|
||||
|
||||
#if DEBUG
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_47_5__MET08ANLYSDIFAAST230__OpenInsightMetrologyViewerAttachments() => _MET08ANLYSDIFAAST230.Staging__v2_47_5__MET08ANLYSDIFAAST230__OpenInsightMetrologyViewerAttachments();
|
||||
|
||||
#if DEBUG
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_47_5__MET08ANLYSDIFAAST230__APC() => _MET08ANLYSDIFAAST230.Staging__v2_47_5__MET08ANLYSDIFAAST230__APC();
|
||||
|
||||
#if DEBUG
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_47_5__MET08ANLYSDIFAAST230__SPaCe() => _MET08ANLYSDIFAAST230.Staging__v2_47_5__MET08ANLYSDIFAAST230__SPaCe();
|
||||
|
||||
#if DEBUG
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_47_5__MET08ANLYSDIFAAST230__Processed() => _MET08ANLYSDIFAAST230.Staging__v2_47_5__MET08ANLYSDIFAAST230__Processed();
|
||||
|
||||
#if DEBUG
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_47_5__MET08ANLYSDIFAAST230__Archive() => _MET08ANLYSDIFAAST230.Staging__v2_47_5__MET08ANLYSDIFAAST230__Archive();
|
||||
|
||||
#if DEBUG
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_47_5__MET08ANLYSDIFAAST230__Archive638144101790470000__Normal()
|
||||
{
|
||||
string check = "*.pdsf";
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
_MET08ANLYSDIFAAST230.Staging__v2_47_5__MET08ANLYSDIFAAST230__Archive();
|
||||
string[] variables = _MET08ANLYSDIFAAST230.AdaptationTesting.GetVariables(methodBase, check, validatePDSF: false);
|
||||
IFileRead fileRead = _MET08ANLYSDIFAAST230.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
|
||||
Logistics logistics = new(fileRead);
|
||||
_ = AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics);
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging__v2_47_5__MET08ANLYSDIFAAST230__Dummy() => _MET08ANLYSDIFAAST230.Staging__v2_47_5__MET08ANLYSDIFAAST230__Dummy();
|
||||
|
||||
}
|
@ -26,10 +26,13 @@ namespace Adaptation._Tests.Shared;
|
||||
public class AdaptationTesting : ISMTP
|
||||
{
|
||||
|
||||
protected readonly string _DummyRoot;
|
||||
protected readonly string _Environment;
|
||||
protected readonly string _HostNameAndPort;
|
||||
protected readonly bool _HasWaitForProperty;
|
||||
protected readonly TestContext _TestContext;
|
||||
protected readonly bool _SkipEquipmentDictionary;
|
||||
protected readonly string _TestContextPropertiesAsJson;
|
||||
protected readonly Dictionary<string, CellInstanceVersion> _CellInstanceVersions;
|
||||
protected readonly Dictionary<string, EquipmentTypeVersion> _EquipmentTypeVersions;
|
||||
protected readonly Dictionary<string, string> _ParameterizedModelObjectDefinitionTypes;
|
||||
@ -38,10 +41,13 @@ public class AdaptationTesting : ISMTP
|
||||
protected readonly Dictionary<string, IList<ModelObjectParameterDefinition>> _ModelObjectParameters;
|
||||
protected readonly Dictionary<string, List<Tuple<string, string>>> _EquipmentDictionaryEventDescriptions;
|
||||
|
||||
public string DummyRoot => _DummyRoot;
|
||||
public string Environment => _Environment;
|
||||
public TestContext TestContext => _TestContext;
|
||||
public string HostNameAndPort => _HostNameAndPort;
|
||||
public bool HasWaitForProperty => _HasWaitForProperty;
|
||||
public bool SkipEquipmentDictionary => _SkipEquipmentDictionary;
|
||||
public string TestContextPropertiesAsJson => _TestContextPropertiesAsJson;
|
||||
public Dictionary<string, CellInstanceVersion> CellInstanceVersions => _CellInstanceVersions;
|
||||
public Dictionary<string, EquipmentTypeVersion> EquipmentTypeVersions => _EquipmentTypeVersions;
|
||||
public Dictionary<string, IList<ModelObjectParameterDefinition>> ModelObjectParameters => _ModelObjectParameters;
|
||||
@ -56,17 +62,22 @@ public class AdaptationTesting : ISMTP
|
||||
|
||||
void ISMTP.SendNormalPriorityEmailMessage(string subject, string body) => throw new NotImplementedException();
|
||||
|
||||
public AdaptationTesting(TestContext testContext, bool skipEquipmentDictionary)
|
||||
public AdaptationTesting(string dummyRoot, TestContext testContext, bool skipEquipmentDictionary, string testContextPropertiesAsJson, bool hasWaitForProperty)
|
||||
{
|
||||
|
||||
string environment = GetEnvironment(testContext);
|
||||
string hostNameAndPort = GetHostNameAndPort(environment);
|
||||
_DummyRoot = dummyRoot;
|
||||
_TestContext = testContext;
|
||||
_Environment = environment;
|
||||
_HostNameAndPort = hostNameAndPort;
|
||||
_HasWaitForProperty = hasWaitForProperty;
|
||||
_SkipEquipmentDictionary = skipEquipmentDictionary;
|
||||
_TestContextPropertiesAsJson = testContextPropertiesAsJson;
|
||||
_CellInstanceVersions = new Dictionary<string, CellInstanceVersion>();
|
||||
_EquipmentTypeVersions = new Dictionary<string, EquipmentTypeVersion>();
|
||||
_EquipmentTypeVersions = new Dictionary<string, EquipmentTypeVersion>();
|
||||
_ParameterizedModelObjectDefinitionTypes = new Dictionary<string, string>();
|
||||
_ParameterizedModelObjectDefinitionTypes = new Dictionary<string, string>();
|
||||
_EquipmentDictionaryVersions = new Dictionary<string, EquipmentDictionaryVersion>();
|
||||
_FileConnectorConfigurations = new Dictionary<string, FileConnectorConfiguration>();
|
||||
@ -94,23 +105,28 @@ public class AdaptationTesting : ISMTP
|
||||
return result;
|
||||
}
|
||||
|
||||
protected string GetTestResultsDirectory()
|
||||
public static string GetTestResultsDirectory(string testContextTestResultsDirectory, bool hasWaitForProperty)
|
||||
{
|
||||
string result = string.Empty;
|
||||
string testResults = "05_TestResults";
|
||||
string checkDirectory = _TestContext.TestResultsDirectory;
|
||||
if (string.IsNullOrEmpty(checkDirectory) || !checkDirectory.Contains(testResults))
|
||||
throw new Exception();
|
||||
string rootDirectory = Path.GetPathRoot(checkDirectory);
|
||||
for (int i = 0; i < int.MaxValue; i++)
|
||||
string checkDirectory = testContextTestResultsDirectory;
|
||||
if (hasWaitForProperty && (string.IsNullOrEmpty(checkDirectory) || !checkDirectory.Contains(testResults)))
|
||||
throw new Exception($"A:{checkDirectory}; B:{testResults};");
|
||||
else if (!hasWaitForProperty && (string.IsNullOrEmpty(checkDirectory) || !checkDirectory.Contains(testResults)))
|
||||
result = testContextTestResultsDirectory;
|
||||
else
|
||||
{
|
||||
checkDirectory = Path.GetDirectoryName(checkDirectory);
|
||||
if (string.IsNullOrEmpty(checkDirectory) || checkDirectory == rootDirectory)
|
||||
break;
|
||||
if (checkDirectory.EndsWith(testResults) && Directory.Exists(checkDirectory))
|
||||
string rootDirectory = Path.GetPathRoot(checkDirectory);
|
||||
for (int i = 0; i < int.MaxValue; i++)
|
||||
{
|
||||
result = checkDirectory;
|
||||
break;
|
||||
checkDirectory = Path.GetDirectoryName(checkDirectory);
|
||||
if (string.IsNullOrEmpty(checkDirectory) || checkDirectory == rootDirectory)
|
||||
break;
|
||||
if (checkDirectory.EndsWith(testResults) && Directory.Exists(checkDirectory))
|
||||
{
|
||||
result = checkDirectory;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (string.IsNullOrEmpty(result))
|
||||
@ -118,6 +134,12 @@ public class AdaptationTesting : ISMTP
|
||||
return result;
|
||||
}
|
||||
|
||||
private string GetTestResultsDirectory(bool hasWaitForProperty)
|
||||
{
|
||||
string result = GetTestResultsDirectory(_TestContext.TestResultsDirectory, hasWaitForProperty);
|
||||
return result;
|
||||
}
|
||||
|
||||
protected static string GetCellInstanceConnectionName(string cellInstanceConnectionName)
|
||||
{
|
||||
string result;
|
||||
@ -170,28 +192,29 @@ public class AdaptationTesting : ISMTP
|
||||
return results;
|
||||
}
|
||||
|
||||
internal string[] GetSegments(string methodBaseName)
|
||||
public static MethodBaseName GetMethodBaseName(string dummyRoot, string environment, bool hasWaitForProperty, string methodBaseName, string testResultsDirectory)
|
||||
{
|
||||
List<string> results;
|
||||
string fileFullName;
|
||||
MethodBaseName result;
|
||||
string comment;
|
||||
string[] textFiles;
|
||||
string fileFullName;
|
||||
string dummyDirectory;
|
||||
string withActualCICN;
|
||||
string separator = "__";
|
||||
string textFileDirectory;
|
||||
string connectionNameAndTicks;
|
||||
string cellInstanceConnectionName;
|
||||
string ticks = DateTime.Now.Ticks.ToString();
|
||||
string cellInstanceConnectionNameFromMethodBaseName;
|
||||
string testResultsDirectory = GetTestResultsDirectory();
|
||||
string[] segments = methodBaseName.Split(new string[] { separator }, StringSplitOptions.None);
|
||||
if (segments[0] != _Environment)
|
||||
if (segments[0] != environment)
|
||||
throw new Exception();
|
||||
string rawVersionName = segments[1];
|
||||
string rawCellInstanceName = segments[2];
|
||||
string cellInstanceVersionName = segments[1].Replace('_', '.');
|
||||
string cellInstanceName = segments[2].Replace('_', '-').Replace("_EQPT", "-EQPT");
|
||||
string before = string.Concat(_Environment, separator, rawVersionName, separator, cellInstanceName, separator);
|
||||
string before = string.Concat(environment, separator, rawVersionName, separator, cellInstanceName, separator);
|
||||
string after = methodBaseName.Substring(before.Length);
|
||||
string versionDirectory = Path.Combine(testResultsDirectory, _Environment, cellInstanceName, cellInstanceVersionName);
|
||||
string versionDirectory = Path.Combine(testResultsDirectory, environment, cellInstanceName, cellInstanceVersionName);
|
||||
if (!Directory.Exists(versionDirectory))
|
||||
_ = Directory.CreateDirectory(versionDirectory);
|
||||
comment = segments[segments.Length - 1];
|
||||
@ -221,87 +244,76 @@ public class AdaptationTesting : ISMTP
|
||||
cellInstanceConnectionNameFromMethodBaseName = after;
|
||||
}
|
||||
cellInstanceConnectionName = GetCellInstanceConnectionName(cellInstanceConnectionNameFromMethodBaseName);
|
||||
string methodBaseNameWithActualCICN = GetMethodBaseNameWithActualCICN(methodBaseName, rawCellInstanceName, cellInstanceConnectionNameFromMethodBaseName, cellInstanceConnectionName, ticks);
|
||||
withActualCICN = GetMethodBaseNameWithActualCICN(methodBaseName, rawCellInstanceName, cellInstanceConnectionNameFromMethodBaseName, cellInstanceConnectionName, ticks);
|
||||
if (hasWaitForProperty)
|
||||
dummyDirectory = string.Empty;
|
||||
else if (string.IsNullOrEmpty(ticks))
|
||||
dummyDirectory = string.Empty;
|
||||
else
|
||||
{
|
||||
if (string.IsNullOrEmpty(dummyRoot))
|
||||
throw new Exception($"{nameof(dummyRoot)} is empty!");
|
||||
if (!withActualCICN.Contains(ticks))
|
||||
throw new Exception($"{withActualCICN} doesn't contain {ticks}!");
|
||||
segments = withActualCICN.Split(new string[] { ticks }, StringSplitOptions.None);
|
||||
dummyDirectory = Path.Combine(dummyRoot, cellInstanceName, ticks, string.Join(null, segments));
|
||||
if (!Directory.Exists(dummyDirectory))
|
||||
_ = Directory.CreateDirectory(dummyDirectory);
|
||||
}
|
||||
if (string.IsNullOrEmpty(ticks))
|
||||
{
|
||||
textFiles = Array.Empty<string>();
|
||||
fileFullName = Path.Combine(versionDirectory, methodBaseNameWithActualCICN, $"{cellInstanceConnectionNameFromMethodBaseName}.json");
|
||||
textFileDirectory = string.Empty;
|
||||
fileFullName = Path.Combine(versionDirectory, withActualCICN, $"{cellInstanceConnectionNameFromMethodBaseName}.json");
|
||||
}
|
||||
else
|
||||
{
|
||||
segments = methodBaseNameWithActualCICN.Split(new string[] { ticks }, StringSplitOptions.None);
|
||||
string textDirectory = Path.Combine(versionDirectory, segments[0], string.Concat(ticks, segments[1]));
|
||||
segments = withActualCICN.Split(new string[] { ticks }, StringSplitOptions.None);
|
||||
textFileDirectory = Path.Combine(versionDirectory, segments[0], string.Concat(ticks, segments[1]));
|
||||
fileFullName = Path.Combine(versionDirectory, segments[0], $"{cellInstanceConnectionNameFromMethodBaseName}.json");
|
||||
if (!Directory.Exists(textDirectory))
|
||||
}
|
||||
result = new(after, before, cellInstanceConnectionName, cellInstanceConnectionNameFromMethodBaseName, cellInstanceName, cellInstanceVersionName, comment, dummyDirectory, fileFullName, rawCellInstanceName, rawVersionName, separator, testResultsDirectory, textFileDirectory, ticks, versionDirectory, withActualCICN);
|
||||
return result;
|
||||
}
|
||||
|
||||
private MethodBaseName GetMethodBaseName(MethodBase methodBase)
|
||||
{
|
||||
MethodBaseName result;
|
||||
string testResultsDirectory = GetTestResultsDirectory(_HasWaitForProperty);
|
||||
result = GetMethodBaseName(_DummyRoot, _Environment, _HasWaitForProperty, methodBase.Name, testResultsDirectory);
|
||||
return result;
|
||||
}
|
||||
|
||||
private string[] GetTextFiles(MethodBaseName mbn)
|
||||
{
|
||||
string[] results;
|
||||
if (string.IsNullOrEmpty(mbn.TextFileDirectory))
|
||||
results = Array.Empty<string>();
|
||||
else if (!Directory.Exists(mbn.TextFileDirectory))
|
||||
{
|
||||
results = Array.Empty<string>();
|
||||
if (!_HasWaitForProperty)
|
||||
_ = Directory.CreateDirectory(mbn.TextFileDirectory);
|
||||
else
|
||||
{
|
||||
textFiles = Array.Empty<string>();
|
||||
string renameDirectory = Path.Combine(Path.GetDirectoryName(textDirectory), $"_Rename - {Path.GetFileName(textDirectory)}");
|
||||
string renameDirectory = Path.Combine(Path.GetDirectoryName(mbn.TextFileDirectory), $"_Rename - {Path.GetFileName(mbn.TextFileDirectory)}");
|
||||
_ = Directory.CreateDirectory(renameDirectory);
|
||||
_ = Process.Start("explorer.exe", renameDirectory);
|
||||
File.WriteAllText(Path.Combine(renameDirectory, $"{nameof(FileConnectorConfiguration.SourceFileFilter)}.txt"), string.Empty);
|
||||
File.WriteAllText(Path.Combine(renameDirectory, $"{nameof(FileConnectorConfiguration.SourceFileLocation)}.txt"), string.Empty);
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
results = Directory.GetFiles(mbn.TextFileDirectory, "*.txt", SearchOption.TopDirectoryOnly);
|
||||
if (!string.IsNullOrEmpty(mbn.Ticks) && _HasWaitForProperty && !results.Any())
|
||||
{
|
||||
textFiles = Directory.GetFiles(textDirectory, "*.txt", SearchOption.TopDirectoryOnly);
|
||||
if (!textFiles.Any())
|
||||
{
|
||||
_ = Process.Start("explorer.exe", textDirectory);
|
||||
File.WriteAllText(Path.Combine(textDirectory, "_ Why.why"), string.Empty);
|
||||
}
|
||||
_ = Process.Start("explorer.exe", mbn.TextFileDirectory);
|
||||
File.WriteAllText(Path.Combine(mbn.TextFileDirectory, "_ Why.why"), string.Empty);
|
||||
}
|
||||
}
|
||||
results = new List<string>
|
||||
{
|
||||
_Environment,
|
||||
rawCellInstanceName,
|
||||
cellInstanceName,
|
||||
cellInstanceVersionName,
|
||||
cellInstanceConnectionNameFromMethodBaseName,
|
||||
cellInstanceConnectionName,
|
||||
ticks,
|
||||
comment,
|
||||
fileFullName
|
||||
};
|
||||
results.AddRange(textFiles);
|
||||
return results.ToArray();
|
||||
}
|
||||
|
||||
internal string[] GetSegments(MethodBase methodBase)
|
||||
{
|
||||
string[] results = GetSegments(methodBase.Name);
|
||||
return results;
|
||||
}
|
||||
|
||||
internal static string GetEnvironment(string[] segments) => segments[0];
|
||||
|
||||
internal static string GetRawCellInstanceName(string[] segments) => segments[1];
|
||||
|
||||
internal static string GetCellInstanceName(string[] segments) => segments[2];
|
||||
|
||||
internal static string GetCellInstanceVersionName(string[] segments) => segments[3];
|
||||
|
||||
internal static string GetCellInstanceConnectionNameFromMethodBaseName(string[] segments) => segments[4];
|
||||
|
||||
internal static string GetCellInstanceConnectionName(string[] segments) => segments[5];
|
||||
|
||||
internal static string GetTicks(string[] segments) => segments[6];
|
||||
|
||||
internal static string GetComment(string[] segments) => segments[7];
|
||||
|
||||
internal static FileInfo GetFileName(string[] segments) => new(segments[8]);
|
||||
|
||||
internal static string[] GetTextFiles(string[] segments)
|
||||
{
|
||||
List<string> results = new();
|
||||
if (segments.Length > 8)
|
||||
{
|
||||
for (int i = 9; i < segments.Length; i++)
|
||||
results.Add(segments[i]);
|
||||
}
|
||||
return results.ToArray();
|
||||
}
|
||||
|
||||
protected static Stream ToStream(string @this)
|
||||
{
|
||||
MemoryStream memoryStream = new();
|
||||
@ -331,7 +343,7 @@ public class AdaptationTesting : ISMTP
|
||||
return result as T;
|
||||
}
|
||||
|
||||
protected static CellInstanceVersion GetCellInstanceVersion(string url)
|
||||
public static CellInstanceVersion GetCellInstanceVersion(string url)
|
||||
{
|
||||
CellInstanceVersion result;
|
||||
byte[] byteArray;
|
||||
@ -466,6 +478,7 @@ public class AdaptationTesting : ISMTP
|
||||
AppendLine("#pragma warning disable CA2254").
|
||||
AppendLine("#pragma warning disable IDE0060").
|
||||
AppendLine().
|
||||
AppendLine("internal static string DummyRoot { get; private set; }").
|
||||
Append("internal static ").Append(cellInstanceNameWithoutHyphen).AppendLine(" EAFLoggingUnitTesting { get; private set; }");
|
||||
else
|
||||
throw new Exception();
|
||||
@ -474,13 +487,15 @@ public class AdaptationTesting : ISMTP
|
||||
else if (i == 1)
|
||||
_ = stringBuilder.
|
||||
AppendLine().
|
||||
Append("public ").Append(cellInstanceNameWithoutHyphen).AppendLine("() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false)").
|
||||
Append("static ").Append(cellInstanceNameWithoutHyphen).AppendLine("() => DummyRoot = @\"\\\\messv02ecc1.ec.local\\EC_Characterization_Si\\Dummy\";").
|
||||
AppendLine().
|
||||
Append("public ").Append(cellInstanceNameWithoutHyphen).AppendLine("() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false)").
|
||||
AppendLine("{").
|
||||
AppendLine("if (EAFLoggingUnitTesting is null)").
|
||||
AppendLine("throw new Exception();").
|
||||
AppendLine("}").
|
||||
AppendLine().
|
||||
Append("public ").Append(cellInstanceNameWithoutHyphen).AppendLine("(TestContext testContext) : base(testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false)").
|
||||
Append("public ").Append(cellInstanceNameWithoutHyphen).AppendLine("(TestContext testContext) : base(DummyRoot, testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false)").
|
||||
AppendLine("{").
|
||||
AppendLine("}").
|
||||
AppendLine();
|
||||
@ -541,6 +556,9 @@ public class AdaptationTesting : ISMTP
|
||||
if (i == 2)
|
||||
{
|
||||
_ = stringBuilder.
|
||||
AppendLine("#if true").
|
||||
AppendLine("[Ignore]").
|
||||
AppendLine("#endif").
|
||||
AppendLine("[TestMethod]").
|
||||
Append("public void ").Append(methodName).Append("() => ").Append('_').Append(cellInstanceNameWithoutHyphen).Append('.').Append(methodName).AppendLine("();").AppendLine();
|
||||
}
|
||||
@ -550,13 +568,16 @@ public class AdaptationTesting : ISMTP
|
||||
throw new Exception("Versions should match!");
|
||||
equipmentTypeName = componentsCellComponentCellComponent.Equipment.EquipmentType.Name;
|
||||
_ = stringBuilder.
|
||||
AppendLine("#if true").
|
||||
AppendLine("[Ignore]").
|
||||
AppendLine("#endif").
|
||||
AppendLine("[TestMethod]").
|
||||
Append("public void ").Append(methodName).AppendLine("()").
|
||||
AppendLine("{").
|
||||
Append("string check = \"").Append(check.Split('\\').Last()).AppendLine("\";").
|
||||
AppendLine("MethodBase methodBase = new StackFrame().GetMethod();").
|
||||
AppendLine("EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, \" - Getting configuration\"));").
|
||||
AppendLine("_ = Shared.AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);").
|
||||
AppendLine("_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);").
|
||||
AppendLine("EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, \" - Exit\"));").
|
||||
AppendLine("}").
|
||||
AppendLine();
|
||||
@ -600,14 +621,10 @@ public class AdaptationTesting : ISMTP
|
||||
result = JsonSerializer.Deserialize<FileConnectorConfiguration>(json, jsonSerializerOptions);
|
||||
if (string.IsNullOrEmpty(result.SourceFileFilter))
|
||||
result.SourceFileFilter = string.Empty;
|
||||
if (result.ErrorTargetFileLocation is null)
|
||||
result.ErrorTargetFileLocation = string.Empty;
|
||||
if (result.SourceFileLocation is null)
|
||||
result.SourceFileLocation = string.Empty;
|
||||
if (result.TargetFileLocation is null)
|
||||
result.TargetFileLocation = string.Empty;
|
||||
if (result.FolderAgeCheckIndividualSubFolders is null)
|
||||
result.FolderAgeCheckIndividualSubFolders = false;
|
||||
result.ErrorTargetFileLocation ??= string.Empty;
|
||||
result.SourceFileLocation ??= string.Empty;
|
||||
result.TargetFileLocation ??= string.Empty;
|
||||
result.FolderAgeCheckIndividualSubFolders ??= false;
|
||||
result.ConnectionSettings = new List<ConnectionSetting>();
|
||||
result.SourceFileFilters = result.SourceFileFilter.Split('|').ToList();
|
||||
if (componentsCellComponentCellComponent.Equipment?.ConnectionSettings is not null)
|
||||
@ -857,7 +874,7 @@ public class AdaptationTesting : ISMTP
|
||||
return result;
|
||||
}
|
||||
|
||||
protected Dictionary<string, object> GetKeyValuePairs(string cellInstanceName, string cellInstanceVersionName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, List<Tuple<string, string>> equipmentDictionaryIsAlwaysEnabledEvents)
|
||||
protected Dictionary<string, object> GetKeyValuePairs(string cellInstanceName, string cellInstanceVersionName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, List<Tuple<string, string>> equipmentDictionaryIsAlwaysEnabledEvents, int edaConnectionPortNumber)
|
||||
{
|
||||
Dictionary<string, object> results = new()
|
||||
{
|
||||
@ -866,6 +883,7 @@ public class AdaptationTesting : ISMTP
|
||||
{ nameof(cellInstanceName), cellInstanceName },
|
||||
{ nameof(equipmentTypeName), equipmentTypeName },
|
||||
{ nameof(cellInstanceVersionName), cellInstanceVersionName },
|
||||
{ nameof(edaConnectionPortNumber), edaConnectionPortNumber },
|
||||
{ nameof(equipmentDictionaryName), equipmentDictionaryName },
|
||||
{ nameof(cellInstanceConnectionName), cellInstanceConnectionName },
|
||||
{ nameof(FileConnectorConfiguration), fileConnectorConfiguration },
|
||||
@ -879,32 +897,26 @@ public class AdaptationTesting : ISMTP
|
||||
public string[] GetCSharpText(string testName)
|
||||
{
|
||||
string[] results;
|
||||
string[] segments = GetSegments(testName);
|
||||
FileInfo fileInfo = GetFileName(segments);
|
||||
string cellInstanceName = GetCellInstanceName(segments);
|
||||
string cellInstanceVersionName = GetCellInstanceVersionName(segments);
|
||||
string cellInstanceConnectionName = GetCellInstanceConnectionName(segments);
|
||||
if (!string.IsNullOrEmpty(cellInstanceConnectionName) && !Directory.Exists(fileInfo.DirectoryName))
|
||||
string testResultsDirectory = GetTestResultsDirectory(_HasWaitForProperty);
|
||||
MethodBaseName mbn = GetMethodBaseName(_DummyRoot, _Environment, _HasWaitForProperty, testName, testResultsDirectory);
|
||||
FileInfo fileInfo = new(mbn.FileFullName);
|
||||
if (!string.IsNullOrEmpty(mbn.CellInstanceConnectionName) && !Directory.Exists(fileInfo.DirectoryName))
|
||||
_ = Directory.CreateDirectory(fileInfo.Directory.FullName);
|
||||
Tuple<string, CellInstanceVersion> cellInstanceVersionTuple = GetCellInstanceVersionTuple(cellInstanceName, cellInstanceVersionName);
|
||||
results = GetCSharpTextB(fileInfo, cellInstanceName, cellInstanceVersionName, cellInstanceVersionTuple.Item2);
|
||||
Tuple<string, CellInstanceVersion> cellInstanceVersionTuple = GetCellInstanceVersionTuple(mbn.CellInstanceName, mbn.CellInstanceVersionName);
|
||||
results = GetCSharpTextB(fileInfo, mbn.CellInstanceName, mbn.CellInstanceVersionName, cellInstanceVersionTuple.Item2);
|
||||
return results;
|
||||
}
|
||||
|
||||
public string[] GetConfiguration(MethodBase methodBase)
|
||||
{
|
||||
string[] results;
|
||||
string[] segments = GetSegments(methodBase.Name);
|
||||
string ticks = GetTicks(segments);
|
||||
FileInfo fileInfo = GetFileName(segments);
|
||||
string cellInstanceName = GetCellInstanceName(segments);
|
||||
string cellInstanceVersionName = GetCellInstanceVersionName(segments);
|
||||
string cellInstanceConnectionName = GetCellInstanceConnectionName(segments);
|
||||
if (!string.IsNullOrEmpty(cellInstanceConnectionName) && !Directory.Exists(fileInfo.DirectoryName))
|
||||
MethodBaseName mbn = GetMethodBaseName(methodBase);
|
||||
FileInfo fileInfo = new(mbn.FileFullName);
|
||||
if (!string.IsNullOrEmpty(mbn.CellInstanceConnectionName) && !Directory.Exists(fileInfo.DirectoryName))
|
||||
_ = Directory.CreateDirectory(fileInfo.Directory.FullName);
|
||||
Tuple<string, CellInstanceVersion> cellInstanceVersionTuple = GetCellInstanceVersionTuple(cellInstanceName, cellInstanceVersionName);
|
||||
Tuple<string, FileConnectorConfiguration> fileConnectorConfigurationTuple = GetFileConnectorConfigurationTuple(cellInstanceVersionTuple, cellInstanceConnectionName);
|
||||
if (string.IsNullOrEmpty(ticks) && fileConnectorConfigurationTuple.Item2?.FileScanningIntervalInSeconds is not null)
|
||||
Tuple<string, CellInstanceVersion> cellInstanceVersionTuple = GetCellInstanceVersionTuple(mbn.CellInstanceName, mbn.CellInstanceVersionName);
|
||||
Tuple<string, FileConnectorConfiguration> fileConnectorConfigurationTuple = GetFileConnectorConfigurationTuple(cellInstanceVersionTuple, mbn.CellInstanceConnectionName);
|
||||
if (string.IsNullOrEmpty(mbn.Ticks) && fileConnectorConfigurationTuple.Item2?.FileScanningIntervalInSeconds is not null)
|
||||
{
|
||||
string fileScanningIntervalInSecondsLine;
|
||||
string versionDirectory = Path.GetDirectoryName(fileInfo.DirectoryName);
|
||||
@ -914,12 +926,12 @@ public class AdaptationTesting : ISMTP
|
||||
fileScanningIntervalInSecondsLine = $"+\t{fileConnectorConfigurationTuple.Item2.FileScanningIntervalInSeconds.Value:+0000}\t{Path.GetFileName(fileInfo.DirectoryName)}";
|
||||
File.AppendAllLines(Path.Combine(versionDirectory, "FileScanningIntervalInSeconds.txt"), new string[] { fileScanningIntervalInSecondsLine });
|
||||
}
|
||||
Tuple<string, string, string, EquipmentTypeVersion> equipmentTypeVersionTuple = GetEquipmentTypeVersionTuple(cellInstanceVersionTuple.Item2, cellInstanceConnectionName);
|
||||
Tuple<string, string, string, EquipmentTypeVersion> equipmentTypeVersionTuple = GetEquipmentTypeVersionTuple(cellInstanceVersionTuple.Item2, mbn.CellInstanceConnectionName);
|
||||
Tuple<string, string> parameterizedModelObjectDefinitionTypeTuple = GetParameterizedModelObjectDefinitionTypeTuple(equipmentTypeVersionTuple);
|
||||
Tuple<string, IList<ModelObjectParameterDefinition>> modelObjectParametersTuple = GetModelObjectParameters(equipmentTypeVersionTuple);
|
||||
Tuple<string, string, string, EquipmentDictionaryVersion> equipmentDictionaryVersionTuple = GetEquipmentDictionaryVersionTuple(cellInstanceVersionTuple.Item2, cellInstanceConnectionName, equipmentTypeVersionTuple.Item4);
|
||||
Tuple<string, string, string, EquipmentDictionaryVersion> equipmentDictionaryVersionTuple = GetEquipmentDictionaryVersionTuple(cellInstanceVersionTuple.Item2, mbn.CellInstanceConnectionName, equipmentTypeVersionTuple.Item4);
|
||||
Tuple<string, List<Tuple<string, string>>> equipmentDictionaryIsAlwaysEnabledEventsTuple = GetEquipmentDictionaryIsAlwaysEnabledEventsTuple(equipmentDictionaryVersionTuple);
|
||||
Dictionary<string, object> objects = GetKeyValuePairs(cellInstanceName, cellInstanceVersionName, cellInstanceConnectionName, fileConnectorConfigurationTuple.Item2, equipmentTypeVersionTuple.Item2, parameterizedModelObjectDefinitionTypeTuple.Item2, modelObjectParametersTuple.Item2, equipmentDictionaryVersionTuple.Item2, equipmentDictionaryIsAlwaysEnabledEventsTuple.Item2);
|
||||
Dictionary<string, object> objects = GetKeyValuePairs(mbn.CellInstanceName, mbn.CellInstanceVersionName, mbn.CellInstanceConnectionName, fileConnectorConfigurationTuple.Item2, equipmentTypeVersionTuple.Item2, parameterizedModelObjectDefinitionTypeTuple.Item2, modelObjectParametersTuple.Item2, equipmentDictionaryVersionTuple.Item2, equipmentDictionaryIsAlwaysEnabledEventsTuple.Item2, cellInstanceVersionTuple.Item2.EdaConnection.PortNumber);
|
||||
string json = JsonSerializer.Serialize(objects, new JsonSerializerOptions { WriteIndented = true });
|
||||
results = new string[] { fileInfo.FullName, json };
|
||||
return results;
|
||||
@ -928,22 +940,19 @@ public class AdaptationTesting : ISMTP
|
||||
public IFileRead Get(MethodBase methodBase, string sourceFileLocation, string sourceFileFilter, bool useCyclicalForDescription)
|
||||
{
|
||||
IFileRead result;
|
||||
string[] segments = GetSegments(methodBase.Name);
|
||||
FileInfo fileInfo = GetFileName(segments);
|
||||
string cellInstanceName = GetCellInstanceName(segments);
|
||||
string cellInstanceVersionName = GetCellInstanceVersionName(segments);
|
||||
MethodBaseName mbn = GetMethodBaseName(methodBase);
|
||||
FileInfo fileInfo = new(mbn.FileFullName);
|
||||
Dictionary<string, string> fileParameter = new();
|
||||
string cellInstanceConnectionName = GetCellInstanceConnectionName(segments);
|
||||
if (!string.IsNullOrEmpty(cellInstanceConnectionName) && !Directory.Exists(fileInfo.DirectoryName))
|
||||
if (!string.IsNullOrEmpty(mbn.CellInstanceConnectionName) && !Directory.Exists(fileInfo.DirectoryName))
|
||||
_ = Directory.CreateDirectory(fileInfo.Directory.FullName);
|
||||
Dictionary<string, List<long>> dummyRuns = new();
|
||||
Dictionary<long, List<string>> staticRuns = new();
|
||||
Tuple<string, CellInstanceVersion> cellInstanceVersionTuple = GetCellInstanceVersionTuple(cellInstanceName, cellInstanceVersionName);
|
||||
Tuple<string, FileConnectorConfiguration> fileConnectorConfigurationTuple = GetFileConnectorConfigurationTuple(cellInstanceVersionTuple, cellInstanceConnectionName);
|
||||
Tuple<string, string, string, EquipmentTypeVersion> equipmentTypeVersionTuple = GetEquipmentTypeVersionTuple(cellInstanceVersionTuple.Item2, cellInstanceConnectionName);
|
||||
Tuple<string, CellInstanceVersion> cellInstanceVersionTuple = GetCellInstanceVersionTuple(mbn.CellInstanceName, mbn.CellInstanceVersionName);
|
||||
Tuple<string, FileConnectorConfiguration> fileConnectorConfigurationTuple = GetFileConnectorConfigurationTuple(cellInstanceVersionTuple, mbn.CellInstanceConnectionName);
|
||||
Tuple<string, string, string, EquipmentTypeVersion> equipmentTypeVersionTuple = GetEquipmentTypeVersionTuple(cellInstanceVersionTuple.Item2, mbn.CellInstanceConnectionName);
|
||||
Tuple<string, string> parameterizedModelObjectDefinitionTypeTuple = GetParameterizedModelObjectDefinitionTypeTuple(equipmentTypeVersionTuple);
|
||||
Tuple<string, IList<ModelObjectParameterDefinition>> modelObjectParametersTuple = GetModelObjectParameters(equipmentTypeVersionTuple);
|
||||
Tuple<string, string, string, EquipmentDictionaryVersion> equipmentDictionaryVersionTuple = GetEquipmentDictionaryVersionTuple(cellInstanceVersionTuple.Item2, cellInstanceConnectionName, equipmentTypeVersionTuple.Item4);
|
||||
Tuple<string, string, string, EquipmentDictionaryVersion> equipmentDictionaryVersionTuple = GetEquipmentDictionaryVersionTuple(cellInstanceVersionTuple.Item2, mbn.CellInstanceConnectionName, equipmentTypeVersionTuple.Item4);
|
||||
_ = GetEquipmentDictionaryIsAlwaysEnabledEventsTuple(equipmentDictionaryVersionTuple);
|
||||
if (!string.IsNullOrEmpty(sourceFileLocation) && sourceFileLocation != fileConnectorConfigurationTuple.Item2.SourceFileLocation)
|
||||
fileConnectorConfigurationTuple.Item2.SourceFileLocation = sourceFileLocation;
|
||||
@ -975,33 +984,29 @@ public class AdaptationTesting : ISMTP
|
||||
_ = Directory.CreateDirectory(fileConnectorConfigurationTuple.Item2.AlternateTargetFolder);
|
||||
}
|
||||
}
|
||||
result = FileHandlers.CellInstanceConnectionName.Get(this, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfigurationTuple.Item2, equipmentTypeVersionTuple.Item2, parameterizedModelObjectDefinitionTypeTuple.Item2, modelObjectParametersTuple.Item2, equipmentDictionaryVersionTuple.Item2, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: false);
|
||||
result = FileHandlers.CellInstanceConnectionName.Get(this, fileParameter, mbn.CellInstanceName, mbn.CellInstanceConnectionName, fileConnectorConfigurationTuple.Item2, equipmentTypeVersionTuple.Item2, parameterizedModelObjectDefinitionTypeTuple.Item2, modelObjectParametersTuple.Item2, equipmentDictionaryVersionTuple.Item2, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: false);
|
||||
return result;
|
||||
}
|
||||
|
||||
public string[] GetVariables(MethodBase methodBase, string check)
|
||||
public string[] GetVariables(MethodBase methodBase, string check, bool validatePDSF = true)
|
||||
{
|
||||
string[] results;
|
||||
string[] lines;
|
||||
string ipdsfFile;
|
||||
string textFileDirectory;
|
||||
string[] segments;
|
||||
string fileNameWithoutExtension;
|
||||
string searchPattern = "*.ipdsf";
|
||||
string methodBaseNameWithActualCICN;
|
||||
string sourceFileFilter = string.Empty;
|
||||
string sourceFileLocation = string.Empty;
|
||||
string[] segments = GetSegments(methodBase);
|
||||
string ticks = GetTicks(segments);
|
||||
FileInfo fileInfo = GetFileName(segments);
|
||||
string[] textFiles = GetTextFiles(segments);
|
||||
string cellInstanceName = GetCellInstanceName(segments);
|
||||
string rawCellInstanceName = GetRawCellInstanceName(segments);
|
||||
string cellInstanceConnectionName = GetCellInstanceConnectionName(segments);
|
||||
string cellInstanceConnectionNameFromMethodBaseName = GetCellInstanceConnectionNameFromMethodBaseName(segments);
|
||||
string methodBaseNameWithActualCICN = GetMethodBaseNameWithActualCICN(methodBase.Name, rawCellInstanceName, cellInstanceConnectionNameFromMethodBaseName, cellInstanceConnectionName, ticks);
|
||||
MethodBaseName mbn = GetMethodBaseName(methodBase);
|
||||
string[] textFiles = GetTextFiles(mbn);
|
||||
if (!textFiles.Any())
|
||||
textFileDirectory = string.Empty;
|
||||
else
|
||||
textFileDirectory = Path.GetDirectoryName(textFiles[0]);
|
||||
{
|
||||
if (_HasWaitForProperty)
|
||||
throw new Exception("Set text file!");
|
||||
sourceFileLocation = mbn.DummyDirectory;
|
||||
}
|
||||
foreach (string textFile in textFiles)
|
||||
{
|
||||
lines = File.ReadAllLines(textFile);
|
||||
@ -1012,18 +1017,20 @@ public class AdaptationTesting : ISMTP
|
||||
sourceFileFilter = lines[0];
|
||||
else if (fileNameWithoutExtension == nameof(FileConnectorConfiguration.SourceFileLocation))
|
||||
{
|
||||
segments = lines[0].Split(new string[] { ticks }, StringSplitOptions.None);
|
||||
methodBaseNameWithActualCICN = GetMethodBaseNameWithActualCICN(methodBase.Name, mbn.RawCellInstanceName, mbn.CellInstanceConnectionNameFromMethodBaseName, mbn.CellInstanceConnectionName, mbn.Ticks);
|
||||
segments = lines[0].Split(new string[] { mbn.Ticks }, StringSplitOptions.None);
|
||||
if (segments.Length > 2)
|
||||
throw new Exception("Ticks should only appear once in source file location!");
|
||||
if (segments.Length != 2)
|
||||
throw new Exception("Ticks missing from source file location!");
|
||||
if (segments[1].Contains(ticks))
|
||||
if (segments[1].Contains(mbn.Ticks))
|
||||
throw new Exception("From source file location path should not contain ticks!");
|
||||
if (!segments[1].EndsWith(methodBaseNameWithActualCICN.Replace(ticks, string.Empty)))
|
||||
if (!segments[1].EndsWith(methodBaseNameWithActualCICN.Replace(mbn.Ticks, string.Empty)))
|
||||
throw new Exception("Method name missing from source file location!");
|
||||
sourceFileLocation = lines[0];
|
||||
}
|
||||
}
|
||||
FileInfo fileInfo = new(mbn.FileFullName);
|
||||
if (!Directory.Exists(fileInfo.Directory.FullName))
|
||||
_ = Directory.CreateDirectory(fileInfo.Directory.FullName);
|
||||
if (!fileInfo.Exists)
|
||||
@ -1044,25 +1051,30 @@ public class AdaptationTesting : ISMTP
|
||||
fileConnectorConfiguration.SourceFileFilter = sourceFileFilter;
|
||||
if (!string.IsNullOrEmpty(sourceFileLocation))
|
||||
fileConnectorConfiguration.SourceFileLocation = sourceFileLocation;
|
||||
if (string.IsNullOrEmpty(sourceFileLocation))
|
||||
ipdsfFile = searchPattern;
|
||||
if (!validatePDSF)
|
||||
ipdsfFile = string.Empty;
|
||||
else
|
||||
{
|
||||
string ipdsfDirectory = Path.Combine(sourceFileLocation, "ipdsf");
|
||||
if (!Directory.Exists(ipdsfDirectory))
|
||||
if (string.IsNullOrEmpty(sourceFileLocation))
|
||||
ipdsfFile = searchPattern;
|
||||
else
|
||||
{
|
||||
string[] files = Directory.GetFiles(ipdsfDirectory, searchPattern, SearchOption.TopDirectoryOnly);
|
||||
if (files.Any())
|
||||
ipdsfFile = files[0];
|
||||
else
|
||||
string ipdsfDirectory = Path.Combine(sourceFileLocation, "ipdsf");
|
||||
if (!Directory.Exists(ipdsfDirectory))
|
||||
ipdsfFile = searchPattern;
|
||||
else
|
||||
{
|
||||
string[] files = Directory.GetFiles(ipdsfDirectory, searchPattern, SearchOption.TopDirectoryOnly);
|
||||
if (files.Any())
|
||||
ipdsfFile = files[0];
|
||||
else
|
||||
ipdsfFile = searchPattern;
|
||||
}
|
||||
}
|
||||
if (ipdsfFile == searchPattern)
|
||||
throw new Exception();
|
||||
}
|
||||
if (ipdsfFile == searchPattern)
|
||||
throw new Exception();
|
||||
results = new string[] { fileInfo.FullName, json, fileConnectorConfiguration.SourceFileLocation, fileConnectorConfiguration.SourceFileFilter, ipdsfFile, textFileDirectory };
|
||||
results = new string[] { fileInfo.FullName, json, fileConnectorConfiguration.SourceFileLocation, fileConnectorConfiguration.SourceFileFilter, ipdsfFile, mbn.TextFileDirectory };
|
||||
if (string.IsNullOrEmpty(results[0]))
|
||||
throw new Exception();
|
||||
if (string.IsNullOrEmpty(results[1]))
|
||||
@ -1071,7 +1083,7 @@ public class AdaptationTesting : ISMTP
|
||||
throw new Exception();
|
||||
if (string.IsNullOrEmpty(results[3]))
|
||||
throw new Exception();
|
||||
if (string.IsNullOrEmpty(results[4]))
|
||||
if (validatePDSF && string.IsNullOrEmpty(results[4]))
|
||||
throw new Exception();
|
||||
if (string.IsNullOrEmpty(results[5]))
|
||||
throw new Exception();
|
||||
@ -1232,29 +1244,33 @@ public class AdaptationTesting : ISMTP
|
||||
{
|
||||
string result;
|
||||
Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResult = fileRead.ReExtract();
|
||||
Assert.IsFalse(string.IsNullOrEmpty(extractResult?.Item1));
|
||||
Assert.IsTrue(extractResult.Item3.Length > 0, "extractResult Array Length check!");
|
||||
Assert.IsNotNull(extractResult.Item4);
|
||||
if (!validatePDSF)
|
||||
_ = GetLogisticsColumnsAndBody(fileRead, logistics, extractResult, new(string.Empty, Array.Empty<string>(), Array.Empty<string>()));
|
||||
else
|
||||
if (!fileRead.IsDuplicator)
|
||||
{
|
||||
Tuple<string, string[], string[]> pdsf = GetLogisticsColumnsAndBody(variables[2], variables[4]);
|
||||
Tuple<string, string[], string[]> pdsfNew = GetLogisticsColumnsAndBody(fileRead, logistics, extractResult, pdsf);
|
||||
CompareSave(variables[5], pdsf, pdsfNew);
|
||||
Assert.IsTrue(pdsf.Item1 == pdsfNew.Item1, "Item1 check!");
|
||||
string[] json = GetItem2(pdsf, pdsfNew);
|
||||
CompareSaveJSON(variables[5], json);
|
||||
Assert.IsTrue(json[0] == json[1], "Item2 check!");
|
||||
string[] join = GetItem3(pdsf, pdsfNew);
|
||||
CompareSaveTSV(variables[5], join);
|
||||
Assert.IsTrue(join[0] == join[1], "Item3 (Join) check!");
|
||||
Assert.IsFalse(string.IsNullOrEmpty(extractResult?.Item1));
|
||||
Assert.IsNotNull(extractResult.Item3);
|
||||
Assert.IsNotNull(extractResult.Item4);
|
||||
if (!validatePDSF)
|
||||
_ = GetLogisticsColumnsAndBody(fileRead, logistics, extractResult, new(string.Empty, Array.Empty<string>(), Array.Empty<string>()));
|
||||
else
|
||||
{
|
||||
Assert.IsTrue(extractResult.Item3.Length > 0, "extractResult Array Length check!");
|
||||
Tuple<string, string[], string[]> pdsf = GetLogisticsColumnsAndBody(variables[2], variables[4]);
|
||||
Tuple<string, string[], string[]> pdsfNew = GetLogisticsColumnsAndBody(fileRead, logistics, extractResult, pdsf);
|
||||
CompareSave(variables[5], pdsf, pdsfNew);
|
||||
Assert.IsTrue(pdsf.Item1 == pdsfNew.Item1, "Item1 check!");
|
||||
string[] json = GetItem2(pdsf, pdsfNew);
|
||||
CompareSaveJSON(variables[5], json);
|
||||
Assert.IsTrue(json[0] == json[1], "Item2 check!");
|
||||
string[] join = GetItem3(pdsf, pdsfNew);
|
||||
CompareSaveTSV(variables[5], join);
|
||||
Assert.IsTrue(join[0] == join[1], "Item3 (Join) check!");
|
||||
}
|
||||
UpdatePassDirectory(variables[2]);
|
||||
}
|
||||
UpdatePassDirectory(variables[2]);
|
||||
result = extractResult.Item1;
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
// namespace Adaptation._Tests.Helpers { public class AdaptationTesting { } }
|
||||
// 2022-05-12 -> AdaptationTesting
|
||||
// 2022-08-05 -> AdaptationTesting
|
@ -10,13 +10,13 @@ public class EAFLoggingUnitTesting : LoggingUnitTesting, IDisposable
|
||||
|
||||
public AdaptationTesting AdaptationTesting => _AdaptationTesting;
|
||||
|
||||
public EAFLoggingUnitTesting(TestContext testContext, Type declaringType, bool skipEquipmentDictionary) :
|
||||
public EAFLoggingUnitTesting(string dummyRoot, TestContext testContext, Type declaringType, bool skipEquipmentDictionary) :
|
||||
base(testContext, declaringType)
|
||||
{
|
||||
if (testContext is null || declaringType is null)
|
||||
_AdaptationTesting = null;
|
||||
else
|
||||
_AdaptationTesting = new AdaptationTesting(testContext, skipEquipmentDictionary);
|
||||
_AdaptationTesting = new AdaptationTesting(dummyRoot, testContext, skipEquipmentDictionary, _TestContextPropertiesAsJson, _HasWaitForProperty);
|
||||
}
|
||||
|
||||
public new void Dispose()
|
||||
|
@ -26,7 +26,7 @@ public class LoggingUnitTesting : UnitTesting, IDisposable
|
||||
base(testContext, declaringType)
|
||||
{
|
||||
_LoggerFactory = new LoggerFactory();
|
||||
if (testContext is null || declaringType is null)
|
||||
if (testContext is null || declaringType is null || _IsEnvironment is null)
|
||||
{
|
||||
_ConfigurationRoot = null;
|
||||
_DefaultLogLevel = null;
|
||||
|
45
Adaptation/_Tests/Shared/MethodBaseName.cs
Normal file
45
Adaptation/_Tests/Shared/MethodBaseName.cs
Normal file
@ -0,0 +1,45 @@
|
||||
namespace Adaptation._Tests.Shared;
|
||||
|
||||
public class MethodBaseName
|
||||
{
|
||||
|
||||
public string After { get; private set; }
|
||||
public string Before { get; private set; }
|
||||
public string CellInstanceConnectionName { get; private set; }
|
||||
public string CellInstanceConnectionNameFromMethodBaseName { get; private set; }
|
||||
public string CellInstanceName { get; private set; }
|
||||
public string CellInstanceVersionName { get; private set; }
|
||||
public string Comment { get; private set; }
|
||||
public string DummyDirectory { get; private set; }
|
||||
public string FileFullName { get; private set; }
|
||||
public string RawCellInstanceName { get; private set; }
|
||||
public string RawVersionName { get; private set; }
|
||||
public string Separator { get; private set; }
|
||||
public string TestResultsDirectory { get; private set; }
|
||||
public string TextFileDirectory { get; private set; }
|
||||
public string Ticks { get; private set; }
|
||||
public string VersionDirectory { get; private set; }
|
||||
public string WithActualCICN { get; private set; }
|
||||
|
||||
public MethodBaseName(string after, string before, string cellInstanceConnectionName, string cellInstanceConnectionNameFromMethodBaseName, string cellInstanceName, string cellInstanceVersionName, string comment, string dummyDirectory, string fileFullName, string rawCellInstanceName, string rawVersionName, string separator, string testResultsDirectory, string textFileDirectory, string ticks, string versionDirectory, string withActualCICN)
|
||||
{
|
||||
After = after;
|
||||
Before = before;
|
||||
CellInstanceConnectionName = cellInstanceConnectionName;
|
||||
CellInstanceConnectionNameFromMethodBaseName = cellInstanceConnectionNameFromMethodBaseName;
|
||||
CellInstanceName = cellInstanceName;
|
||||
CellInstanceVersionName = cellInstanceVersionName;
|
||||
Comment = comment;
|
||||
DummyDirectory = dummyDirectory;
|
||||
FileFullName = fileFullName;
|
||||
RawCellInstanceName = rawCellInstanceName;
|
||||
RawVersionName = rawVersionName;
|
||||
Separator = separator;
|
||||
TestResultsDirectory = testResultsDirectory;
|
||||
TextFileDirectory = textFileDirectory;
|
||||
Ticks = ticks;
|
||||
VersionDirectory = versionDirectory;
|
||||
WithActualCICN = withActualCICN;
|
||||
}
|
||||
|
||||
}
|
@ -13,9 +13,13 @@ namespace Adaptation._Tests.Shared;
|
||||
public class UnitTesting
|
||||
{
|
||||
|
||||
protected readonly bool _HasWaitForProperty;
|
||||
protected readonly IsEnvironment _IsEnvironment;
|
||||
protected readonly string _TestContextPropertiesAsJson;
|
||||
|
||||
public IsEnvironment IsEnvironment => _IsEnvironment;
|
||||
public bool HasWaitForProperty => _HasWaitForProperty;
|
||||
public string TestContextPropertiesAsJson => _TestContextPropertiesAsJson;
|
||||
|
||||
public UnitTesting(TestContext testContext, Type declaringType)
|
||||
{
|
||||
@ -23,38 +27,47 @@ public class UnitTesting
|
||||
_IsEnvironment = null;
|
||||
else
|
||||
{
|
||||
string waitFor = "\"WaitFor\":";
|
||||
string projectDirectory = GetProjectDirectory(testContext);
|
||||
string json = JsonSerializer.Serialize(testContext.Properties);
|
||||
string vsCodeDirectory = Path.Combine(projectDirectory, ".vscode");
|
||||
if (!Directory.Exists(vsCodeDirectory))
|
||||
_ = Directory.CreateDirectory(vsCodeDirectory);
|
||||
string launchText = GetLaunchText();
|
||||
File.WriteAllText(Path.Combine(vsCodeDirectory, "launch.json"), launchText);
|
||||
for (int i = 0; i < int.MaxValue; i++)
|
||||
if (string.IsNullOrEmpty(projectDirectory))
|
||||
_IsEnvironment = null;
|
||||
else
|
||||
{
|
||||
if (!json.Contains("Debugger.IsAttached") || Debugger.IsAttached)
|
||||
break;
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
MethodBase methodBase = declaringType.GetMethod(testContext.TestName);
|
||||
if (methodBase is not null)
|
||||
{
|
||||
TestCategoryAttribute testCategoryAttribute = methodBase.GetCustomAttribute<TestCategoryAttribute>();
|
||||
if (testCategoryAttribute is not null)
|
||||
_TestContextPropertiesAsJson = JsonSerializer.Serialize(testContext.Properties, new JsonSerializerOptions { WriteIndented = true });
|
||||
_HasWaitForProperty = _TestContextPropertiesAsJson.Contains(waitFor);
|
||||
string vsCodeDirectory = Path.Combine(projectDirectory, ".vscode");
|
||||
if (!Directory.Exists(vsCodeDirectory))
|
||||
_ = Directory.CreateDirectory(vsCodeDirectory);
|
||||
string launchText = GetLaunchText();
|
||||
File.WriteAllText(Path.Combine(vsCodeDirectory, "launch.json"), launchText);
|
||||
if (_HasWaitForProperty)
|
||||
{
|
||||
foreach (string testCategory in testCategoryAttribute.TestCategories)
|
||||
_IsEnvironment = new IsEnvironment(testCategory);
|
||||
for (int i = 0; i < int.MaxValue; i++)
|
||||
{
|
||||
if (!_TestContextPropertiesAsJson.Contains($"{waitFor} \"Debugger.IsAttached\"") || Debugger.IsAttached)
|
||||
break;
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
}
|
||||
MethodBase methodBase = declaringType.GetMethod(testContext.TestName);
|
||||
if (methodBase is not null)
|
||||
{
|
||||
TestCategoryAttribute testCategoryAttribute = methodBase.GetCustomAttribute<TestCategoryAttribute>();
|
||||
if (testCategoryAttribute is not null)
|
||||
{
|
||||
foreach (string testCategory in testCategoryAttribute.TestCategories)
|
||||
_IsEnvironment = new IsEnvironment(testCategory);
|
||||
}
|
||||
}
|
||||
_IsEnvironment ??= new IsEnvironment(processesCount: null, nullASPNetCoreEnvironmentIsDevelopment: Debugger.IsAttached, nullASPNetCoreEnvironmentIsProduction: !Debugger.IsAttached);
|
||||
}
|
||||
if (_IsEnvironment is null)
|
||||
_IsEnvironment = new IsEnvironment(processesCount: null, nullASPNetCoreEnvironmentIsDevelopment: Debugger.IsAttached, nullASPNetCoreEnvironmentIsProduction: !Debugger.IsAttached);
|
||||
}
|
||||
}
|
||||
|
||||
internal static string GetProjectDirectory(TestContext testContext)
|
||||
{
|
||||
string result;
|
||||
string[] checkFiles = null;
|
||||
string[] checkFiles;
|
||||
result = Path.GetDirectoryName(testContext.DeploymentDirectory);
|
||||
for (int i = 0; i < int.MaxValue; i++)
|
||||
{
|
||||
@ -65,8 +78,6 @@ public class UnitTesting
|
||||
break;
|
||||
result = Path.GetDirectoryName(result);
|
||||
}
|
||||
if (string.IsNullOrEmpty(result) || checkFiles is null || !checkFiles.Any())
|
||||
throw new Exception(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
72
Adaptation/_Tests/Static/MET08ANLYSDIFAAST230.cs
Normal file
72
Adaptation/_Tests/Static/MET08ANLYSDIFAAST230.cs
Normal file
@ -0,0 +1,72 @@
|
||||
using Adaptation._Tests.Shared;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
namespace Adaptation._Tests.Static;
|
||||
|
||||
[TestClass]
|
||||
public class MET08ANLYSDIFAAST230 : LoggingUnitTesting, IDisposable
|
||||
{
|
||||
|
||||
#pragma warning disable CA2254
|
||||
#pragma warning disable IDE0060
|
||||
|
||||
internal static MET08ANLYSDIFAAST230 LoggingUnitTesting { get; private set; }
|
||||
|
||||
public MET08ANLYSDIFAAST230() : base(testContext: null, declaringType: null)
|
||||
{
|
||||
if (LoggingUnitTesting is null)
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
public MET08ANLYSDIFAAST230(TestContext testContext) : base(testContext, new StackFrame().GetMethod().DeclaringType)
|
||||
{
|
||||
}
|
||||
|
||||
[ClassInitialize]
|
||||
public static void ClassInitialize(TestContext testContext) => LoggingUnitTesting ??= new MET08ANLYSDIFAAST230(testContext);
|
||||
|
||||
[ClassCleanup()]
|
||||
public static void ClassCleanup()
|
||||
{
|
||||
LoggingUnitTesting?.Logger?.LogInformation("Cleanup");
|
||||
LoggingUnitTesting?.Dispose();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestDateTime()
|
||||
{
|
||||
DateTime dateTime = DateTime.Now;
|
||||
Assert.IsTrue(dateTime.ToString("M/d/yyyy h:mm:ss tt") == dateTime.ToString());
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging()
|
||||
{
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
StringBuilder results = new();
|
||||
(string cellInstanceName, string cellInstanceVersionName)[] collection = new (string, string)[]
|
||||
{
|
||||
new("MET08ANLYSDIFAAST230", "v2.47.5"),
|
||||
};
|
||||
string staging = "http://mestsa07ec.ec.local:9003/CellInstanceServiceV2";
|
||||
Shared.PasteSpecialXml.EAF.XML.API.CellInstance.CellInstanceVersion cellInstanceVersion;
|
||||
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
|
||||
foreach ((string cellInstanceName, string cellInstanceVersionName) in collection)
|
||||
{
|
||||
cellInstanceVersion = AdaptationTesting.GetCellInstanceVersion($"{staging}/{cellInstanceName}/{cellInstanceVersionName}/configuration");
|
||||
_ = results.AppendLine($"{cellInstanceName}\t{cellInstanceVersionName}\t{cellInstanceVersion.EdaConnection.PortNumber}");
|
||||
}
|
||||
File.WriteAllText($"D:/Tmp/{methodBase.Module.Name}-{methodBase.ReflectedType.Name}-{methodBase.Name}.tsv", results.ToString());
|
||||
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
|
||||
}
|
||||
|
||||
}
|
72
Adaptation/_Tests/Static/SECS.cs
Normal file
72
Adaptation/_Tests/Static/SECS.cs
Normal file
@ -0,0 +1,72 @@
|
||||
using Adaptation._Tests.Shared;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
namespace Adaptation._Tests.Static;
|
||||
|
||||
[TestClass]
|
||||
public class SECS : LoggingUnitTesting, IDisposable
|
||||
{
|
||||
|
||||
#pragma warning disable CA2254
|
||||
#pragma warning disable IDE0060
|
||||
|
||||
internal static SECS LoggingUnitTesting { get; private set; }
|
||||
|
||||
public SECS() : base(testContext: null, declaringType: null)
|
||||
{
|
||||
if (LoggingUnitTesting is null)
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
public SECS(TestContext testContext) : base(testContext, new StackFrame().GetMethod().DeclaringType)
|
||||
{
|
||||
}
|
||||
|
||||
[ClassInitialize]
|
||||
public static void ClassInitialize(TestContext testContext) => LoggingUnitTesting ??= new SECS(testContext);
|
||||
|
||||
[ClassCleanup()]
|
||||
public static void ClassCleanup()
|
||||
{
|
||||
LoggingUnitTesting?.Logger?.LogInformation("Cleanup");
|
||||
LoggingUnitTesting?.Dispose();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestDateTime()
|
||||
{
|
||||
DateTime dateTime = DateTime.Now;
|
||||
Assert.IsTrue(dateTime.ToString("M/d/yyyy h:mm:ss tt") == dateTime.ToString());
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
public void Staging()
|
||||
{
|
||||
MethodBase methodBase = new StackFrame().GetMethod();
|
||||
StringBuilder results = new();
|
||||
(string cellInstanceName, string cellInstanceVersionName)[] collection = new (string, string)[]
|
||||
{
|
||||
new("SPV01", "v2.43.0"),
|
||||
};
|
||||
string staging = "http://mestsa07ec.ec.local:9003/CellInstanceServiceV2";
|
||||
Shared.PasteSpecialXml.EAF.XML.API.CellInstance.CellInstanceVersion cellInstanceVersion;
|
||||
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
|
||||
foreach ((string cellInstanceName, string cellInstanceVersionName) in collection)
|
||||
{
|
||||
cellInstanceVersion = AdaptationTesting.GetCellInstanceVersion($"{staging}/{cellInstanceName}/{cellInstanceVersionName}/configuration");
|
||||
_ = results.AppendLine($"{cellInstanceName}\t{cellInstanceVersionName}\t{cellInstanceVersion.EdaConnection.PortNumber}");
|
||||
}
|
||||
File.WriteAllText($"D:/Tmp/{methodBase.Module.Name}-{methodBase.ReflectedType.Name}-{methodBase.Name}.tsv", results.ToString());
|
||||
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user