public void TestProcessFile() { var output = new StringWriter(); Console.SetOut(output); ProcessFile pf = new ProcessFile(); pf.ProcessJSONFiles(@"C:\sample-data", @"C:\Processed"); StringBuilder sb = new StringBuilder(); sb.AppendLine("Processing drop-1.json"); sb.AppendLine("Completed drop-1.json"); sb.AppendLine("Power Tools - Artarmon - 20"); sb.AppendLine("Power Tools - Notting Hill - 44"); sb.AppendLine("Power Tools - Notting Hill - 44"); sb.AppendLine("Power Tools - Oakleigh - 7"); sb.AppendLine("Processing drop-2.json"); sb.AppendLine("Discarding drop-2.json, incorrect qtysum"); sb.AppendLine("Power Tools - Artarmon - 20"); sb.AppendLine("Power Tools - Notting Hill - 44"); sb.AppendLine("Power Tools - Notting Hill - 44"); sb.AppendLine("Power Tools - Oakleigh - 7"); sb.AppendLine("Processing drop-3.json"); sb.AppendLine("Completed drop-3.json"); sb.AppendLine("Power Tools - Artarmon - 21"); sb.AppendLine("Power Tools - Notting Hill - 44"); sb.AppendLine("Power Tools - Notting Hill - 44"); sb.AppendLine("Power Tools - Oakleigh - 12"); sb.AppendLine("Tiles - Oakleigh - 1"); Assert.Equal(output.ToString(), sb.ToString()); }
static void Main(string[] args) { //Mounted Volume path on the Container // [Your Folder Location]:/app/data/ try { string path = Directory.GetCurrentDirectory(); string sourcePath = System.IO.Path.Combine(path, "data"); string targetPath = System.IO.Path.Combine(path, "processed"); Console.WriteLine("Hello from Docker Compose"); ProcessFile pf = new ProcessFile(); pf.ProcessJSONFiles(sourcePath, targetPath); } catch (Exception ex) { Console.WriteLine(ex.Message); } }