public void T001_HelperShouldConvertToCorrectDateString() { var cmdDto = TestDirectories.GetConsoleExecutorDto(); cmdDto.CmdConsoleLogFileTimeStamp = "20151026195929"; var hlpr = new XmlParameterConverter(cmdDto); var testXml = "%(CURDATESTR)%_SomeDirectoryName"; var result = hlpr.RunConversion(testXml); var expected = "20151026195929_SomeDirectoryName"; Assert.IsTrue(result == expected); }
public void ExtractElementInfo(XmlTextReader reader, ref ConsoleCommandDto consoleCommand, ref ConsoleExecutorDto cmdExeDto) { var parmHlpr = new XmlParameterConverter(cmdExeDto); if (reader.Name == "CommandDisplayName") { consoleCommand.CommandDisplayName = _xmlHlpr.ExtractStringValue(reader); return; } if (reader.Name == "ConsoleCommandType") { consoleCommand.CommandType = _xmlHlpr.ExtractConsoleCommandType(reader); return; } if (reader.Name == "KillJobsRunOnExitCodeGreaterThan") { var userEntry = _xmlHlpr.ExtractStringValue(reader); int exitCodeLimit; if (string.IsNullOrWhiteSpace(userEntry) || !int.TryParse(userEntry, out exitCodeLimit)) { return; } consoleCommand.KillJobsRunOnExitCodeGreaterThan = exitCodeLimit; return; } if (reader.Name == "KillJobsRunOnExitCodeLessThan") { var userEntry = _xmlHlpr.ExtractStringValue(reader); int exitCodeLimit; if (string.IsNullOrWhiteSpace(userEntry) || !int.TryParse(userEntry, out exitCodeLimit)) { return; } consoleCommand.KillJobsRunOnExitCodeLessThan = exitCodeLimit; return; } if (reader.Name == "CommandOutputLogFilePathBaseName") { consoleCommand.CommandOutputLogFilePathBaseName = _xmlHlpr.ExtractStringValue(reader); return; } if (reader.Name == "CommandTimeOutInMinutes") { consoleCommand.CommandTimeOutInMinutes = _xmlHlpr.ExtractDecimalValue(reader, 0.0M); return; } if (reader.Name == "DefaultConsoleCommandExecutor") { consoleCommand.ConsoleCommandExecutor = parmHlpr.RunConversion(_xmlHlpr.ExtractStringValue(reader)); return; } if (reader.Name == "ConsoleCommandExeArguments") { consoleCommand.ConsoleCommandExeArguments = parmHlpr.RunConversion(_xmlHlpr.ExtractStringValue(reader)); return; } if (reader.Name == "ExecuteInDir") { consoleCommand.ExecuteInDir = _xmlHlpr.ExtractStringValue(reader); return; } if (reader.Name == "ExecutableTarget") { consoleCommand.ExecutableTarget = parmHlpr.RunConversion(_xmlHlpr.ExtractStringValue(reader)); return; } if (reader.Name == "CommandToExecute") { consoleCommand.CommandToExecute = parmHlpr.RunConversion(_xmlHlpr.ExtractStringValue(reader)); return; } if (reader.Name == "CommandModifier") { consoleCommand.CommandModifier = parmHlpr.RunConversion(_xmlHlpr.ExtractStringValue(reader)); return; } if (reader.Name == "CommandArguments") { consoleCommand.CommandArguments = parmHlpr.RunConversion(_xmlHlpr.ExtractStringValue(reader)); } }