private static async Task MainAsync() { var filePipe = new FilePipe( Container.Resolve <IConfig>(), Container.Resolve <IResultFactory>(), ExitToken.Token); var metadataPipe = new MetadataPipe( Container.Resolve <IConfig>(), Container.Resolve <IResultFactory>(), filePipe); var transferPipe = new TransferPipe( Container.Resolve <IConfig>(), Container.Resolve <IResultFactory>(), metadataPipe); var cancelSource = new CancellationTokenSource(); var ui = Task.Run(() => ReportStatus(Container.Resolve <IResultFactory>(), filePipe, metadataPipe, transferPipe, cancelSource.Token)); await Task.WhenAll(filePipe.Execute(), metadataPipe.Execute(), transferPipe.Execute()); cancelSource.Cancel(); await ui; var results = Container.Resolve <IResultFactory>(); Console.WriteLine("Complete. Writing index file."); results.WriteFile(); }
public async void FileShouldBeMovedDueToAge() { //Arrange var config = ReusableMocks.MockConfig(); var file = TestUtilities.CreateFile(config.Src, "Example.doc", DateTime.Now.Add(config.CurrentTimespan).AddDays(-1)); var pipe = new MetadataPipe( config, ReusableMocks.MockResultFactory(), ReusableMocks.MockMetadataPipe(file)); Assert.That(Directory.GetFiles(config.Src).Length > 0); //Act await pipe.Execute(); //Assert Assert.That(pipe.Buffer.Count == 1); }
public async void FileShouldBeIgnoredDueToIgnoreList() { //Arrange var config = ReusableMocks.MockConfig(); var file = TestUtilities.CreateFile(config.Src, "_checksum.doc", DateTime.Now); var pipe = new MetadataPipe( config, ReusableMocks.MockResultFactory(), ReusableMocks.MockMetadataPipe(file)); Assert.That(Directory.GetFiles(config.Src).Length > 0); //Act await pipe.Execute(); //Assert Assert.That(pipe.Buffer.Count == 0); }