示例#1
0
        public virtual void TestPromptForCredentialWithEmptyPasswd()
        {
            string[]       args1     = new string[] { "create", "credential1", "-provider", jceksProvider };
            AList <string> passwords = new AList <string>();

            passwords.AddItem(null);
            passwords.AddItem("p@ssw0rd");
            int             rc    = 0;
            CredentialShell shell = new CredentialShell();

            shell.SetConf(new Configuration());
            shell.SetPasswordReader(new TestCredShell.MockPasswordReader(this, passwords));
            rc = shell.Run(args1);
            Assert.Equal(outContent.ToString(), 1, rc);
            Assert.True(outContent.ToString().Contains("Passwords don't match"
                                                       ));
        }
示例#2
0
        public virtual void TestPromptForCredential()
        {
            string[]       args1     = new string[] { "create", "credential1", "-provider", jceksProvider };
            AList <string> passwords = new AList <string>();

            passwords.AddItem("p@ssw0rd");
            passwords.AddItem("p@ssw0rd");
            int             rc    = 0;
            CredentialShell shell = new CredentialShell();

            shell.SetConf(new Configuration());
            shell.SetPasswordReader(new TestCredShell.MockPasswordReader(this, passwords));
            rc = shell.Run(args1);
            Assert.Equal(0, rc);
            Assert.True(outContent.ToString().Contains("credential1 has been successfully "
                                                       + "created."));
            string[] args2 = new string[] { "delete", "credential1", "-f", "-provider", jceksProvider };
            rc = shell.Run(args2);
            Assert.Equal(0, rc);
            Assert.True(outContent.ToString().Contains("credential1 has been successfully "
                                                       + "deleted."));
        }