public void TestGetHashCode() { Uri uri = new Uri("https://test.vault.azure.net/keys/test-name/test-version"); KeyVaultCertificateIdentifier keyId = new KeyVaultCertificateIdentifier(uri); Assert.AreEqual(uri.GetHashCode(), keyId.GetHashCode()); }
public void NotEquals() { KeyVaultCertificateIdentifier a = new KeyVaultCertificateIdentifier(new Uri("https://test.vault.azure.net/deletedcertificates/test-name/test-version?api-version=7.0")); KeyVaultCertificateIdentifier b = new KeyVaultCertificateIdentifier(new Uri("https://test.vault.azure.net/deletedcertificates/test-name/test-version?api-version=7.1")); Assert.AreNotEqual(a, b); }
public bool TryCreate(Uri id, Uri vaultUri, string name, string version) { bool result = KeyVaultCertificateIdentifier.TryCreate(id, out KeyVaultCertificateIdentifier identifier); if (result) { Assert.AreEqual(id, identifier.SourceId); Assert.AreEqual(vaultUri, identifier.VaultUri); Assert.AreEqual(name, identifier.Name); Assert.AreEqual(version, identifier.Version); } return(result); }
public bool TryParse(Uri id, Uri vaultUri, string name, string version) { if (KeyVaultCertificateIdentifier.TryParse(id, out KeyVaultCertificateIdentifier identifier)) { Assert.AreEqual(id, identifier.SourceId); Assert.AreEqual(vaultUri, identifier.VaultUri); Assert.AreEqual(name, identifier.Name); Assert.AreEqual(version, identifier.Version); return(true); } return(false); }
public bool Parse(Uri id, Uri vaultUri, string name, string version) { try { KeyVaultCertificateIdentifier identifier = new KeyVaultCertificateIdentifier(id); Assert.AreEqual(id, identifier.SourceId); Assert.AreEqual(vaultUri, identifier.VaultUri); Assert.AreEqual(name, identifier.Name); Assert.AreEqual(version, identifier.Version); return(true); } catch (ArgumentException ex) when(ex.ParamName == "id") { return(false); } }
public void TryCreateFromNull() { Assert.IsFalse(KeyVaultCertificateIdentifier.TryCreate(null, out KeyVaultCertificateIdentifier identifier)); Assert.That(() => default(KeyVaultCertificateIdentifier).Equals(identifier)); }