public void TestCollectionRetryAlways()
        {
            CertificateResolverCollection resolvers = new CertificateResolverCollection();

            resolvers.TryNextWhen = CertificateResolverCollection.TryNextCriteria.Always;

            resolvers.Add(new ThrowingCertResolver());
            resolvers.Add(m_resolver);

            Assert.DoesNotThrow(() => resolvers.GetCertificates(m_address));
            Assert.True(!resolvers.GetCertificates(m_address).IsNullOrEmpty());

            resolvers.Insert(0, new NullResolver());
            Assert.True(!resolvers.GetCertificates(m_address).IsNullOrEmpty());
        }
        public void TestCollectionRetryException()
        {
            CertificateResolverCollection resolvers = new CertificateResolverCollection();

            resolvers.TryNextWhen = CertificateResolverCollection.TryNextCriteria.Exception;

            resolvers.Add(new NullResolver());
            resolvers.Add(m_resolver);
            Assert.True(resolvers.GetCertificates(m_address).IsNullOrEmpty());

            resolvers.TryNextWhen = CertificateResolverCollection.TryNextCriteria.NotFound;
            Assert.True(!resolvers.GetCertificates(m_address).IsNullOrEmpty());

            resolvers.Clear();

            resolvers.Add(new ThrowingCertResolver());
            resolvers.Add(m_resolver);
            Assert.Throws <InvalidOperationException>(() => resolvers.GetCertificates(m_address));

            resolvers.TryNextWhen = CertificateResolverCollection.TryNextCriteria.Exception;
            Assert.True(!resolvers.GetCertificates(m_address).IsNullOrEmpty());
        }
Beispiel #3
0
        public void TestCollectionRetryAlways()
        {
            CertificateResolverCollection resolvers = new CertificateResolverCollection();
            resolvers.TryNextWhen = CertificateResolverCollection.TryNextCriteria.Always;
            
            resolvers.Add(new ThrowingCertResolver());
            resolvers.Add(m_resolver);

            Assert.DoesNotThrow(() => resolvers.GetCertificates(m_address));
            Assert.True(!resolvers.GetCertificates(m_address).IsNullOrEmpty());
            
            resolvers.Insert(0, new NullResolver());
            Assert.True(!resolvers.GetCertificates(m_address).IsNullOrEmpty());
        }
Beispiel #4
0
        public void TestCollectionRetryException()
        {
            CertificateResolverCollection resolvers = new CertificateResolverCollection();
            resolvers.TryNextWhen = CertificateResolverCollection.TryNextCriteria.Exception;
            
            resolvers.Add(new NullResolver());
            resolvers.Add(m_resolver);
            Assert.True(resolvers.GetCertificates(m_address).IsNullOrEmpty());
            
            resolvers.TryNextWhen = CertificateResolverCollection.TryNextCriteria.NotFound;
            Assert.True(!resolvers.GetCertificates(m_address).IsNullOrEmpty());
            
            resolvers.Clear();

            resolvers.Add(new ThrowingCertResolver());
            resolvers.Add(m_resolver);
            Assert.Throws<InvalidOperationException>(() => resolvers.GetCertificates(m_address));
            
            resolvers.TryNextWhen = CertificateResolverCollection.TryNextCriteria.Exception;
            Assert.True(!resolvers.GetCertificates(m_address).IsNullOrEmpty());
        }