private void AssertPathWithPattern(PathLevelWithRegex itemToAssert, string expectedPathWithPattern, int expectedLevel) { Assert.AreEqual(expectedPathWithPattern, itemToAssert.PathWithPattern, "the path is not expected"); Assert.AreEqual(expectedLevel, itemToAssert.Level, "the path level is not expected"); }
public IEnumerable<string> SubstitutionValueInPattern(List<string> values, PathLevelWithRegex basePath, FilePathRegexInformation regexInformation) { var paths = new List<string>(); foreach (string path in values) { var level = basePath.Level; if (!regexInformation.IsWindowsFilepath()) level -= 1; var concatenatedString = regexInformation.ConcatPathWithNextLeveRegex(path, level); if (!string.IsNullOrEmpty(concatenatedString)) paths.Add(concatenatedString); } return paths; }
public void Should_be_possible_to_change_regex_in_the_path_to_a_name() { var pathWithFirstRegex = new PathLevelWithRegex(1, ".*", @"c:\.*"); var newPath = pathWithFirstRegex.SubstitutionValueInPattern("Temp"); Assert.AreEqual(@"c:\Temp", newPath, "the path is not expected"); }
private IEnumerable<string> SubstitutionValueInPattern(List<string> values, PathLevelWithRegex basePath, FilePathRegexInformation regexInformation) { List<string> paths = new List<string>(); foreach (string path in values) { string concatenatedString = regexInformation.ConcatPathWithNextLeveRegex(path, basePath.Level); if (!string.IsNullOrEmpty(concatenatedString)) paths.Add(concatenatedString); } return paths; }