Contains bug

This commit is contained in:
Mike Phares 2023-06-19 13:43:48 -07:00
parent 652494d15f
commit 137c1603c0
2 changed files with 31 additions and 1 deletions

View File

@ -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);

View File

@ -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();
}
}