public void Init()
 {
     _source       = SettingSourceFactory.GetSettingSource();
     _settings     = new EnvironmentSettingsCollection(_source);
     _environments = new EnvironmentCollection(_settings);
     _genformEnvs  = new GenFormEnvironmentCollection(_environments);
 }
예제 #2
0
        public void HaveTwoGenFormEnvironmentsAsSpecifiedInTheTestSourceWithOtherSettings()
        {
            _source = new TestSource
            {
                SettingFactory.CreateSecureSetting <ConnectionStringSettings>("[Secure]iCjhnFwaYyeSWXoL5FL7yw==",
                                                                              "MIwslAvaU0oJDYCnnjkaA58MCH0XsCxesdeCC1ENpFbgUgbs44XbzxjgOLRrtfou+M7jz2bFIw6PyKXNLXWzikIWkps6lrhYuvIffqCrotM="),
                SettingFactory.CreateSecureSetting <ConnectionStringSettings>("MyMachine.AcceptanceTest1.Database.SqLite",
                                                                              "MIwslAvaU0oJDYCnnjkaA58MCH0XsCxesdeCC1ENpFbgUgbs44XbzxjgOLRrtfou+M7jz2bFIw6PyKXNLXWzikIWkps6lrhYuvIffqCrotM="),
                SettingFactory.CreateSecureSetting <ConnectionStringSettings>("MyMachine.AcceptanceTest1.LogPath.FileSystem", "log path"),
                SettingFactory.CreateSecureSetting <ConnectionStringSettings>("MyMachine.AcceptanceTest1.ExportPath.FileSystem", "export path"),
                SettingFactory.CreateSecureSetting <ConnectionStringSettings>("MyMachine.AcceptanceTest2.Database.SqLite",
                                                                              "MIwslAvaU0oJDYCnnjkaA58MCH0XsCxesdeCC1ENpFbgUgbs44XbzxjgOLRrtfou+M7jz2bFIw6PyKXNLXWzikIWkps6lrhYuvIffqCrotM="),
                SettingFactory.CreateSecureSetting <ConnectionStringSettings>("MyMachine.AcceptanceTest2.LogPath.FileSystem", "log path"),
                SettingFactory.CreateSecureSetting <ConnectionStringSettings>("MyMachine.AcceptanceTest2.ExportPath.FileSystem", "export path")
            };

            _settings     = new EnvironmentSettingsCollection(_source);
            _environments = new EnvironmentCollection(_settings);

            Assert.AreEqual(2, _environments.Count, "There should be two environments");
            Assert.AreEqual(3, _environments.Single(e => e.Name == "AcceptanceTest1").Settings.Count(), "Environment AcceptanceTest1 should have 3 settings");
            Assert.AreEqual(3, _environments.Single(e => e.Name == "AcceptanceTest2").Settings.Count(), "Environment AcceptanceTest2 should have 3 settings");

            var genfCol = new GenFormEnvironmentCollection(_environments);

            Assert.AreEqual(2, genfCol.Count, "There should be only two GenForm environments");
        }
        private void RefreshEnvironments()
        {
            _settings = new EnvironmentSettingsCollection(_source);
            var envs = new EnvironmentCollection(_settings);

            _environments = new GenFormEnvironmentCollection(envs);
        }
예제 #4
0
 public void Init()
 {
     _source = SettingSourceFactory.GetSettingSource();
     _settings = new EnvironmentSettingsCollection(_source);
     _environments = new EnvironmentCollection(_settings);
     _genformEnvs = new GenFormEnvironmentCollection(_environments);
 }
        public static IEnumerable <GenFormEnvironment> GetEnvironments(string machine)
        {
            var list = GenFormEnvironmentCollection.Create();

            if (!list.Any(e => e.MachineName == System.Environment.MachineName && e.Name == "TestGenForm"))
            {
                list.Add(GenFormEnvironment.CreateTest());
            }
            return(list.Where(e => e.MachineName == machine));
        }
        public static bool AddNewEnvironment(EnvironmentDto dto)
        {
            var list = GenFormEnvironmentCollection.Create();

            try
            {
                list.Add(GenFormEnvironment.Create(dto.Name, dto.provider, dto.Database, dto.LogPath, dto.ExportPath));
                return(true);
            }
            catch (System.Exception)
            {
                return(false);
            }
        }
예제 #7
0
        private void Init()
        {
            _source = new TestSource
            {
                SettingFactory.CreateSecureSetting <ConnectionStringSettings>(GetDatabaseSettingName(),
                                                                              DatabaseConnection),
                SettingFactory.CreateSecureSetting <ConnectionStringSettings>(GetLogPathSettingName(),
                                                                              LogPath),
                SettingFactory.CreateSecureSetting <ConnectionStringSettings>(GetExportPathSettingName(),
                                                                              ExportPath)
            };

            _settings = new EnvironmentSettingsCollection(_source);
            var col = new EnvironmentCollection(_settings);

            _environments = new GenFormEnvironmentCollection(col);
        }
