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 SetUpGenFormEnvironments() { _source = new TestSource(); _settings = new EnvironmentSettingsCollection(_source); _environments = new EnvironmentCollection(_settings); _genFormEnvironments = new GenFormEnvironmentCollection(_environments); }
private EnvironmentSettingsCollection GetIsolatedEnvironmentSettingsCollection() { SecureSettingSource = new TestSource(); _setting = Isolate.Fake.Instance <ISetting>(); Isolate.WhenCalled(() => SecureSettingSource.Add(_setting)).CallOriginal(); var col = new EnvironmentSettingsCollection(SecureSettingSource); return(col); }
public void TurnTheSettingNameInMachineEnvironmentNameAndProvider() { var source = new TestSource(); var settingname = "TestMachine.TestEnvironment.Test.MyProvider"; source.Add(SettingFactory.CreateSecureSetting(new ConnectionStringSettings(settingname, string.Empty))); var col = new EnvironmentSettingsCollection(source); Assert.AreEqual("MyProvider", col.Single(s => s.Name == "Test").Provider); }
public void ContainOneEnvironmnentAsSpecifiedInTheTestSource() { _source = new TestSource { SettingFactory.CreateSecureSetting <ConnectionStringSettings>("TestMachine1.Env1.Test1.Provider", "Test"), SettingFactory.CreateSecureSetting <ConnectionStringSettings>("TestMachine1.Env1.Test2.Provider", "Test"), SettingFactory.CreateSecureSetting <ConnectionStringSettings>("TestMachine1.Env1.Test3.Provider", "Test"), SettingFactory.CreateSecureSetting <ConnectionStringSettings>("TestMachine1.Env1.Test4.Provider", "Test") }; _settings = new EnvironmentSettingsCollection(_source); var col = new EnvironmentCollection(_settings); Assert.AreEqual(1, col.Count); }
public void ContainOneEnvironmnentAsSpecifiedInTheTestSource() { _source = new TestSource { SettingFactory.CreateSecureSetting<ConnectionStringSettings>("TestMachine1.Env1.Test1.Provider", "Test"), SettingFactory.CreateSecureSetting<ConnectionStringSettings>("TestMachine1.Env1.Test2.Provider", "Test"), SettingFactory.CreateSecureSetting<ConnectionStringSettings>("TestMachine1.Env1.Test3.Provider", "Test"), SettingFactory.CreateSecureSetting<ConnectionStringSettings>("TestMachine1.Env1.Test4.Provider", "Test") }; _settings = new EnvironmentSettingsCollection(_source); var col = new EnvironmentCollection(_settings); Assert.AreEqual(1, col.Count); }
public void UseEnvironmentSettingsToAdAnEnvironment() { var env = new Environment("Test", "Test"); env.AddSetting("Test", "Test"); _source = new TestSource(); _settings = new EnvironmentSettingsCollection(_source); var col = new EnvironmentCollection(_settings); Isolate.WhenCalled(() => _settings.Add(null)).IgnoreCall(); col.Add(env); Isolate.Verify.WasCalledWithAnyArguments(() => _settings.Add(null)); }
public void ContainFourEnvironmnentsForTestMachine1AsSpecifiedInTheUnsortedTestSource() { _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.Env1.Test2.Provider", "Test") }; _settings = new EnvironmentSettingsCollection(_source); var col = new EnvironmentCollection(_settings); Assert.AreEqual(4, col.Count()); }
public void ContainFourEnvironmnentsForTestMachine1AsSpecifiedInTheUnsortedTestSource() { _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.Env1.Test2.Provider", "Test") }; _settings = new EnvironmentSettingsCollection(_source); var col = new EnvironmentCollection(_settings); Assert.AreEqual(4, col.Count()); }
public void UseAnEnvironmentSettingsToEnumerateThroughEnvironments() { _source = new TestSource(); _settings = new EnvironmentSettingsCollection(_source); var col = new EnvironmentCollection(_settings); try { Isolate.WhenCalled(() => _settings.GetEnumerator()).CallOriginal(); Assert.IsFalse(col.Any(s => s.Name == "TestEnvironment")); Isolate.Verify.WasCalledWithAnyArguments(() => _settings.GetEnumerator()); } catch (Exception e) { Assert.Fail(e.ToString()); } }
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()); }
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 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 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()); }
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)); }
public EnvironmentSettingsCollection GetIsolatedEnvironmentSettingsCollectionWithSettings() { SecureSettingSource = new TestSource(); SecureSettingSource.Add(SettingFactory.CreateSecureSetting <ConnectionStringSettings>("MyMachine.TestEnvironment.Database.SqlProvider", "Connection string to database")); //SettingSource.Add(new Setting("MyMachine.TestEnvironment.Database.SqlProvider", "Connection string to database", "Conn", false)); //SettingSource.Add(new Setting("MyMachine.TestEnvironment.LogPath.FileSystem", "Path to logp", "Conn", false)); //SettingSource.Add(new Setting("MyMachine.TestEnvironment.ExportPath.FileSystem", "Path to export", "Conn", false)); //SettingSource.Add(new Setting("OtherMachine.OtherEnvironment.Database.SqlProvider", "Connection string to database", "Conn", false)); //SettingSource.Add(new Setting("OtherMachine.OtherEnvironment.LogPath.FileSystem", "Path to logp", "Conn", false)); //SettingSource.Add(new Setting("OtherMachine.OtherEnvironment.ExportPath.FileSystem", "Path to export", "Conn", false)); KeyManager = Isolate.Fake.Instance <SecretKeyManager>(); Isolate.WhenCalled(() => KeyManager.GetKey()).WillReturn("secretkey"); CryptoGraphy = new CryptographyAdapter(new SymCryptography()); var col = new EnvironmentSettingsCollection(SecureSettingSource); return(col); }
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); }
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 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()); }