Ejemplo n.º 1
0
        public void Run(ExecutionOptions options)
        {
            _logger.LogTrace("Starting the engine...");

            if (options == null)
            {
                throw new ArgumentException("The options parameter is required", nameof(options));
            }

            List <string> errors;

            if (!options.IsValid(out errors))
            {
                var error = errors.Aggregate((current, next) => $"{current}{Environment.NewLine}{next}");
                throw new ArgumentException($"Some options are not valid. Errors: {error}", nameof(options));
            }

            IUserConfig userConfig;

            try
            {
                userConfig = _userConfigStore.ReadUserConfig(options.ConfigMappedPath);
            }
            catch (Exception ex)
            {
                _logger.LogError(EventIds.UserConfigReadException, ex, "Error when reading the user configuration yaml file");
                throw;
            }

            if (options.Mode == ExecutionMode.Screenshot)
            {
                TakeScreenshots(options, userConfig);
            }
            else if (options.Mode == ExecutionMode.Compare)
            {
                CompareScreenshots(options, userConfig);
            }
        }