public void SigningDataRegisterTest() { string password = ""; /// Check success Fail _signingData.Register("Test", _cskPassword); /// Check return value from remote call StringAssert.IsMatch("CSK file deleted.\n", _signingData.Messages, "Return value from command is not as expected. " + _signingData.Messages); /// Check return value for errors StringAssert.DoesNotMatch("", _signingData.Errors, "Errors have been regturned from remote call. " + _signingData.Errors); /// Check to see that the cert file was removed Assert.True(File.Exists(_signingData.CertPath + @"/author.p12"), "Certificate File is not present"); /// Check to see that the csk file was removed Assert.True(File.Exists(_signingData.CertPath + @"/bbidtoken.csk"), "CSK File is not present."); /// Get CSK Password RegistryKey rkHKCU = Registry.CurrentUser; RegistryKey rkCDKPass = null; rkCDKPass = rkHKCU.CreateSubKey("Software\\BlackBerry\\BlackBerryVSPlugin"); password = GlobalFunctions.Decrypt(rkCDKPass.GetValue("CSKPass").ToString()); StringAssert.IsMatch(_cskPassword, password, "Password is not a match " + _cskPassword + " != " + password); rkCDKPass.Close(); rkHKCU.Close(); }
/// <summary> /// Perform actions on the OK button click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOk_Click(object sender, RoutedEventArgs e) { if (!signingData.Register(tbAuthor.Text, tbPassword.Password)) { MessageBox.Show(signingData.Errors, "Registration Window", MessageBoxButton.OK, MessageBoxImage.Exclamation, MessageBoxResult.OK); signingData.Errors = null; e.Handled = true; return; } else if (!string.IsNullOrEmpty(signingData.Messages)) { signingData.Messages = signingData.Messages.Replace("CSK", "BB ID Token"); MessageBox.Show(signingData.Messages, "Registration Window", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK); signingData.Messages = null; } signingData.Register("", ""); DialogResult = true; }
public void TFTearDown() { /// Backup CSK File.. File.Copy(_signingData.CertPath + _certTmpName, _signingData.CertPath + _certName); /// Check success Fail _signingData.Register("Test Company", _cskPassword); /// Remove backup file File.Delete(_signingData.CertPath + _certTmpName); }