예제 #1
0
        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());
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #5
0
        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);
            }
        }
예제 #6
0
 public void TryCreateFromNull()
 {
     Assert.IsFalse(KeyVaultCertificateIdentifier.TryCreate(null, out KeyVaultCertificateIdentifier identifier));
     Assert.That(() => default(KeyVaultCertificateIdentifier).Equals(identifier));
 }