public void ByThumbprint_NoneMatching_ReturnsNull()
        {
            Mock<IX509Store> storeMock = new Mock<IX509Store>();
            IX509Certificate2Collection collectionFake = new X509Certificate2CollectionFake { new X509Certificate2Fake() };
            storeMock.Setup(mock => mock.Certificates).Returns(collectionFake);

            Certificate result = new CertificateLookup("FindMe", new[] { StoreName.My }, name => storeMock.Object)
                .ByThumbprint();

            Assert.Null(result);
        }
        public void ByThumbprint_NoneMatching_ReturnsNull()
        {
            Mock <IX509Store>           storeMock      = new Mock <IX509Store>();
            IX509Certificate2Collection collectionFake = new X509Certificate2CollectionFake {
                new X509Certificate2Fake()
            };

            storeMock.Setup(mock => mock.Certificates).Returns(collectionFake);

            Certificate result = new CertificateLookup("FindMe", new[] { StoreName.My }, name => storeMock.Object)
                                 .ByThumbprint();

            Assert.Null(result);
        }
        public void ByThumbprint_OneMatching_ReturnsCertificate()
        {
            Mock<IX509Store> storeMock = new Mock<IX509Store>();
            IX509Certificate2Collection collectionFake = new X509Certificate2CollectionFake
            {
                new X509Certificate2Fake(),
                new X509Certificate2Fake(),
                new X509Certificate2Fake(friendlyName: "FindMe", thumbprint: "FindMe")
            };
            storeMock.Setup(mock => mock.Certificates).Returns(collectionFake);
            
            Certificate result = new CertificateLookup("FindMe", new[] { StoreName.My }, name => storeMock.Object)
                .ByThumbprint();

            Assert.Equal(result.FriendlyName, "FindMe");
            Assert.Equal(result.Thumbprint, "FindMe");
        }
        public void ByThumbprint_OneMatching_ReturnsCertificate()
        {
            Mock <IX509Store>           storeMock      = new Mock <IX509Store>();
            IX509Certificate2Collection collectionFake = new X509Certificate2CollectionFake
            {
                new X509Certificate2Fake(),
                new X509Certificate2Fake(),
                new X509Certificate2Fake(friendlyName: "FindMe", thumbprint: "FindMe")
            };

            storeMock.Setup(mock => mock.Certificates).Returns(collectionFake);

            Certificate result = new CertificateLookup("FindMe", new[] { StoreName.My }, name => storeMock.Object)
                                 .ByThumbprint();

            Assert.Equal(result.FriendlyName, "FindMe");
            Assert.Equal(result.Thumbprint, "FindMe");
        }