Example #1
0
        public void VerifyObjCountTest()
        {
            FileSystemVisitor visit = new FileSystemVisitor(@"..\..\Test");
            int actualCount = 0;

            foreach (var element in visit)
                ++actualCount;

            int expectCount = 9;
            Assert.AreEqual(expectCount, actualCount);
        }
Example #2
0
        public void VerifyCountTextFileTest()
        {
            FileSystemVisitor visit = new FileSystemVisitor(@"..\..\Test", x => x.Extension == ".txt");
            int actualCount = 0;

            foreach (var element in visit)
                ++actualCount;

            int expectCount = 3;
            Assert.AreEqual(expectCount, actualCount);
        }
Example #3
0
        public void VerifyCountFilesWithNumber3Test()
        {
            FileSystemVisitor visit = new FileSystemVisitor(@"..\..\Test");
            visit.FileFinded += fileFinded;
            int actualCount = 0;

            foreach (var element in visit)
                ++actualCount;

            int expectCount = 8;
            Assert.AreEqual(expectCount, actualCount);
        }
Example #4
0
        private static FileSystemVisitor SetUpFileSystemVisitor()
        {
            var fileSystemVisitor = new FileSystemVisitor(s => s.EndsWith(".config"));
            fileSystemVisitor.Start += (sender, eventArgs) => System.Console.WriteLine("Start");
            fileSystemVisitor.Finish += (sender, eventArgs) => System.Console.WriteLine("Finish");

            fileSystemVisitor.FileFinded += FileSystemVisitorOnFileFinded;
            fileSystemVisitor.FilteredFileFinded += FileSystemVisitorOnFileFinded;

            fileSystemVisitor.DirectoryFinded += (sender, args) => System.Console.WriteLine("Directory : { args.Path } ");
            fileSystemVisitor.FileFinded += (sender, args) => System.Console.WriteLine("File : { args.Path } ");

            return fileSystemVisitor;
        }
Example #5
0
        public void VerifyCountFoldersWithNumber2Test()
        {
            FileSystemVisitor visit = new FileSystemVisitor(@"..\..\Test");
            visit.DirectoryFinded += directoryFinded;
            int actualCount = 0;

            foreach (var v in visit)
            {
                ++actualCount;
            }

            int expectCount = 6;
            Assert.AreEqual(expectCount, actualCount);
        }