コード例 #1
0
        public void WorkManagerInvokedWithDeleteNothingShouldDeleteNoFiles()
        {
            int deleted = 0;
            var dummyLoggerScrapHeap = new DummyLoggerScrapHeap();

            WorkManager workManager = new WorkManager(new MockFileSystemIterator(), dummyLoggerScrapHeap);
            workManager.Delete("source", new List<AbstractCommand>() { new DeleteNothing() });
            dummyLoggerScrapHeap.LoggingStream.Subscribe(x => deleted++);

            Assert.AreEqual(0, deleted);
        }
コード例 #2
0
        public void WorkManagerInvokedWithHasDateAndDirectoriesOnlyShouldDeleteOnlySpecificEntities()
        {
            int deleted = 0;
            var dummyLoggerScrapHeap = new DummyLoggerScrapHeap();

            WorkManager workManager = new WorkManager(new MockFileSystemIterator(), dummyLoggerScrapHeap);
            workManager.Delete("source", new List<AbstractCommand>()
            {
                new HasDate(x => x.Year == 2011 && x.Month == 3 && x.Day == 13),
                new DirectoriesOnly()
            });
            dummyLoggerScrapHeap.LoggingStream.Subscribe(x => deleted++);

            Assert.AreEqual(1, deleted);
        }
コード例 #3
0
        public void WorkManagerInvokedWithFileExtensionTxtShouldDeleteOnlySpecificEntities()
        {
            int deleted = 0;
            var dummyLoggerScrapHeap = new DummyLoggerScrapHeap();

            WorkManager workManager = new WorkManager(new MockFileSystemIterator(), dummyLoggerScrapHeap);
            workManager.Delete("source", new List<AbstractCommand>()
            {
                new FileExtension("txt")
            });
            dummyLoggerScrapHeap.LoggingStream.Subscribe(x => deleted++);

            Assert.AreEqual(1, deleted);
        }
コード例 #4
0
        public void WorkManagerInvokedWithNoFilterShouldDeleteAllFiles()
        {
            int deleted = 0;
            var dummyLoggerScrapHeap = new DummyLoggerScrapHeap();

            WorkManager workManager = new WorkManager(new MockFileSystemIterator(), dummyLoggerScrapHeap);
            workManager.Delete("source");
            dummyLoggerScrapHeap.LoggingStream.Subscribe(x => deleted++);

            Assert.AreEqual(3, deleted);
        }
コード例 #5
0
ファイル: Blockbuster.cs プロジェクト: cburgdorf/Blockbuster
 /// <summary>
 /// This overload is useful if you take care of the command instantiation yourself
 /// (e.g. when you use the Blockbuster API inside your own application)
 /// </summary>
 /// <param name="directory">Directory to delete</param>
 /// <param name="commands">The list of commands to be used for the cleanup</param>
 public void CleanUp(string directory, IEnumerable<AbstractCommand> commands)
 {
     var workManager = new WorkManager();
     workManager.Delete(directory, commands);
 }