コード例 #1
0
        private void GetEnvironment(string database, string logpath, string exportpath, string connectionstring, string provider)
        {
            _settings = GetIsolatedEnvironmentSettingsCollection();
            if (!string.IsNullOrWhiteSpace(database))
            {
                _settings.AddSetting(MachineName, EnvironmentName, database, provider, connectionstring);
            }
            if (!string.IsNullOrWhiteSpace(logpath))
            {
                _settings.AddSetting(MachineName, EnvironmentName, logpath, provider);
            }
            if (!string.IsNullOrWhiteSpace(exportpath))
            {
                _settings.AddSetting(MachineName, EnvironmentName, exportpath, provider);
            }

            _environment        = new Environment(MachineName, EnvironmentName, _settings);
            _genFormEnvironment = new GenFormEnvironment(_environment);
        }
コード例 #2
0
        public static GenFormEnvironment CreateTestGenFormEnvironment()
        {
            var source = new TestSource();

            var keyMan = Isolate.Fake.Instance <SecretKeyManager>();

            Isolate.WhenCalled(() => keyMan.GetKey()).WillReturn("secret");
            Isolate.WhenCalled(() => keyMan.SetKey("secret")).IgnoreCall();


            var envSets = new EnvironmentSettingsCollection(source);

            envSets.AddSetting("MyMachine", "Test", "Database", "Provider", "Some connection string");
            envSets.AddSetting("MyMachine", "Test", "LogPath", "File", string.Empty);
            envSets.AddSetting("MyMachine", "Test", "ExportPath", "File", string.Empty);

            var env = new Environment("MyMachine", "Test", envSets);

            return(new GenFormEnvironment(env));
        }
コード例 #3
0
        private void GetEnvironment(string database, string logpath, string exportpath, string connectionstring, string provider)
        {
            _settings = GetIsolatedEnvironmentSettingsCollection();
            if (!string.IsNullOrWhiteSpace(database)) _settings.AddSetting(MachineName, EnvironmentName, database, provider, connectionstring);
            if (!string.IsNullOrWhiteSpace(logpath)) _settings.AddSetting(MachineName, EnvironmentName, logpath, provider);
            if (!string.IsNullOrWhiteSpace(exportpath)) _settings.AddSetting(MachineName, EnvironmentName, exportpath, provider);

            _environment = new Environment(MachineName, EnvironmentName, _settings);
            _genFormEnvironment = new GenFormEnvironment(_environment);
        }