public void Should_DeleteRemovedFileFromCache_When_FileIsRemovedFromDirectory()
        {
            string deletedFileName = "deletedFileName";
            string existingDirectoryPath = "existingFilePath", fullExistingDirectoryPath = "fullExistingDirectoryPath";

            A.CallTo(() => _directoryPathValidator.ValidateDirectoryPath(existingDirectoryPath)).Returns(true);
            A.CallTo(() => _pathHelper.CanWrite(A <string> .Ignored)).Returns(true);
            A.CallTo(() => _pathHelper.GetFullPath(existingDirectoryPath)).Returns(fullExistingDirectoryPath);
            var testMonitor = new DirectoryMonitorWhichAllowsToFireEventsFromOutside();

            _objectUnderTest = new AgeAggregatorService(_directoryPathValidator, _notifier, _pathHelper, testMonitor, _peopleCache, _peopleAverageAgeEvaluator, _averagePeopleAgePerCountrySerializer, _fileHelper);

            _objectUnderTest.RunAsync(existingDirectoryPath, null);
            Thread.Sleep(1000);
            testMonitor.ForceFileRemoved(deletedFileName);

            A.CallTo(() => _peopleCache.ExcludeFiles(Path.Combine(fullExistingDirectoryPath, deletedFileName))).MustHaveHappened(Repeated.Exactly.Once);
        }
        public void Should_NotifyUser_When_FileIsAddedToDirectory()
        {
            string newFileName = "newFileName";
            string existingDirectoryPath = "existingFilePath", fullExistingDirectoryPath = "fullExistingDirectoryPath";

            A.CallTo(() => _directoryPathValidator.ValidateDirectoryPath(existingDirectoryPath)).Returns(true);
            A.CallTo(() => _pathHelper.CanWrite(A <string> .Ignored)).Returns(true);
            A.CallTo(() => _pathHelper.GetFullPath(existingDirectoryPath)).Returns(fullExistingDirectoryPath);
            var testMonitor = new DirectoryMonitorWhichAllowsToFireEventsFromOutside();

            _objectUnderTest = new AgeAggregatorService(_directoryPathValidator, _notifier, _pathHelper, testMonitor, _peopleCache, _peopleAverageAgeEvaluator, _averagePeopleAgePerCountrySerializer, _fileHelper);

            _objectUnderTest.RunAsync(existingDirectoryPath, null);
            Thread.Sleep(1000);
            testMonitor.ForceFileAdded(newFileName);

            A.CallTo(() => _notifier.NotifyUser("File newFileName has been added to the directory. Recalculating results...")).MustHaveHappened(Repeated.Exactly.Once);
        }