Exemplo n.º 1
0
        public void SearchFileWith34txt()
        {
            countOfFilteredFiles = 0;
            FileSystemVisitor.FileSystemVisitor _systemVisitor = new FileSystemVisitor.FileSystemVisitor(@"D:\Info", FindAFile);
            _systemVisitor.OnFilteredDirectoryFinded += SystemVisitor_OnFilteredDirectoryFinded;
            _systemVisitor.OnFilteredFileFinded      += SystemVisitor_OnFilteredFileFinded;
            IEnumerable str = _systemVisitor.Searching();

            Assert.AreEqual(1, countOfFilteredFiles);
        }
Exemplo n.º 2
0
        public void SearchWithoutFilters()
        {
            var countOfFile = 0;

            FileSystemVisitor.FileSystemVisitor _systemVisitor = new FileSystemVisitor.FileSystemVisitor(@"D:\Info");
            IEnumerable str = _systemVisitor.Searching();

            foreach (var item in str)
            {
                countOfFile++;
            }
            Assert.AreEqual(5, countOfFile);
        }
Exemplo n.º 3
0
        public void CheckOfEventsCountWithoutFilters()
        {
            countOfEvents = 0;
            FileSystemVisitor _systemVisitor = new FileSystemVisitor.FileSystemVisitor(@"D:\Info");

            _systemVisitor.OnStart                   += _systemVisitor_OnStart;
            _systemVisitor.OnFinish                  += _systemVisitor_OnFinish;
            _systemVisitor.OnFileFinded              += SystemVisitor_OnFileFinded;
            _systemVisitor.OnDirectoryFinded         += SystemVisitor_OnDirectoryFinded;
            _systemVisitor.OnFilteredDirectoryFinded += SystemVisitor_OnFilteredDirectoryFinded;
            _systemVisitor.OnFilteredFileFinded      += SystemVisitor_OnFilteredFileFinded;
            IEnumerable str = _systemVisitor.Searching();

            Assert.AreEqual(7, countOfEvents);
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            string startPosition;

            Console.WriteLine("Введите начальный каталог:");
            startPosition = Console.ReadLine();
            if (!Directory.Exists(startPosition))
            {
                Console.WriteLine("Задан неверный каталог!");
            }
            else
            {
                FileSystemVisitor.FileSystemVisitor systemVisitor = new FileSystemVisitor.FileSystemVisitor(startPosition, CheckFiles);

                systemVisitor.OnStart                   += SystemVisitor_OnStart;
                systemVisitor.OnFinish                  += SystemVisitor_OnFinish;
                systemVisitor.OnFileFinded              += SystemVisitor_OnFileFinded;
                systemVisitor.OnDirectoryFinded         += SystemVisitor_OnDirectoryFinded;
                systemVisitor.OnFilteredDirectoryFinded += SystemVisitor_OnFilteredDirectoryFinded;
                systemVisitor.OnFilteredFileFinded      += SystemVisitor_OnFilteredFileFinded;
                systemVisitor.Searching();
            }
            Console.ReadLine();
        }