예제 #1
0
        public DeveroomConfiguration Load(string configFilePath)
        {
            var config = new DeveroomConfiguration();

            Update(config, configFilePath);
            return(config);
        }
예제 #2
0
        public void Update(DeveroomConfiguration config, string configFileContent, string configFolder)
        {
            _configDeserializer.Populate(configFileContent, config);

            config.ConfigurationBaseFolder = configFolder;

            config.SpecFlow.ConfigFilePath  = EnsureFullPath(config, c => c.SpecFlow.ConfigFilePath);
            config.SpecFlow.GeneratorFolder = EnsureFullPath(config, c => c.SpecFlow.GeneratorFolder, isFolder: true);
        }
예제 #3
0
        public void Update(DeveroomConfiguration config, string configFilePath)
        {
            if (!File.Exists(configFilePath))
            {
                throw new DeveroomConfigurationException($"The specified config file '{configFilePath}' does not exist.");
            }
            var configFolder = Path.GetDirectoryName(configFilePath) ??
                               throw new DeveroomConfigurationException($"The specified config file '{configFilePath}' does not contain a folder.");

            var jsonString = File.ReadAllText(configFilePath);

            Update(config, jsonString, configFolder);
        }
예제 #4
0
        private string EnsureFullPath(DeveroomConfiguration config, string filePath, string label, bool isFolder = false)
        {
            if (filePath == null)
            {
                return(null);
            }
            filePath = ExpandEnvironmentVariables(filePath);
            var fullPath = Path.GetFullPath(Path.Combine(config.ConfigurationBaseFolder, filePath));

            if (!isFolder && !File.Exists(fullPath))
            {
                throw new DeveroomConfigurationException($"Unable to access file '{fullPath}'. Please make sure you specify a path for an existing file for the {label} option.");
            }
            if (isFolder && !Directory.Exists(fullPath))
            {
                throw new DeveroomConfigurationException($"Unable to access directory '{fullPath}'. Please make sure you specify a path for an existing directory for the {label} option.");
            }
            return(fullPath);
        }
예제 #5
0
 protected bool Equals(DeveroomConfiguration other)
 {
     return(string.Equals(ConfigurationBaseFolder, other.ConfigurationBaseFolder) && Equals(SpecFlow, other.SpecFlow) && Equals(Traceability, other.Traceability) && ProcessorArchitecture == other.ProcessorArchitecture && DebugConnector == other.DebugConnector && string.Equals(DefaultFeatureLanguage, other.DefaultFeatureLanguage) && string.Equals(ConfiguredBindingCulture, other.ConfiguredBindingCulture));
 }
예제 #6
0
 public void Populate(string jsonString, DeveroomConfiguration config)
 {
     JsonConvert.PopulateObject(jsonString, config, GetJsonSerializerSettings(true));
 }
예제 #7
0
        private string EnsureFullPath(DeveroomConfiguration config, Expression <Func <DeveroomConfiguration, string> > configAccessor, bool isFolder = false)
        {
            var filePath = configAccessor.Compile().Invoke(config);

            return(EnsureFullPath(config, filePath, configAccessor.ToString(), isFolder));
        }