public async Task LoadingSaving() { var file = Path.Combine(TestContext.CurrentContext.TestDirectory, Guid.NewGuid().ToString()); DocumentSetHandler loader = new DocumentSetHandler(file); var data = await loader.Load(CancellationToken.None).ConfigureAwait(false); Assert.IsNull(data); data = new DocumentSet(); await loader.Save(data, CancellationToken.None).ConfigureAwait(false); data = await loader.Load(CancellationToken.None).ConfigureAwait(false); Assert.IsNotNull(data); Assert.IsTrue(File.Exists(file)); }
protected override void ConfigureContainer() { base.ConfigureContainer(); LightSplitterHelper helper = new LightSplitterHelper(); helper.Load(); var documentParser = new DocumentParser(helper, new DevExpressParserFactory(20)); var factory = new FileManagerFactory(documentParser); Container.ComposeExportedValue <IFileManagerFactory>(factory); FileMonitorFactory monitorFactory = new FileMonitorFactory(documentParser); Container.ComposeExportedValue <IFileMonitorFactory>(monitorFactory); var documentHandler = new DocumentSetHandler(System.IO.Path.Combine(".", "documents.dat")); Container.ComposeExportedValue <IDataHandler <DocumentSet> >(documentHandler); var trainingResultLoader = new TrainingResultsHandler("Learning"); Container.ComposeExportedValue <IDataHandler <TrainingResults> >(trainingResultLoader); }