diff --git a/Adaptation/FileHandlers/QS408M/TXT.cs b/Adaptation/FileHandlers/QS408M/TXT.cs index 4a9e693..ada879d 100644 --- a/Adaptation/FileHandlers/QS408M/TXT.cs +++ b/Adaptation/FileHandlers/QS408M/TXT.cs @@ -23,7 +23,7 @@ public class TXT const string twoSpaces = " "; string title = GetBefore("Recipe:"); string recipeAndDateTime = GetToEOL(); - string recipe = !recipeAndDateTime.Contains(twoSpaces) ? recipeAndDateTime.Substring(0, 25).Trim() : recipeAndDateTime.Split(new string[] { twoSpaces }, StringSplitOptions.None)[0].Trim(); + string recipe = recipeAndDateTime.Length < twoSpaces.Length ? recipeAndDateTime.Trim() : !recipeAndDateTime.Contains(twoSpaces) ? recipeAndDateTime.Substring(0, 25).Trim() : recipeAndDateTime.Split(new string[] { twoSpaces }, StringSplitOptions.None)[0].Trim(); string dateTime = recipeAndDateTime.Substring(recipe.Length).Trim(); if (dateTime.EndsWith(".")) dateTime = dateTime.Remove(dateTime.Length - 1, 1); diff --git a/Adaptation/_Tests/Extract/Staging/v2.49.2/BIORAD3.cs b/Adaptation/_Tests/Extract/Staging/v2.49.2/BIORAD3.cs index c735e58..069db5c 100644 --- a/Adaptation/_Tests/Extract/Staging/v2.49.2/BIORAD3.cs +++ b/Adaptation/_Tests/Extract/Staging/v2.49.2/BIORAD3.cs @@ -23,6 +23,13 @@ public class BIORAD3 _BIORAD3 = CreateSelfDescription.Staging.v2_49_2.BIORAD3.EAFLoggingUnitTesting; } + private static void NonThrowTryCatch() + { + try + { throw new Exception(); } + catch (Exception) { } + } + #if DEBUG [Ignore] #endif @@ -48,6 +55,29 @@ public class BIORAD3 dateTime = FileHandlers.QS408M.ProcessData.GetDateTime(logistics, tickOffset: 0, dateTimeText: "Tue Nov 10 12:03:56 1970"); Assert.IsTrue(dateTime == logistics.DateTimeFromSequence); _ = Shared.AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics, validatePDSF); + NonThrowTryCatch(); + } + +#if DEBUG + [Ignore] +#endif + [TestMethod] + public void Staging__v2_49_2__BIORAD3__QS408M638227775101723135__Error() + { + DateTime dateTime; + string check = "*.txt"; + bool validatePDSF = false; + _BIORAD3.Staging__v2_49_2__BIORAD3__QS408M(); + MethodBase methodBase = new StackFrame().GetMethod(); + string[] variables = _BIORAD3.AdaptationTesting.GetVariables(methodBase, check, validatePDSF); + IFileRead fileRead = _BIORAD3.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false); + Logistics logistics = new(fileRead); + dateTime = FileHandlers.QS408M.ProcessData.GetDateTime(logistics, tickOffset: 0, dateTimeText: string.Empty); + Assert.IsTrue(dateTime == logistics.DateTimeFromSequence); + dateTime = FileHandlers.QS408M.ProcessData.GetDateTime(logistics, tickOffset: 0, dateTimeText: "Tue Nov 10 12:03:56 1970"); + Assert.IsTrue(dateTime == logistics.DateTimeFromSequence); + _ = Shared.AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics, validatePDSF); + NonThrowTryCatch(); } } \ No newline at end of file