public void testInjectRefereneValue_extendedKeyUsageDoesNotExist_required_assertException()
 {
     var cert = new X509Certificate2(@"resources/certs/altNameOnly.der");
     var field = new ExtendedKeyUsageExtensionField(true);
     Action action = () => field.InjectReferenceValue(cert);
     action.ShouldThrow<PolicyRequiredException>();
 }
 public void testInjectRefereneValue_extendedKeyUsageDoesNotExist_notRequired_assertValueEmpty()
 {
     var cert = new X509Certificate2(@"resources/certs/altNameOnly.der");
     var field = new ExtendedKeyUsageExtensionField(false);
     field.InjectReferenceValue(cert);
     field.GetPolicyValue().GetPolicyValue().Should().BeEmpty();
 }
 public void TestIsCritical_ExtensionNotPresent_AssertFalse()
 {
     var cert = new X509Certificate2(@"resources/certs/umesh.der");
     cert.GetCriticalExtensionOIDs().Should().NotContain(ExtensionIdentifier.ExtKeyUsageSyntax.Id);
     var field = new ExtendedKeyUsageExtensionField(false);
     field.InjectReferenceValue(cert);
     field.IsCritical().Should().BeFalse();
 }
        public void testInjectRefereneValue_extendedKeyUsageDoesNotExist_required_assertException()
        {
            var    cert   = new X509Certificate2(@"resources/certs/altNameOnly.der");
            var    field  = new ExtendedKeyUsageExtensionField(true);
            Action action = () => field.InjectReferenceValue(cert);

            action.ShouldThrow <PolicyRequiredException>();
        }
        public void testInjectRefereneValue_extendedKeyUsageDoesNotExist_notRequired_assertValueEmpty()
        {
            var cert  = new X509Certificate2(@"resources/certs/altNameOnly.der");
            var field = new ExtendedKeyUsageExtensionField(false);

            field.InjectReferenceValue(cert);
            field.GetPolicyValue().GetPolicyValue().Should().BeEmpty();
        }
        public void TestIsCritical_ExtensionNotPresent_AssertFalse()
        {
            var cert = new X509Certificate2(@"resources/certs/umesh.der");

            cert.GetCriticalExtensionOIDs().Should().NotContain(ExtensionIdentifier.ExtKeyUsageSyntax.Id);
            var field = new ExtendedKeyUsageExtensionField(false);

            field.InjectReferenceValue(cert);
            field.IsCritical().Should().BeFalse();
        }
        public void testInjectRefereneValue_keyUsageExists_assertValue()
        {

            var cert = new X509Certificate2(@"resources/certs/mshost.der");
            var field = new ExtendedKeyUsageExtensionField(false);
            field.InjectReferenceValue(cert);
            field.GetPolicyValue().GetPolicyValue().Should().NotBeEmpty();

            IList<String> usages = field.GetPolicyValue().GetPolicyValue();
            usages.Should().Contain(ExtendedKeyUsageStandard.IdKpEmailProtection);
            usages.Should().NotContain(ExtendedKeyUsageStandard.IdKpClientAuth);
        }
        public void testInjectRefereneValue_keyUsageExists_assertValue()
        {
            var cert  = new X509Certificate2(@"resources/certs/mshost.der");
            var field = new ExtendedKeyUsageExtensionField(false);

            field.InjectReferenceValue(cert);
            field.GetPolicyValue().GetPolicyValue().Should().NotBeEmpty();

            IList <String> usages = field.GetPolicyValue().GetPolicyValue();

            usages.Should().Contain(ExtendedKeyUsageStandard.IdKpEmailProtection);
            usages.Should().NotContain(ExtendedKeyUsageStandard.IdKpClientAuth);
        }