Пример #1
0
 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");
 }
Пример #2
0
        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;
        }        
Пример #3
0
 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;
 }