public void XPPrompt_ShowDialog_Without_Target_ShouldThrowError()
        {
            XPPrompt prompt = new XPPrompt();

            Testing.ShouldThrowException <InvalidOperationException>(() => prompt.ShowDialog());
            prompt.Dispose();
        }
        public void XPPrompt_ShowDialog_ShouldNotThrowError()
        {
            XPPrompt prompt = GetDefaultPrompt();

            prompt.ShowDialog();
            prompt.Dispose();
        }
        public void XPPrompt_ShowDialog_WithParent_ShouldNotThrowError()
        {
            XPPrompt prompt = GetDefaultPrompt();

            prompt.ShowDialog(IntPtr.Zero);
            prompt.Dispose();
        }
Example #4
0
        private void  ShowWindowsCredentialDialog()
        {
            try
            {
                //if (Environment.OSVersion.Version.Major >= 6)
                //{
                XPPrompt xp = new XPPrompt();
                xp.AlwaysShowUI         = true;
                xp.CompleteUsername     = true;
                xp.DoNotPersist         = false;
                xp.ExpectConfirmation   = true;
                xp.GenericCredentials   = true;
                xp.Message              = "Enter the credentials for AMT";
                xp.RequestAdministrator = true;
                xp.ShowSaveCheckBox     = true;
                xp.Target           = "Sample";
                xp.ValidateUsername = true;

                xp.ShowDialog();
            }
            catch (Exception ex)
            {
                AMTLogger.WriteToLog(ex.Message, MethodBase.GetCurrentMethod().Name, 0, AMTLogger.LogInfo.Error);
            }
        }
        public void XPPrompt_ShowDialog_IncorrectPassword()
        {
            XPPrompt prompt = GetDefaultPrompt();

            prompt.IncorrectPassword = true;
            prompt.ShowDialog(IntPtr.Zero);
            prompt.Dispose();
        }
        public void XPPrompt_ShowDialog_UsernameReadOnly()
        {
            XPPrompt prompt = GetDefaultPrompt();

            prompt.UsernameReadOnly = true;
            prompt.ShowDialog(IntPtr.Zero);
            prompt.Dispose();
        }
        public void XPPrompt_ShowDialog_ValidateUsername()
        {
            XPPrompt prompt = GetDefaultPrompt();

            prompt.ValidateUsername = true;
            prompt.ShowDialog(IntPtr.Zero);
            prompt.Dispose();
        }
        public void XPPrompt_ShowDialog_RequreSmartCard()
        {
            XPPrompt prompt = GetDefaultPrompt();

            prompt.RequireSmartCard = true;
            prompt.ShowDialog(IntPtr.Zero);
            prompt.Dispose();
        }
        public void XPPrompt_ShowDialog_ShowSaveCheckBox()
        {
            XPPrompt prompt = GetDefaultPrompt();

            prompt.ShowSaveCheckBox = true;
            prompt.ShowDialog(IntPtr.Zero);
            prompt.Dispose();
        }
        public void XPPrompt_ShowDialog_RequestAdministrator()
        {
            XPPrompt prompt = GetDefaultPrompt();

            prompt.RequestAdministrator = true;
            prompt.ShowDialog(IntPtr.Zero);
            prompt.Dispose();
        }
        public void XPPrompt_ShowDialog_RequreCertificate()
        {
            XPPrompt prompt = GetDefaultPrompt();

            prompt.RequireCertificate = true;
            prompt.ShowDialog(IntPtr.Zero);
            prompt.Dispose();
        }
        public void XPPrompt_ShowDialog_GenericCredentials()
        {
            XPPrompt prompt = GetDefaultPrompt();

            prompt.GenericCredentials = true;
            prompt.ShowDialog(IntPtr.Zero).ShouldEqual(DialogResult.OK);
            prompt.Dispose();
        }
        public void XPPrompt_ShowDialog_Persist()
        {
            XPPrompt prompt = GetDefaultPrompt();

            prompt.Persist = true;
            prompt.ShowDialog(IntPtr.Zero);
            prompt.Dispose();
        }
        public void XPPrompt_ShowDialog_ExpectConfirmation()
        {
            XPPrompt prompt = GetDefaultPrompt();

            prompt.ExpectConfirmation = true;
            prompt.ShowDialog(IntPtr.Zero);
            prompt.Dispose();
        }
        public void XPPrompt_ShowDialog_ExcludeCertificates()
        {
            XPPrompt prompt = GetDefaultPrompt();

            prompt.ExcludeCertificates = true;
            prompt.ShowDialog(IntPtr.Zero);
            prompt.Dispose();
        }
        public void XPPrompt_ShowDialog_AlwaysShowUI_Without_GenericCredentials_ShouldThrowError()
        {
            XPPrompt prompt = GetDefaultPrompt();

            prompt.AlwaysShowUI = true;
            Testing.ShouldThrowException <InvalidOperationException>(() => prompt.ShowDialog(IntPtr.Zero));
            prompt.Dispose();
        }
        public void XPPrompt_ShowDialog_AlwaysShowUI()
        {
            XPPrompt prompt = GetDefaultPrompt();

            prompt.AlwaysShowUI       = true;
            prompt.GenericCredentials = true;
            prompt.ShowDialog(IntPtr.Zero);
            prompt.Dispose();
        }
        public void XPPrompt_ShowDialog_With_Username()
        {
            XPPrompt prompt = GetDefaultPrompt();

            prompt.Username           = "******";
            prompt.Title              = "Enter enter valid credentials.";
            prompt.Message            = "Please enter valid credentials.";
            prompt.ShowSaveCheckBox   = true;
            prompt.GenericCredentials = true;
            prompt.ShowDialog().ShouldEqual(DialogResult.OK);
            prompt.Dispose();
        }
Example #19
0
        private static WebLearnCredential PromptForCredential()
        {
            var prompt = new XPPrompt
            {
                Target  = Target,
                Persist = true
            };

            if (prompt.ShowDialog() != DialogResult.OK)
            {
                return(null);
            }

            var cred = CredentialTemplate();

            cred.Username = prompt.Username.Split(new[] { '\\' }, 2)[1];
            cred.Password = prompt.Password;

            cred.Save();
            return(Convert(cred));
        }
Example #20
0
 public void XPPrompt_ShowDialog_Without_Target_ShouldThrowError()
 {
     XPPrompt prompt = new XPPrompt();
     Testing.ShouldThrowException<InvalidOperationException>(() => prompt.ShowDialog());
     prompt.Dispose();
 }