Пример #1
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");
        }
        public void ContainThreeEnvironmnentSettingsForTestMachine1AndEnv2AsSpecifiedInTheUnsortedTestSource()
        {
            _source = new TestSource
            {
                SettingFactory.CreateSecureSetting <ConnectionStringSettings>("TestMachine1.Env1.Test1.Provider", "Test"),
                SettingFactory.CreateSecureSetting <ConnectionStringSettings>("TestMachine1.Env2.Test1.Provider", "Test"),
                SettingFactory.CreateSecureSetting <ConnectionStringSettings>("TestMachine2.Env1.Test1.Provider", "Test"),
                SettingFactory.CreateSecureSetting <ConnectionStringSettings>("TestMachine2.Env2.Test2.Provider", "Test"),
                SettingFactory.CreateSecureSetting <ConnectionStringSettings>("TestMachine1.Env2.Test2.Provider", "Test"),
                SettingFactory.CreateSecureSetting <ConnectionStringSettings>("TestMachine1.Env2.Test3.Provider", "Test"),
                SettingFactory.CreateSecureSetting <ConnectionStringSettings>("TestMachine1.Env1.Test2.Provider", "Test")
            };

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

            Assert.AreEqual(3, col.Single(e => e.MachineName == "TestMachine1" && e.Name == "Env2").Settings.Count());
        }
        public void ContainThreeEnvironmnentSettingsForTestMachine1AndEnv2AsSpecifiedInTheUnsortedTestSource()
        {
            _source = new TestSource
                             {
                                 SettingFactory.CreateSecureSetting<ConnectionStringSettings>("TestMachine1.Env1.Test1.Provider", "Test"),
                                 SettingFactory.CreateSecureSetting<ConnectionStringSettings>("TestMachine1.Env2.Test1.Provider", "Test"),
                                 SettingFactory.CreateSecureSetting<ConnectionStringSettings>("TestMachine2.Env1.Test1.Provider", "Test"),
                                 SettingFactory.CreateSecureSetting<ConnectionStringSettings>("TestMachine2.Env2.Test2.Provider", "Test"),
                                 SettingFactory.CreateSecureSetting<ConnectionStringSettings>("TestMachine1.Env2.Test2.Provider", "Test"),
                                 SettingFactory.CreateSecureSetting<ConnectionStringSettings>("TestMachine1.Env2.Test3.Provider", "Test"),
                                 SettingFactory.CreateSecureSetting<ConnectionStringSettings>("TestMachine1.Env1.Test2.Provider", "Test")
                             };

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

            Assert.AreEqual(3, col.Single(e => e.MachineName == "TestMachine1" && e.Name == "Env2").Settings.Count());
        }
        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");
        }