예제 #8
0
        public void HaveOneGenFormEnvironmentWhenOtherEnvironmentTypesWithSameNameInTestSource()
        {
            _source = new TestSource
            {
                SettingFactory.CreateSecureSetting <ConnectionStringSettings>("TestMachine1.GenFormEnv.Test1", "Test"),
                SettingFactory.CreateSecureSetting <ConnectionStringSettings>("TestMachine1.Env2.Test1", "Test"),
                SettingFactory.CreateSecureSetting <ConnectionStringSettings>("TestMachine2.GenFormEnv.Database.SqLite", "Test"),
                SettingFactory.CreateSecureSetting <ConnectionStringSettings>("TestMachine2.GenFormEnv.LogPath.FileSystem", "Test"),
                SettingFactory.CreateSecureSetting <ConnectionStringSettings>("TestMachine1.Env1.Test2", "Test"),
                SettingFactory.CreateSecureSetting <ConnectionStringSettings>("TestMachine2.GenFormEnv.ExportPath.FileSystem", "Test")
            };
            _settings     = new EnvironmentSettingsCollection(_source);
            _environments = new EnvironmentCollection(_settings);

            var genFCol = new GenFormEnvironmentCollection(_environments);

            Assert.IsTrue(genFCol.Any());
        }
예제 #9
0
        public void UseAEnvironmentsCollectionToGetTheGenFormEnvironments()
        {
            _source = new TestSource
            {
                SettingFactory.CreateSecureSetting <ConnectionStringSettings>("TestMachine1.Env1.Database.Provider", "Test"),
                SettingFactory.CreateSecureSetting <ConnectionStringSettings>("TestMachine1.Env1.LogPath.Provider", "Test"),
                SettingFactory.CreateSecureSetting <ConnectionStringSettings>("TestMachine1.Env1.ExportPath.Provider", "Test"),
                SettingFactory.CreateSecureSetting <ConnectionStringSettings>("TestMachine1.Env2.Test4.Provider", "Test")
            };
            _settings     = new EnvironmentSettingsCollection(_source);
            _environments = new EnvironmentCollection(_settings);

            var genFCol = new GenFormEnvironmentCollection(_environments);

            Isolate.WhenCalled(() => _environments.GetEnumerator()).CallOriginal();
            Assert.IsTrue(genFCol.Any());
            Isolate.Verify.WasCalledWithAnyArguments(() => _environments.GetEnumerator());
        }
        public void HaveOneGenFormEnvironmentAsSpecifiedInTheTestSource()
        {
            _source = new TestSource
                             {
                                 SettingFactory.CreateSecureSetting<ConnectionStringSettings>("TestMachine1.Env1.Test1", "Test"),
                                 SettingFactory.CreateSecureSetting<ConnectionStringSettings>("TestMachine1.Env2.Test1", "Test"),
                                 SettingFactory.CreateSecureSetting<ConnectionStringSettings>("TestMachine2.GenFormEnv.Database.SqLite", "Test"),
                                 SettingFactory.CreateSecureSetting<ConnectionStringSettings>("TestMachine2.GenFormEnv.LogPath.FileSystem", "Test"),
                                 SettingFactory.CreateSecureSetting<ConnectionStringSettings>("TestMachine1.Env1.Test2", "Test"),
                                 SettingFactory.CreateSecureSetting<ConnectionStringSettings>("TestMachine2.GenFormEnv.ExportPath.FileSystem", "Test")
                             };
            _settings = new EnvironmentSettingsCollection(_source);
            _environments = new EnvironmentCollection(_settings);

            var genFCol = new GenFormEnvironmentCollection(_environments);

            Assert.IsTrue(genFCol.Any());
        }
