public void ShouldNotOverrideCommandLineArgWithValueFromConfigFile() { const string passwordPassedInOnCommandLine = "password0"; const string passwordDefinedInConfigFile = "password1"; WriteConfigFile(null, null, null, passwordDefinedInConfigFile); var log = Substitute.For<ILog>(); var commandLineArgsProvider = new CommandLineArgsProvider(new List<string> { "--pass="******"--configFile=" + configFile }); var octopusSessionFactory = new TestableOctopusSessionFactory(log, commandLineArgsProvider); Assert.AreEqual(octopusSessionFactory.GetPassword(), passwordPassedInOnCommandLine); }
public void ShouldNotOverrideCommandLineArgWithValueFromConfigFile() { const string passwordPassedInOnCommandLine = "password0"; const string passwordDefinedInConfigFile = "password1"; WriteConfigFile(null, null, null, passwordDefinedInConfigFile); var log = Substitute.For <ILog>(); var commandLineArgsProvider = new CommandLineArgsProvider(new List <string> { "--pass="******"--configFile=" + configFile }); var octopusSessionFactory = new TestableOctopusSessionFactory(log, commandLineArgsProvider); Assert.AreEqual(octopusSessionFactory.GetPassword(), passwordPassedInOnCommandLine); }
public void ShouldAssignValuesFromConfigFileForValuesNotSpecifiedInCommandLineArgs() { const string serverUrlDefinedInConfigFile = "http://octopusServer"; const string apiKeyDefinedInConfigFile = "ABCDE0123FG"; const string usernameDefinedInConfigFile = "username"; const string passwordDefinedInConfigFile = "password"; WriteConfigFile(serverUrlDefinedInConfigFile, apiKeyDefinedInConfigFile, usernameDefinedInConfigFile, passwordDefinedInConfigFile); var log = Substitute.For<ILog>(); var commandLineArgsProvider = new CommandLineArgsProvider(new List<string> { "--configFile=" + configFile }); var octopusSessionFactory = new TestableOctopusSessionFactory(log, commandLineArgsProvider); Assert.AreEqual(octopusSessionFactory.GetServerUrl(), serverUrlDefinedInConfigFile); Assert.AreEqual(octopusSessionFactory.GetApiKey(), apiKeyDefinedInConfigFile); Assert.AreEqual(octopusSessionFactory.GetUser(), usernameDefinedInConfigFile); Assert.AreEqual(octopusSessionFactory.GetPassword(), passwordDefinedInConfigFile); }
public void ShouldAssignValuesFromConfigFileForValuesNotSpecifiedInCommandLineArgs() { const string serverUrlDefinedInConfigFile = "http://octopusServer"; const string apiKeyDefinedInConfigFile = "ABCDE0123FG"; const string usernameDefinedInConfigFile = "username"; const string passwordDefinedInConfigFile = "password"; WriteConfigFile(serverUrlDefinedInConfigFile, apiKeyDefinedInConfigFile, usernameDefinedInConfigFile, passwordDefinedInConfigFile); var log = Substitute.For <ILog>(); var commandLineArgsProvider = new CommandLineArgsProvider(new List <string> { "--configFile=" + configFile }); var octopusSessionFactory = new TestableOctopusSessionFactory(log, commandLineArgsProvider); Assert.AreEqual(octopusSessionFactory.GetServerUrl(), serverUrlDefinedInConfigFile); Assert.AreEqual(octopusSessionFactory.GetApiKey(), apiKeyDefinedInConfigFile); Assert.AreEqual(octopusSessionFactory.GetUser(), usernameDefinedInConfigFile); Assert.AreEqual(octopusSessionFactory.GetPassword(), passwordDefinedInConfigFile); }