public void TestShouldThrowEmptyExtension() { //Arrange string fileName = "tests\\testEmptyExtension"; //Act try { FileContentProvider provider = new FileContentProvider(); var file = (content : provider.GetContent(fileName), extension : Path.GetExtension(fileName)); FileProcessorFactory fileProcessorFactory = new FileProcessorFactory(); var fileProcessor = fileProcessorFactory.CreateFileProcessor(file.content, file.extension); fileProcessor.Process(file.content); } catch (System.ArgumentException e) { // Assert StringAssert.Contains(e.Message, FileProcessorFactory.EmptyExtensionMessage); return; } Assert.Fail("The expected exception was not thrown."); }
static void Main(string[] args) { var dataProcessor = FileProcessorFactory.GetFileEditor(@"C:\Users\kateryna.burtseva\Documents\working-with-files\working-with-files\DataIntegration\JsonIntegration\Accounts1.json", typeof(Account)); var kateAcc = dataProcessor.GetAccount("AccountName", "Alonka"); Person person = new Person(); dataProcessor.AddNewRecord <Person>(person); }
//Note: Ideally once schedule is loaded through schedule engine, it will be persisted in a DB so we would not need to load it again from file system Schedule GetScheduleToLoadOrder() { var fileProcessor = FileProcessorFactory.GetFileProcessor(ConfigurationManager.AppSettings["scheduleFile"]); var content = fileProcessor.GetFileContent(); var scheduleManager = new ScheduleManager(); return(scheduleManager.Import(content)); }
public override void DoWork() { // Import Schedule : assumption from a json file var fileProcessor = FileProcessorFactory.GetFileProcessor(FilePath); var content = fileProcessor.GetFileContent(); // Import Schedule var schedule = ScheduleManager.Import(content); // Display Schedule ScheduleManager.Print(schedule); }
/// <summary> /// Begins the work. /// </summary> protected override void BeginWork() { base.BeginWork(); try { m_Parameters = DocumentImportHelper.GetProfileBeo((string)BootParameters); m_CounterForCorrelationId = 0; InitializeConfigurationItems(); //?? need to percentage completion m_PercenatgeCompletion = 100; m_Documents = new List <RVWDocumentBEO>(); #region Get Dataset Details if (m_Parameters != null && m_Parameters.DatasetDetails.FolderID > 0) { m_FileProcessor = FileProcessorFactory.CreateFileProcessor( FileProcessorFactory.ExtractionChoices.CompoundFileExtraction); m_Dataset = DataSetBO.GetDataSetDetailForDataSetId(m_Parameters.DatasetDetails.FolderID); if (m_Dataset.Matter != null && m_Dataset.Matter.FolderID > 0) { var matterDetails = MatterDAO.GetMatterDetails(m_Dataset.Matter.FolderID.ToString()); if (matterDetails != null) { m_Dataset.Matter = matterDetails; var searchServerDetails = ServerDAO.GetSearchServer(matterDetails.SearchServer.Id); if (searchServerDetails != null) { m_Dataset.Matter.SearchServer = searchServerDetails; } } } else { throw new EVException().AddErrorCode(ErrorCodes.EDLoaderExtractionWorker_FailedToObtainMatterDetails); //?? need to set message in resource file } } else { throw new EVException().AddErrorCode(ErrorCodes.EDLoaderExtractionWorker_ObtainDatasetDetailsFailure); //?? need to set message in resource file } #endregion } catch (Exception ex) { ex.Trace().Swallow(); } }
public override void DoWork() { // Get File contect var fileProcessor = FileProcessorFactory.GetFileProcessor(FilePath); var content = fileProcessor.GetFileContent(); // Import order var orders = OrderManager.Import(content); // as part of this engine schedule needs to be referenced too, so we can assign order to scheduled flights // so loaded schedule again var schedule = GetScheduleToLoadOrder(); // Map Order to Schedule var mapOrderToFlights = OrderManager.MapOrderToFlights(schedule, orders); OrderManager.Print(mapOrderToFlights); }
public void TestTextFile() { //Arrange string fileName = "tests\\testText.txt"; string expected = "text"; //Act FileContentProvider provider = new FileContentProvider(); var file = (content : provider.GetContent(fileName), extension : Path.GetExtension(fileName)); FileProcessorFactory fileProcessorFactory = new FileProcessorFactory(); var fileProcessor = fileProcessorFactory.CreateFileProcessor(file.content, file.extension); fileProcessor.Process(file.content); //Assert string actual = fileProcessor.ReturnType(); Assert.AreEqual(expected, actual, "Wrong type (expected:" + expected); }
public ImageImporter() { m_FileProcessorFactory = new FileProcessorFactory(); m_ConfigurationProvider = new ConfigurationProvider(); Configuration = m_ConfigurationProvider.ProvideDefaultConfiguration(); }
public void SetUp() { m_FileProcessorFactory = new FileProcessorFactory(); }