v2_52_0-Tests
editorconfig
yml ec fix
yml explicit contents
dotnet_diagnostic
CA1862 and GetWeekOfYear for WritePDSF
gitignore
cellInstanceVersion.EdaConnection.PortNumber
Added Climatec to Test.cs
GetJobIdDirectory
Remove and
Remove Microsoft.AspNet.WebApi.SelfHost
5-Other-Small
This commit is contained in:
2023-11-28 06:59:28 -07:00
parent 49d8e3b309
commit f9ee74a810
25 changed files with 307 additions and 138 deletions

View File

@ -305,7 +305,7 @@ public class AdaptationTesting : ISMTP
else
{
results = Directory.GetFiles(mbn.TextFileDirectory, "*.txt", SearchOption.TopDirectoryOnly);
if (!string.IsNullOrEmpty(mbn.Ticks) && _HasWaitForProperty && !results.Any())
if (!string.IsNullOrEmpty(mbn.Ticks) && _HasWaitForProperty && results.Length == 0)
{
_ = Process.Start("explorer.exe", mbn.TextFileDirectory);
File.WriteAllText(Path.Combine(mbn.TextFileDirectory, "_ Why.why"), string.Empty);
@ -373,9 +373,7 @@ public class AdaptationTesting : ISMTP
Tuple<string, CellInstanceVersion> result;
CellInstanceVersion cellInstanceVersion;
string cellInstanceServiceV2 = string.Concat("http://", _HostNameAndPort, "/CellInstanceServiceV2/", cellInstanceName, "/", cellInstanceVersionName, "/configuration");
if (_CellInstanceVersions.ContainsKey(cellInstanceServiceV2))
cellInstanceVersion = _CellInstanceVersions[cellInstanceServiceV2];
else
if (!_CellInstanceVersions.TryGetValue(cellInstanceServiceV2, out cellInstanceVersion))
{
cellInstanceVersion = GetCellInstanceVersion(cellInstanceServiceV2);
_CellInstanceVersions.Add(cellInstanceServiceV2, cellInstanceVersion);
@ -401,7 +399,7 @@ public class AdaptationTesting : ISMTP
}
}
}
if (!results.Any() || (!string.IsNullOrEmpty(cellInstanceConnectionName) && !results.ContainsKey(cellInstanceConnectionName)))
if (results.Count == 0 || (!string.IsNullOrEmpty(cellInstanceConnectionName) && !results.ContainsKey(cellInstanceConnectionName)))
throw new Exception("Match not found (check test method name matches Mango)!");
return results;
}
@ -413,9 +411,8 @@ public class AdaptationTesting : ISMTP
result = componentModelComponentsIndexes.ElementAt(0).Value;
else
{
if (componentModelComponentsIndexes is null || !componentModelComponentsIndexes.ContainsKey(cellInstanceConnectionName))
if (componentModelComponentsIndexes is null || !componentModelComponentsIndexes.TryGetValue(cellInstanceConnectionName, out result))
throw new Exception();
result = componentModelComponentsIndexes[cellInstanceConnectionName];
}
return result;
}
@ -596,7 +593,7 @@ public class AdaptationTesting : ISMTP
throw new Exception();
_ = stringBuilder.Clear();
}
if (componentsCellComponentCellComponentEquipmentDictionaryNames.Any() && string.IsNullOrEmpty(cellInstanceVersion.FrozenBy))
if (componentsCellComponentCellComponentEquipmentDictionaryNames.Count != 0 && string.IsNullOrEmpty(cellInstanceVersion.FrozenBy))
{
if (!cellInstanceVersion.CellCommunicatingRule.EndsWith(".Communicating") || !(from l in componentsCellComponentCellComponentEquipmentNames where l == cellInstanceVersion.CellCommunicatingRule.Split('.')[0] select true).Any())
throw new Exception($"{methodName} - CellCommunicatingRule not correct in Mango!");
@ -648,9 +645,7 @@ public class AdaptationTesting : ISMTP
Tuple<string, FileConnectorConfiguration> result;
FileConnectorConfiguration fileConnectorConfiguration;
string cellInstanceServiceV2With = string.Concat(cellInstanceVersionTuple.Item1, '/', cellInstanceConnectionName);
if (_FileConnectorConfigurations.ContainsKey(cellInstanceServiceV2With))
fileConnectorConfiguration = _FileConnectorConfigurations[cellInstanceServiceV2With];
else
if (!_FileConnectorConfigurations.TryGetValue(cellInstanceServiceV2With, out fileConnectorConfiguration))
{
Dictionary<string, int[]> componentModelComponentsIndexes = GetComponentModelComponentsIndexes(cellInstanceVersionTuple.Item2, cellInstanceConnectionName);
int[] cellInstanceConnectionNameIndexes = GetCellInstanceConnectionNameIndexes(cellInstanceConnectionName, componentModelComponentsIndexes);
@ -696,9 +691,7 @@ public class AdaptationTesting : ISMTP
int[] cellInstanceConnectionNameIndexes = GetCellInstanceConnectionNameIndexes(cellInstanceConnectionName, componentModelComponentsIndexes);
ComponentsCellComponentCellComponent componentsCellComponentCellComponent = cellInstanceVersion.ComponentModel.Components[cellInstanceConnectionNameIndexes[0]].Children[cellInstanceConnectionNameIndexes[1]];
string equipmentTypeServiceV2 = string.Concat("http://", _HostNameAndPort, "/EquipmentTypeServiceV2/", componentsCellComponentCellComponent.Equipment.EquipmentType.Name, "/", componentsCellComponentCellComponent.Equipment.EquipmentType.Version, "/configuration");
if (_EquipmentTypeVersions.ContainsKey(equipmentTypeServiceV2))
equipmentTypeVersion = _EquipmentTypeVersions[equipmentTypeServiceV2];
else
if (!_EquipmentTypeVersions.TryGetValue(equipmentTypeServiceV2, out equipmentTypeVersion))
{
equipmentTypeVersion = GetEquipmentTypeVersion(equipmentTypeServiceV2);
_EquipmentTypeVersions.Add(equipmentTypeServiceV2, equipmentTypeVersion);
@ -763,7 +756,7 @@ public class AdaptationTesting : ISMTP
string[] results;
string equipmentDictionaryName;
string equipmentDictionaryVersionName;
if (_SkipEquipmentDictionary || equipmentTypeVersion?.EventActionSequences is null || !equipmentTypeVersion.EventActionSequences.Any() || !(from l in equipmentTypeVersion.EventActionSequences where l.HandledEvent.StartsWith("Equipment.FileRead") select 1).Any())
if (_SkipEquipmentDictionary || equipmentTypeVersion?.EventActionSequences is null || equipmentTypeVersion.EventActionSequences.Length == 0 || !(from l in equipmentTypeVersion.EventActionSequences where l.HandledEvent.StartsWith("Equipment.FileRead") select 1).Any())
{
equipmentDictionaryName = string.Empty;
equipmentDictionaryVersionName = string.Empty;
@ -834,9 +827,7 @@ public class AdaptationTesting : ISMTP
equipmentDictionaryVersion = null;
else
{
if (_EquipmentDictionaryVersions.ContainsKey(equipmentDictionaryServiceV2))
equipmentDictionaryVersion = _EquipmentDictionaryVersions[equipmentDictionaryServiceV2];
else
if (!_EquipmentDictionaryVersions.TryGetValue(equipmentDictionaryServiceV2, out equipmentDictionaryVersion))
{
equipmentDictionaryVersion = GetEquipmentDictionaryVersion(equipmentDictionaryServiceV2);
_EquipmentDictionaryVersions.Add(equipmentDictionaryServiceV2, equipmentDictionaryVersion);
@ -850,14 +841,15 @@ public class AdaptationTesting : ISMTP
{
Tuple<string, List<Tuple<string, string>>> result;
List<Tuple<string, string>> results;
List<Tuple<string, string>> collection;
if (_SkipEquipmentDictionary)
results = new List<Tuple<string, string>>();
else if (string.IsNullOrEmpty(equipmentDictionaryVersionTuple.Item1))
throw new Exception();
else if (equipmentDictionaryVersionTuple?.Item4?.Events?.Event is null)
results = new List<Tuple<string, string>>();
else if (_EquipmentDictionaryEventDescriptions.ContainsKey(equipmentDictionaryVersionTuple.Item1))
results = _EquipmentDictionaryEventDescriptions[equipmentDictionaryVersionTuple.Item1];
else if (_EquipmentDictionaryEventDescriptions.TryGetValue(equipmentDictionaryVersionTuple.Item1, out collection))
results = collection;
else
{
results = new List<Tuple<string, string>>();
@ -963,25 +955,33 @@ public class AdaptationTesting : ISMTP
}
if (_TestContext.FullyQualifiedTestClassName.Contains(nameof(Extract)))
{
if (!string.IsNullOrEmpty(fileConnectorConfigurationTuple.Item2.ErrorTargetFileLocation))
try
{
if (!Directory.Exists(fileConnectorConfigurationTuple.Item2.ErrorTargetFileLocation))
_ = Directory.CreateDirectory(fileConnectorConfigurationTuple.Item2.ErrorTargetFileLocation);
if (!string.IsNullOrEmpty(fileConnectorConfigurationTuple.Item2.ErrorTargetFileLocation))
{
if (!Directory.Exists(fileConnectorConfigurationTuple.Item2.ErrorTargetFileLocation))
_ = Directory.CreateDirectory(fileConnectorConfigurationTuple.Item2.ErrorTargetFileLocation);
}
if (!string.IsNullOrEmpty(fileConnectorConfigurationTuple.Item2.SourceFileLocation))
{
if (!Directory.Exists(fileConnectorConfigurationTuple.Item2.SourceFileLocation))
_ = Directory.CreateDirectory(fileConnectorConfigurationTuple.Item2.SourceFileLocation);
}
if (!string.IsNullOrEmpty(fileConnectorConfigurationTuple.Item2.TargetFileLocation))
{
if (!Directory.Exists(fileConnectorConfigurationTuple.Item2.TargetFileLocation))
_ = Directory.CreateDirectory(fileConnectorConfigurationTuple.Item2.TargetFileLocation);
}
if (!string.IsNullOrEmpty(fileConnectorConfigurationTuple.Item2.AlternateTargetFolder))
{
if (!Directory.Exists(fileConnectorConfigurationTuple.Item2.AlternateTargetFolder))
_ = Directory.CreateDirectory(fileConnectorConfigurationTuple.Item2.AlternateTargetFolder);
}
}
if (!string.IsNullOrEmpty(fileConnectorConfigurationTuple.Item2.SourceFileLocation))
catch (IOException ex)
{
if (!Directory.Exists(fileConnectorConfigurationTuple.Item2.SourceFileLocation))
_ = Directory.CreateDirectory(fileConnectorConfigurationTuple.Item2.SourceFileLocation);
}
if (!string.IsNullOrEmpty(fileConnectorConfigurationTuple.Item2.TargetFileLocation))
{
if (!Directory.Exists(fileConnectorConfigurationTuple.Item2.TargetFileLocation))
_ = Directory.CreateDirectory(fileConnectorConfigurationTuple.Item2.TargetFileLocation);
}
if (!string.IsNullOrEmpty(fileConnectorConfigurationTuple.Item2.AlternateTargetFolder))
{
if (!Directory.Exists(fileConnectorConfigurationTuple.Item2.AlternateTargetFolder))
_ = Directory.CreateDirectory(fileConnectorConfigurationTuple.Item2.AlternateTargetFolder);
if (!ex.Message.Contains("SMB1"))
throw;
}
}
result = FileHandlers.CellInstanceConnectionName.Get(this, fileParameter, mbn.CellInstanceName, mbn.CellInstanceConnectionName, fileConnectorConfigurationTuple.Item2, equipmentTypeVersionTuple.Item2, parameterizedModelObjectDefinitionTypeTuple.Item2, modelObjectParametersTuple.Item2, equipmentDictionaryVersionTuple.Item2, dummyRuns, staticRuns, useCyclicalForDescription, connectionCount: cellInstanceVersionTuple.Item2.EquipmentConnections.Length);
@ -1001,7 +1001,7 @@ public class AdaptationTesting : ISMTP
string sourceFileLocation = string.Empty;
MethodBaseName mbn = GetMethodBaseName(methodBase);
string[] textFiles = GetTextFiles(mbn);
if (!textFiles.Any())
if (textFiles.Length == 0)
{
if (_HasWaitForProperty)
throw new Exception("Set text file!");
@ -1065,7 +1065,7 @@ public class AdaptationTesting : ISMTP
else
{
string[] files = Directory.GetFiles(ipdsfDirectory, searchPattern, SearchOption.TopDirectoryOnly);
if (files.Any())
if (files.Length != 0)
ipdsfFile = files[0];
else
ipdsfFile = searchPattern;
@ -1109,9 +1109,9 @@ public class AdaptationTesting : ISMTP
{
string[] pdsfFiles;
pdsfFiles = Directory.GetFiles(searchDirectory, searchPattern, SearchOption.TopDirectoryOnly);
if (!pdsfFiles.Any())
if (pdsfFiles.Length == 0)
_ = Process.Start("explorer.exe", searchDirectory);
Assert.IsTrue(pdsfFiles.Any(), "GetFiles check");
Assert.IsTrue(pdsfFiles.Length != 0, "GetFiles check");
results = GetLogisticsColumnsAndBody(pdsfFiles[0]);
}
Assert.IsFalse(string.IsNullOrEmpty(results.Item1));