public void GetEncryptionCertificateFromStore(StoreLocation location) { X509Store store = new X509Store(StoreName.My, location, OpenFlags.ReadOnly); foreach (var cert in store.Certificates) { Assert.AreEqual(cert, provider.FindEncryptionCertificate(cert.Thumbprint)); } Assert.Throws <CertificateNotFoundException>(() => provider.FindEncryptionCertificate("ABCDE")); }