public async void PathWatchingEnded_EmptyWatchedFolderRemoved_Raised() { var engine = SearchEngineFactory.New(); var tcs = new TaskCompletionSource <bool>(); using (var folder = new TestFolder()) { var folderPath = folder.Path; using (var file = new TestFile("foo", folderPath)) { engine.Add(folder.Path); await Task.Delay(100); engine.PathWatchingEnded += args => { tcs.TrySetResult(Path.GetFullPath(folderPath) == args.Path); }; file.Delete(); folder.Delete(); Assert.True(await tcs.Task); } } }
public async void FileRemovingEvents_FileInFolderRemoved_Raised(string eventName) { var engine = SearchEngineFactory.New(); var tcs = new TaskCompletionSource <bool>(); using (var folder = new TestFolder()) { var folderPath = folder.Path; using (var subFolder = new TestFolder(folderPath)) { var subFolderPath = subFolder.Path; using (var file = new TestFile("foo", subFolderPath)) { var filePath = file.Path; engine.Add(folderPath); await Task.Delay(100); engine.AddHandler(eventName, args => { tcs.TrySetResult(Path.GetFullPath(filePath) == args.Path); }); file.Delete(); Assert.True(await tcs.Task); } } } }
public void DeleteFromNotExistingFile() { // Setup var fileSystem = new TestFileSystem(); var file = new TestFile(fileSystem, "\\this\\is\\a\\file.txt"); // Execute file.Delete(); }
public void DeleteNotExistingFile() { // Setup var fileSystem = new TestFileSystem(); fileSystem.StageDirectory("\\this\\is\\a"); var file = new TestFile(fileSystem, "\\this\\is\\a\\file.txt"); // Execute file.Delete(); // Assert Assert.IsFalse(file.Exists); }
public void DeleteFile() { // Setup var fileSystem = new TestFileSystem(); var file = new TestFile(fileSystem, "\\this\\is\\a\\file.txt"); var stream = new MemoryStream(); file.Create(stream); // Execute file.Delete(); // Assert Assert.IsFalse(file.Exists); }