Refactor ProcessDataStandardFormat and add unit tests for v2.61.1
- Updated GetPDSFText method to accept nullable logisticsText parameter. - Removed unused TryGetPropertyIndex method from ProcessDataStandardFormat. - Introduced new unit tests for CreateSelfDescription and Extract functionalities in version 2.61.1. - Implemented logging and file handling in the test classes to ensure proper setup and teardown.
This commit is contained in:
@ -665,7 +665,7 @@ internal class ProcessDataStandardFormat
|
||||
return results;
|
||||
}
|
||||
|
||||
internal static string GetPDSFText(IFileRead fileRead, Logistics logistics, JsonElement[] jsonElements, string logisticsText)
|
||||
internal static string GetPDSFText(IFileRead fileRead, Logistics logistics, JsonElement[] jsonElements, string? logisticsText)
|
||||
{
|
||||
string result;
|
||||
if (jsonElements.Length == 0)
|
||||
@ -850,33 +850,6 @@ internal class ProcessDataStandardFormat
|
||||
return string.Concat(((int)searchFor).ToString().PadLeft(2, '0'), separator, searchFor.ToString().Replace("In", string.Concat(separator, "In")).Replace("Ex", string.Concat(separator, "Ex")));
|
||||
}
|
||||
|
||||
private static int? TryGetPropertyIndex(JsonProperty[] jsonProperties, string propertyName)
|
||||
{
|
||||
int? result = null;
|
||||
for (int i = 0; i < jsonProperties.Length; i++)
|
||||
{
|
||||
if (jsonProperties[i].Name != propertyName)
|
||||
continue;
|
||||
result = i;
|
||||
break;
|
||||
}
|
||||
if (result is null)
|
||||
{
|
||||
for (int i = 0; i < jsonProperties.Length; i++)
|
||||
{
|
||||
if (jsonProperties[i].Name[0] != propertyName[0])
|
||||
continue;
|
||||
if (jsonProperties[i].Name.Length != propertyName.Length)
|
||||
continue;
|
||||
if (jsonProperties[i].Name != propertyName)
|
||||
continue;
|
||||
result = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
internal static string GetXml(ProcessDataStandardFormat processDataStandardFormat)
|
||||
{
|
||||
string result;
|
||||
|
||||
Reference in New Issue
Block a user