Пример #1
0
        public TemplateValidationResult StartTemplateValidationProcess()
        {
            _processStartArgs.StartTime = DateTime.Now;
            OnProcessStart(_processStartArgs);



            _processCompletionArgs = new ProcessCompletionArgs(_processStartArgs);
            _processCompletionArgs.XmlDocumentInformation = GetXMLContent();


            if (_processCompletionArgs.XmlDocumentInformation.IsLoaded)
            {
                if (ValidateXMLFormat())
                {
                    _processCompletionArgs.XmlDocumentInformation.Variables = GetVariables(_processCompletionArgs.XmlDocumentInformation.Document);
                    ValidateContent();
                }
                else
                {
                    throw new ArgumentException("Impossible de récupérer le xml.");
                }
            }


            _processCompletionArgs.CompletionTime = DateTime.Now;
            _processCompletionArgs.IsSuccess      = _processCompletionArgs.StepProcess.Where(x => !x.IsSuccess).Count() == 0;
            OnProcessCompletion(_processCompletionArgs);

            var result = new TemplateValidationResult()
            {
                DurationInSeconds = (_processCompletionArgs.CompletionTime - _processCompletionArgs.StartTime).TotalSeconds,
                Libelle           = _processCompletionArgs.Libelle,
                IsSuccess         = _processCompletionArgs.StepProcess.Where(x => !x.IsSuccess).Count() == 0,
                UnusedFiles       = _unusedFiles,
            };

            foreach (ProcessStepCompletionArgs scargs in _processCompletionArgs.StepProcess)
            {
                var scr = new StepValidationResult(scargs);
                result.Steps.Add(scr);
            }
            return(result);
        }
Пример #2
0
 protected virtual void OnProcessCompletion(ProcessCompletionArgs e) => ProcessCompletion?.Invoke(this, e);