private void ClearQueueTempFolder() { if (Directory.Exists(longFolderName)) { foreach (var file in Directory.GetFiles(longFolderName)) { File.SetAttributes(file, FileAttributes.Archive); } Directory.Delete(longFolderName, true); } }
private static void ClearQueueTempFolder() { if (Directory.Exists(TestConfig.QueueFolder)) { foreach (var file in Directory.GetFiles(TestConfig.QueueFolder)) { File.SetAttributes(file, FileAttributes.Archive); } Directory.Delete(TestConfig.QueueFolder, true); } }
public void what_happens_if_task_file_cannot_be_deleted() { _queue.DeleteTaskFileAfterImport = true; var attribute = File.GetAttributes(_pathToTask); File.SetAttributes(_pathToTask, attribute | FileAttributes.ReadOnly); _queue.PollFileSystem(); Assert.That(File.Exists(_pathToTask), Is.True); //file cannot be deleted _commandBus.Received(1).Send(Arg.Any <ICommand>(), "import-from-file"); _queue.PollFileSystem(); _commandBus.Received(1).Send(Arg.Any <ICommand>(), "import-from-file"); }
public void task_file_cannot_be_deleted_but_then_modified_to_retry() { _queue.DeleteTaskFileAfterImport = true; var attribute = File.GetAttributes(_pathToTask); File.SetAttributes(_pathToTask, attribute | FileAttributes.ReadOnly); _queue.PollFileSystem(); Assert.That(File.Exists(_pathToTask), Is.True); //file cannot be deleted _commandBus.Received(1).Send(Arg.Any <ICommand>(), "import-from-file"); _queue.PollFileSystem(); _commandBus.Received(1).Send(Arg.Any <ICommand>(), "import-from-file"); attribute = File.GetAttributes(_pathToTask); File.SetAttributes(_pathToTask, attribute & ~FileAttributes.ReadOnly); File.SetLastWriteTime(_pathToTask, DateTime.UtcNow); _queue.PollFileSystem(); _commandBus.Received(2).Send(Arg.Any <ICommand>(), "import-from-file"); }