Ejemplo n.º 1
0
        public void when_a_password_has_already_been_provided_in_commandline_options_then_that_password_is_used()
        {
            var testDatabaseCommand = new TestDatabaseCommand(MockSecureConsole.Object);
            var password            = testDatabaseCommand.GetOraclePassword(new TestDatabaseCommandOptions {
                Password = "******"
            });

            MockSecureConsole.Verify(m => m.ReadLine(It.IsAny <char>()), Times.Never);
            Assert.That(password, Is.EqualTo("provided password"));
        }
Ejemplo n.º 2
0
        public void when_no_password_provided_in_commandline_options_then_it_is_read_from_the_secure_console()
        {
            MockSecureConsole.Setup(m => m.ReadLine(It.IsAny <char>())).Returns("some password");

            var testDatabaseCommand = new TestDatabaseCommand(MockSecureConsole.Object);
            var password            = testDatabaseCommand.GetOraclePassword(new TestDatabaseCommandOptions());

            MockSecureConsole.Verify(m => m.ReadLine(It.IsAny <char>()), Times.Once);
            Assert.That(password, Is.EqualTo("some password"));
        }