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);
        }
 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 testInjectRefereneValue_noInjection_getPolicyValue_assertException()
        {
            var    field  = new ExtendedKeyUsageExtensionField(true);
            Action action = () => field.GetPolicyValue();

            action.ShouldThrow <InvalidOperationException>();
        }
        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 testInjectRefereneValue_noInjection_getPolicyValue_assertException()
 {
     var field = new ExtendedKeyUsageExtensionField(true);
     Action action = () => field.GetPolicyValue();
     action.ShouldThrow<InvalidOperationException>();
 }