예제 #11
0
        public void HaveTwoGenFormEnvironmentAsSpecifiedInTheTestSource()
        {
            _source = new TestSource
            {
                SettingFactory.CreateSecureSetting <ConnectionStringSettings>("TestMachine1.Env1.Test1", "Test"),
                SettingFactory.CreateSecureSetting <ConnectionStringSettings>("TestMachine1.Env2.Test1", "Test"),
                SettingFactory.CreateSecureSetting <ConnectionStringSettings>("TestMachine2.GenFormEnv1.Database.SqLite", "Test"),
                SettingFactory.CreateSecureSetting <ConnectionStringSettings>("TestMachine2.GenFormEnv1.LogPath.FileSystem", "Test"),
                SettingFactory.CreateSecureSetting <ConnectionStringSettings>("TestMachine1.Env1.Test2", "Test"),
                SettingFactory.CreateSecureSetting <ConnectionStringSettings>("TestMachine2.GenFormEnv1.ExportPath.FileSystem", "Test"),
                SettingFactory.CreateSecureSetting <ConnectionStringSettings>("TestMachine2.GenFormEnv2.Database.SqLite", "Test"),
                SettingFactory.CreateSecureSetting <ConnectionStringSettings>("TestMachine2.GenFormEnv2.LogPath.FileSystem", "Test"),
                SettingFactory.CreateSecureSetting <ConnectionStringSettings>("TestMachine2.GenFormEnv2.ExportPath.FileSystem", "Test")
            };
            _settings     = new EnvironmentSettingsCollection(_source);
            _environments = new EnvironmentCollection(_settings);

            var genFCol = new GenFormEnvironmentCollection(_environments);

            Assert.IsTrue(genFCol.Count == 2);
        }
 private void RefreshEnvironments()
 {
     _settings = new EnvironmentSettingsCollection(_source);
     var envs = new EnvironmentCollection(_settings);
     _environments = new GenFormEnvironmentCollection(envs);
 }
        public void UseAEnvironmentsCollectionToGetTheGenFormEnvironments()
        {
            _source = new TestSource
                             {
                                 SettingFactory.CreateSecureSetting<ConnectionStringSettings>("TestMachine1.Env1.Database.Provider", "Test"),
                                 SettingFactory.CreateSecureSetting<ConnectionStringSettings>("TestMachine1.Env1.LogPath.Provider", "Test"),
                                 SettingFactory.CreateSecureSetting<ConnectionStringSettings>("TestMachine1.Env1.ExportPath.Provider", "Test"),
                                 SettingFactory.CreateSecureSetting<ConnectionStringSettings>("TestMachine1.Env2.Test4.Provider", "Test")
                             };
            _settings = new EnvironmentSettingsCollection(_source);
            _environments = new EnvironmentCollection(_settings);

            var genFCol = new GenFormEnvironmentCollection(_environments);

            Isolate.WhenCalled(() => _environments.GetEnumerator()).CallOriginal();
            Assert.IsTrue(genFCol.Any());
            Isolate.Verify.WasCalledWithAnyArguments(() => _environments.GetEnumerator());
        }
        public void HaveTwoGenFormEnvironmentsAsSpecifiedInTheTestSourceWithOtherSettings()
        {
            _source = new TestSource
                             {
                                 SettingFactory.CreateSecureSetting<ConnectionStringSettings>("[Secure]iCjhnFwaYyeSWXoL5FL7yw==",
                                             "MIwslAvaU0oJDYCnnjkaA58MCH0XsCxesdeCC1ENpFbgUgbs44XbzxjgOLRrtfou+M7jz2bFIw6PyKXNLXWzikIWkps6lrhYuvIffqCrotM="),
                                 SettingFactory.CreateSecureSetting<ConnectionStringSettings>("MyMachine.AcceptanceTest1.Database.SqLite",
                                             "MIwslAvaU0oJDYCnnjkaA58MCH0XsCxesdeCC1ENpFbgUgbs44XbzxjgOLRrtfou+M7jz2bFIw6PyKXNLXWzikIWkps6lrhYuvIffqCrotM="),
                                 SettingFactory.CreateSecureSetting<ConnectionStringSettings>("MyMachine.AcceptanceTest1.LogPath.FileSystem", "log path"),
                                 SettingFactory.CreateSecureSetting<ConnectionStringSettings>("MyMachine.AcceptanceTest1.ExportPath.FileSystem", "export path"),
                                 SettingFactory.CreateSecureSetting<ConnectionStringSettings>("MyMachine.AcceptanceTest2.Database.SqLite",
                                             "MIwslAvaU0oJDYCnnjkaA58MCH0XsCxesdeCC1ENpFbgUgbs44XbzxjgOLRrtfou+M7jz2bFIw6PyKXNLXWzikIWkps6lrhYuvIffqCrotM="),
                                 SettingFactory.CreateSecureSetting<ConnectionStringSettings>("MyMachine.AcceptanceTest2.LogPath.FileSystem", "log path"),
                                 SettingFactory.CreateSecureSetting<ConnectionStringSettings>("MyMachine.AcceptanceTest2.ExportPath.FileSystem", "export path")
                             };

            _settings = new EnvironmentSettingsCollection(_source);
            _environments = new EnvironmentCollection(_settings);

            Assert.AreEqual(2, _environments.Count, "There should be two environments");
            Assert.AreEqual(3, _environments.Single(e => e.Name == "AcceptanceTest1").Settings.Count(), "Environment AcceptanceTest1 should have 3 settings");
            Assert.AreEqual(3, _environments.Single(e => e.Name == "AcceptanceTest2").Settings.Count(), "Environment AcceptanceTest2 should have 3 settings");

            var genfCol = new GenFormEnvironmentCollection(_environments);

            Assert.AreEqual(2, genfCol.Count, "There should be only two GenForm environments");
        }