Пример #1
0
        /// <summary>
        /// Verify that the test is viable.
        /// </summary>
        /// <param name="doshConfig"><see cref="DoshFileModel"/></param>
        private bool ensureTestExecute(DoshFileModel doshConfig)
        {
            var result     = false;
            var testIdPath = GetTestIdDirectory(doshConfig.ID);

            if (!Directory.Exists(testIdPath))
            {
                try
                {
                    var testIdDir = Directory.CreateDirectory(testIdPath);
                    result = true;
                }
                catch (IOException ioEx)
                {
                    var msg = string.Format(CLI_00102, "__test__", ioEx);
                    throw new DoshScaffoldException(msg, ioEx);
                }
                catch (UnauthorizedAccessException anAuthEx)
                {
                    var msg = string.Format(CLI_00101, anAuthEx);
                    throw new DoshScaffoldException(msg, anAuthEx);
                }
            }
            else
            {
                result = true;
            }

            return(result);
        }
Пример #2
0
        public List <ITestExec> Analyze(DoshFileModel doshFile)
        {
            var tests = new List <ITestExec>();

            foreach (var test in doshFile.TestSets)
            {
                var testCase = new TestExec.TestExec();
                testCase.Initializers = analyzeSetup(test.Value.SetupConfig);
                test.Value.RunConfig.Steps.AsParallel().ForAll(r => analyzeRunStep(r));
                test.Value.CleanupConfig.AsParallel().ForAll(c => analyzeCleanup(c));
                tests.Add(testCase);
            }

            return(tests);
        }
Пример #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="doshConfig"></param>
        private void scaffoldTestCases(DoshFileModel doshConfig)
        {
            var scaffolds = doshConfig.TestSets.Select <KeyValuePair <string, TestSet>, Action>(t => () =>
            {
                var testIdPath = GetTestIdDirectory(doshConfig.ID);
                if (!Directory.Exists(testIdPath))
                {
                    throw new DoshScaffoldException(CLI_00103);
                }

                var testCasePath = Path.Combine(testIdPath, t.Key);
                if (!Directory.Exists(testCasePath))
                {
                    try
                    {
                        Directory.CreateDirectory(testCasePath);
                    }
                    catch (IOException ioEx)
                    {
                        var msg = string.Format(CLI_00102, $"__test__/{t.Key}", ioEx);
                        throw new DoshScaffoldException(msg, ioEx);
                    }
                    catch (UnauthorizedAccessException anAuthEx)
                    {
                        var msg = string.Format(CLI_00101, anAuthEx);
                        throw new DoshScaffoldException(msg, anAuthEx);
                    }
                    catch (System.Exception ex)
                    {
                        var msg = string.Format(CLI_00100, ex);
                        throw new DoshScaffoldException(msg, ex);
                    }
                }

                scaffoldWkInitDirectory(testCasePath, t.Value);
                scaffoldWkDataDirectory(testCasePath, t.Value);
                scaffoldWkEvidenceDirectory(testCasePath, t.Value);
            }).AsParallel();

            scaffolds.ForAll(s => s.Invoke());
        }