public void IsMatch_should_match_glob_pattern(string file, string glob, bool isMatch)
        {
            // Arrange
            var textSpan = new TextSpan(0, 1);
            var sut      = new FilePattern(Glob.Parse(glob), false, new[] { textSpan });

            // Act
            var result = sut.IsMatch(file, textSpan);

            // Assert
            result.ShouldBe(isMatch);
        }
Beispiel #2
0
        protected SkipReason GetSkipActionForFile(string file, ILoadDirectory destination)
        {
            if (file.StartsWith("."))
            {
                return(SkipReason.IsImaginaryFile);
            }

            //if there is a regex pattern
            if (FilePattern != null)
            {
                if (!FilePattern.IsMatch(file))            //and it does not match
                {
                    return(SkipReason.DidNotMatchPattern); //skip because it did not match pattern
                }
            }
            //if the file on the FTP already exists in the forLoading directory, skip it
            if (destination.ForLoading.GetFiles(file).Any())
            {
                return(SkipReason.InForLoading);
            }


            return(SkipReason.DoNotSkip);
        }