public void NotifyFileOnCreated_Test()
        {
            //Given
            var fileNotifier  = new FakeNotifier();
            var fileToObserve = new ObserveFileDto()
            {
                DirectoryPath      = mainDir,
                Filter             = "*.*",
                WithSubDirectories = false
            };
            var fileNotifierManager = new FileNotifierManager(fileNotifier);

            //When
            fileNotifierManager.Set(fileToObserve);
            File.Create(FilePath).Close();
            //Then
            Assert.That(() => fileNotifier.CountInvoked, Is.EqualTo(1).After(Delay));
        }
        public void NotifyInSubDirectory_Test()
        {
            //Given
            var fileNotifier  = new FakeNotifier();
            var fileToObserve = new ObserveFileDto()
            {
                DirectoryPath      = mainDir,
                Filter             = "*.*",
                WithSubDirectories = true
            };
            var fileNotifierManager = new FileNotifierManager(fileNotifier);

            //When
            fileNotifierManager.Set(fileToObserve);
            const string testfile = "testfile.txt";

            File.Create(Path.Combine(SubDirPath, testfile)).Close();
            //Then
            Assert.That(() => fileNotifier.CountInvoked, Is.EqualTo(1).After(Delay));
        }
        public void OnRename_Test()
        {
            //Given
            var fileNotifier  = new FakeNotifier();
            var fileToObserve = new ObserveFileDto()
            {
                DirectoryPath      = mainDir,
                Filter             = "*.*",
                WithSubDirectories = false
            };
            var fileNotifierManager = new FileNotifierManager(fileNotifier);

            //When
            fileNotifierManager.Set(fileToObserve);
            File.Create(FilePath).Close();
            string newfileName = Path.Combine(mainDir, "newFileName.txt");

            File.Move(FilePath, newfileName);
            DeleteIfExist(newfileName);
            //Then
            Assert.That(() => fileNotifier.CountInvoked, Is.EqualTo(3).After(Delay));
        }