示例#1
0
        public void EnvironmentAgentRepository_GetAllValues()
        {
            var repo = new EnvironmentAgentRepository();

            var values = repo.GetAllValues <List <EnvironmentAgentInfoList> >();

            Assert.IsNotNull(values);
            Assert.IsTrue(values.Count > 0);
        }
示例#2
0
        public void Initialize()
        {
            // If the user's config file does not contain a Agent/POS list,
            // then load them from the default EnvironmentAgents.json file.
            if (File.Exists(AgentsDataFilePath) &&
                (!File.Exists(UserConfigFilePath) || !UserSettings.HasAgents))
            {
                var repo = new EnvironmentAgentRepository();
                var environmentAgents = repo.GetAllValues <List <EnvironmentAgentInfoList> >()
                                        .ToDictionary(x => x.Environment, x => x.Agents);

                var settings = UserSettings;
                settings.EnvironmentAgents = environmentAgents;

                SaveSettingsFile(settings);
            }
            else if (File.Exists(UserConfigFilePath))
            {
                // Save Environments.json file with userconfig data. (this usually happens when a new release comes out and they dont want to erase custom agents)
                SaveSettingsFile(UserSettings);
            }
        }