public void RemoveFromObservableListException_Test() { //Given var mockNotifier = Substitute.For <IFileNotifier>(); var fileNotifierManager = new FileNotifierManager(mockNotifier); const string path = @"D:\data.xml"; //Then Assert.Throws <InvalidOperationException>(() => fileNotifierManager.Remove(path)); }
public void RemoveFromObservableList_Test() { //Given var mockNotifier = Substitute.For <IFileNotifier>(); var fileNotifierManager = new FileNotifierManager(mockNotifier); const string path = @"D:\data.xml"; var fileToObserve = new ObserveFileDto() { DirectoryPath = path, Filter = string.Empty, WithSubDirectories = true }; //When fileNotifierManager.Set(fileToObserve); fileNotifierManager.Remove(path); //Then Assert.AreEqual(fileNotifierManager.PerformFileList().Count, 0); }
public void RemoveFromObservableList_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(); fileNotifierManager.Remove(fileToObserve.DirectoryPath); DeleteIfExist(FilePath); //Then Assert.That(() => fileNotifier.CountInvoked, Is.EqualTo(1).After(Delay)); }
public void RemoveObservedPath(string path) { _fileNotifierManager.Remove(path); }