public void SetProcessTest()
 {
     using (var processDisplay = new CustomProcessDisplay(UnitTestInitializeCsv.Token))
     {
         processDisplay.SetProcess("Test", -1, true);
     }
 }
 public void SetProcessTest2()
 {
     using (var processDisplay = new CustomProcessDisplay(UnitTestInitializeCsv.Token))
     {
         processDisplay.Maximum = 5;
         processDisplay.SetProcess(null, new ProgressEventArgs("Hallo", 2, false));
     }
 }
 public void SetProcessTest1()
 {
     using (var processDisplay = new CustomProcessDisplay(UnitTestInitializeCsv.Token))
     {
         processDisplay.Maximum = 5;
         processDisplay.SetProcess("Test", 100, true);
     }
 }
        public void CustomProcessDisplayTest()
        {
            var called = false;

            using (var processDisplay = new CustomProcessDisplay(UnitTestInitializeCsv.Token))
            {
                processDisplay.Progress += (sender, args) => { called = true; };
                processDisplay.SetProcess("Test", -1, true);
                Assert.IsTrue(called);
            }
        }
        public async Task StructuredFileWriterJSONEncodeTestAsync()
        {
            var writeFile = new StructuredFile
            {
                ID           = "Write",
                FileName     = "StructuredFileOutputJSON.txt",
                SqlStatement = c_ReadID,
                InOverview   = true,
                JSONEncode   = true
            };

            var sb = new StringBuilder("{");

            using (var processDisplay = new CustomProcessDisplay(UnitTestInitializeCsv.Token))
            {
                var cols = await DetermineColumnFormat.GetSqlColumnNamesAsync(writeFile.SqlStatement, writeFile.Timeout,
                                                                              processDisplay.CancellationToken);

                writeFile.Header = "{\"rowset\":[\n";

                // { "firstName":"John", "lastName":"Doe"},
                foreach (var col in cols)
                {
                    sb.AppendFormat("\"{0}\":\"{1}\", ", HTMLStyle.JsonElementName(col),
                                    string.Format(CultureInfo.InvariantCulture, StructuredFileWriter.cFieldPlaceholderByName, col));
                }

                if (sb.Length > 1)
                {
                    sb.Length -= 2;
                }
                sb.AppendLine("},");
                writeFile.Row = sb.ToString();
                var writer = new StructuredFileWriter(writeFile, processDisplay);
                var result =
                    await writer.WriteAsync(writeFile.SqlStatement, writeFile.Timeout, t => processDisplay.SetProcess(t, 0, true),
                                            processDisplay.CancellationToken);

                Assert.AreEqual(7L, result);
            }
        }