static void Main(string[] args) { Console.WriteLine(".........Welcome to C# Interface and Dynamic Loading Sample App............"); string filePath = string.Empty; string input; bool valid = false; do { Console.WriteLine(".............Press 1 for Json File Or Press 2 for Csv file................."); input = Console.ReadLine(); if (input == "1" || input == "2") { valid = true; } } while (!valid); if (input == "1") { filePath = "Files/json1.json"; } else { filePath = "Files/TextFile1.csv"; } IDataReaderService dataReaderService = CreateDataReaderInstance("DataReaderService.DataReaderService,DataReaderService"); Console.WriteLine(dataReaderService.ReadFile(filePath)); Console.WriteLine(".............Thanks, Please press any key to exit................."); Console.ReadLine(); }
public void InitializeDataWriter(ProjectSettings settings, ILogger logger, IDataReaderService reader) { _locationsProvider = new LocationsProvider(settings.OutputPath); _logger = logger; _processedTests = new Dictionary <Guid, ItemInfoDto>(); _reader = reader; }
public static IDataReaderService CreateDataReaderInstance(string assemblyInfo) { Type assemblyType = Type.GetType(assemblyInfo); if (assemblyType != null) { Type[] argTypes = new Type[] { }; ConstructorInfo cInfo = assemblyType.GetConstructor(argTypes); IDataReaderService dataReaderClass = (IDataReaderService)cInfo.Invoke(null); return(dataReaderClass); } else { // Error checking is needed to help catch instances where throw new NotImplementedException(); } }
public void CleanUpReport(RetentionSettings retentionSettings, IDataReaderService reader, IDataWriterService writer) { _logger.Debug($"Running Clean up job: deleting all runs older than {retentionSettings.Till} and leaving {retentionSettings.Amount} runs only"); var runInfos = reader.GetRunInfos().OrderByDescending(ri => ri.Finish).ToList(); var runInfosToDelete = runInfos.Skip(retentionSettings.Amount).ToList(); runInfosToDelete.AddRange(runInfos.Take(retentionSettings.Amount).Where(ri => ri.Finish < retentionSettings.Till)); foreach (var itemInfoDto in runInfosToDelete) { var run = reader.GetRun(itemInfoDto.Guid); if (run != null) { var tests = reader.GetTestRunsFromRun(run); foreach (var test in tests) { var testOutput = reader.GetTestOutput(test); var screenshots = reader.GetTestScreenshots(test); foreach (var screenshot in screenshots) { _actionHelper.Simple(() => { writer.DeleteTestScreenshot(test, screenshot); }); } _actionHelper.Simple(() => { writer.DeleteTestOutput(test, testOutput); }); _actionHelper.Simple(() => { writer.DeleteTest(test); }); } } _actionHelper.Simple(() => { writer.DeleteRun(itemInfoDto); }); } _logger.Debug("Running Clean up job: done."); }
public DataReaderService(IDataReaderService reader) { _reader = reader; }
public void InitializeDataWriter(ProjectSettings settings, ILogger logger, IDataReaderService reader) { }
public DataReaderService(IDataReaderService dataReaderService, ICommonCache cache) { _dataReaderService = dataReaderService; _cache = cache; }