コード例 #1
0
        public static async Task <int> Run(Config config)
        {
            if (config == null)
            {
                Console.WriteLine("Config is null");
                return(-1);
            }

            // don't run the test on a dry run
            if (config.DryRun)
            {
                return(DoDryRun(config));
            }

            // create the test
            using WebV webv = new CSE.WebValidate.WebV(config);

            if (config.RunLoop)
            {
                // run in a loop
                return(webv.RunLoop(config, TokenSource.Token));
            }
            else
            {
                // run one iteration
                return(await webv.RunOnce(config, TokenSource.Token).ConfigureAwait(false));
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: msalemcode/webvalidate
        public static async Task <int> Run(Config config)
        {
            if (config == null)
            {
                Console.WriteLine("CommandOptions is null");
                return(-1);
            }

            // set any missing values
            config.SetDefaultValues();

            // don't run the test on a dry run
            if (config.DryRun)
            {
                return(DoDryRun(config));
            }

            // create the test
            try
            {
                using WebV webv = new CSE.WebValidate.WebV(config);

                if (config.RunLoop)
                {
                    // run in a loop
                    return(webv.RunLoop(config, TokenSource.Token));
                }
                else
                {
                    // run one iteration
                    return(await webv.RunOnce(config, TokenSource.Token).ConfigureAwait(false));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine($"\n{ex}\n\nWebV:Exception:{ex.Message}");
                return(1);
            }
        }