Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="taskExecuter"></param>
        /// <returns></returns>
        private bool InternalExecuteTask(TaskExecuter taskExecuter)
        {
            var result = taskExecuter.Execute();

            TaskExecuted?.Invoke(taskExecuter);

            return(result);
        }
        internal int OnExecute()
        {
            Console.CancelKeyPress += OnExit;

            Logger.IsColorEnabled = !IsColorDisabled;
            Logger.IsVerbose      = IsVerbose;

            var context = new TaskContext()
            {
                TaskDefinitionFilePath = TaskDefinitionFilePath,
                EnvironmentVariables   = EnvironmentVariables,
                SkippedSteps           = SkippedSteps,
                WorkingDirectory       = WorkingDictionary ?? Environment.CurrentDirectory
            };

            executer = new TaskExecuter(context);

            return(executer.Execute());
        }
        public void SuccessTest()
        {
            var path = Path.GetFullPath("../../../../example-definitions/example3.yml");

            var context = new TaskContext()
            {
                TaskDefinitionFilePath = path,
                EnvironmentVariables   = new Dictionary <string, string>(),
                SkippedSteps           = new HashSet <int>(),
                WorkingDirectory       = Environment.CurrentDirectory
            };

            var executer   = new TaskExecuter(context);
            var exitCode   = executer.Execute();
            var testModule = executer.Definition.Modules["test"] as TestModule;

            Assert.AreEqual((int)ExitCode.Success, exitCode);
            Assert.AreEqual(3, testModule.CallCount);
        }