Exemplo n.º 1
0
        public void EmptyFile_FindFiles_ReturnsEmptyEnumerable()
        {
            var sut = new FilesToAnalyzeProvider(@"ResourceTests\FilesToAnalyze\EmptyFilesToAnalyze.txt");

            var results = sut.FindFiles(new Regex(".*"), false);

            results.Should().BeEmpty();
        }
Exemplo n.º 2
0
        public void FileNameWithMixedCapitalizationAndMixedSlashes_FindFilesWithFileName_ReturnsAllWebConfigFiles()
        {
            var sut = new FilesToAnalyzeProvider(FilesToAnalyzePath);

            var results = sut.FindFiles("Web.config", false);

            results.Should().BeEquivalentTo(new[] { MixedSlashesWebConfigPath1, MixedSlashesWebConfigPath2 });
        }
Exemplo n.º 3
0
        public void InvalidPath_FindFiles_ReturnsEmptyEnumerable(string filePath)
        {
            var sut = new FilesToAnalyzeProvider(filePath);

            var results = sut.FindFiles(new Regex(".*"), false);

            results.Should().BeEmpty();
        }
Exemplo n.º 4
0
        public void FileWithInvalidValues_FindFilesWithFileName_ReturnsValidValue()
        {
            var sut = new FilesToAnalyzeProvider(InvalidFilesToAnalyzePath);

            var results = sut.FindFiles("123", false);

            results.Should().HaveCount(1);
            results.Should().Contain("123");
        }
Exemplo n.º 5
0
        public void FileNameWithMixedCapitalizationAndMixedSlashes_FindFilesWithRegex_ReturnsAllWebConfigFiles()
        {
            var fileNamePattern = new Regex(@"[\\\/]web\.config$", RegexOptions.IgnoreCase);

            var sut = new FilesToAnalyzeProvider(FilesToAnalyzePath);

            var results = sut.FindFiles(fileNamePattern, false);

            results.Should().BeEquivalentTo(new[] { MixedSlashesWebConfigPath1, MixedSlashesWebConfigPath2 });
        }
Exemplo n.º 6
0
        public void UnableToOpenFile_FindFiles_ReturnsEmptyEnumerable()
        {
            using (Stream iStream = File.Open(FilesToAnalyzePath, FileMode.Open, FileAccess.Read, FileShare.None))
            {
                var sut = new FilesToAnalyzeProvider(FilesToAnalyzePath);

                var results = sut.FindFiles(new Regex(".*"));
                results.Should().BeEmpty();
            }
        }
Exemplo n.º 7
0
        public void FileWithValidValues_FindFilesRequestingAnyFile_AllValuesFromTheFileAreReturned()
        {
            var sut = new FilesToAnalyzeProvider(FilesToAnalyzePath);

            var results = sut.FindFiles(new Regex(".*"), false);

            results.Should().BeEquivalentTo(new[]
            {
                MixedSlashesWebConfigPath1,
                MixedSlashesWebConfigPath2,
                @"C:\Projects\DummyProj\Views\Global.asax",
                @"C:\Projects\DummyProj\Csharp\Controllers\HomeController.cs",
                @"C:\Projects\DummyProj\VisualBasic\Controllers\HomeController.vb",
                @"C:\Projects/DummyProj/Views\Web.confiGuration"
            });
        }
Exemplo n.º 8
0
        public void FileWithInvalidValues_FindFilesWithRegex_ReturnsValidValue()
        {
            var fileNamePattern = new Regex("web\\.config$", RegexOptions.IgnoreCase);

            var sut = new FilesToAnalyzeProvider(InvalidFilesToAnalyzePath);

            var results = sut.FindFiles(fileNamePattern, false);

            results.Should().BeEquivalentTo(new[]
            {
                MixedSlashesWebConfigPath2,
                @"C:\Projects\Controllers:web.config",
                @"C:web.config",
                @"C:\Projects<web.config",
                @"C:\Projects>\Controllers/web.config"
            });
        }