Exemplo n.º 1
0
        public void TestRegularExpressionAny()
        {
            IFileFilter fileFilter = FileFilterHelper.ParseFileFilter("Test", "*.*");
            string      filename   = "Test.cs";

            Assert.AreEqual(true, fileFilter.IsMatch(filename));
        }
Exemplo n.º 2
0
        public void TestParseFileFilter()
        {
            IFileFilter fileFilter = FileFilterHelper.ParseFileFilter("Test", "*.cs");

            Assert.AreEqual("Test", fileFilter.Label);
            Assert.AreEqual("*.cs", fileFilter.Filters);
        }
        public void TestBuildFullFileNameForInCurrentDirectoryWithoutForcedFileExtension()
        {
            FileSystemController fileSystemController = new FileSystemController()
            {
                ForceFileExtensionOfFileFilter = false,
                FileFilterToApply = FileFilterHelper.ParseFileFilter("Test", "*.cs;*.xaml")
            };

            fileSystemController.SelectDirectory(m_directory);

            string filename = fileSystemController.BuildFullFileNameForInCurrentDirectory("test.txt");

            Assert.AreEqual($@"{m_directory}\test.txt", filename);
        }
Exemplo n.º 4
0
        public void TestGetFileExtensionsFromFilter()
        {
            IFileFilter          fileFilter     = FileFilterHelper.ParseFileFilter("Test", "*.cs;file.*;cs*.*;*.xaml;test;*.txt.bak");
            IEnumerable <string> fileExtensions = FileFilterHelper.GetFileExtensionsFromFilter(fileFilter);

            Assert.IsNotNull(fileExtensions);
            Assert.AreEqual(3, fileExtensions.Count());
            Assert.IsTrue(fileExtensions.Any(fileExtension => fileExtension == "cs"));
            Assert.IsTrue(fileExtensions.Any(fileExtension => fileExtension == "xaml"));
            Assert.IsTrue(fileExtensions.Any(fileExtension => fileExtension == "bak"));

            fileExtensions = FileFilterHelper.GetFileExtensionsFromFilter(null);

            Assert.IsTrue(fileExtensions == null || !fileExtensions.Any());
        }
Exemplo n.º 5
0
        public void TestRegularExpression()
        {
            IFileFilter fileFilter = FileFilterHelper.ParseFileFilter("Test", "*.cs;*.xaml;file.*;cs*.*");
            string      filename1  = "Test.cs";
            string      filename2  = "Test.xaml";
            string      filename3  = "Test.html";
            string      filename4  = "Test.css";
            string      filename5  = "file.html";
            string      filename6  = "csfile1_2.js";
            string      filename7  = "cs.js";

            Assert.AreEqual(true, fileFilter.IsMatch(filename1));
            Assert.AreEqual(true, fileFilter.IsMatch(filename2));
            Assert.AreEqual(false, fileFilter.IsMatch(filename3));
            Assert.AreEqual(false, fileFilter.IsMatch(filename4));
            Assert.AreEqual(true, fileFilter.IsMatch(filename5));
            Assert.AreEqual(true, fileFilter.IsMatch(filename6));
            Assert.AreEqual(true, fileFilter.IsMatch(filename7));
        }