public void FormatValueFromDirectory_Null_ReturnsNull()
        {
            //prepare
            _mappingArguments.PropertyType = typeof(X509Certificate2[]);
            var propertyMapping = new X509Certificate2ArrayPropertyMapping <X509Certificate2ArrayPropertyMappingTest>(_mappingArguments);

            //act
            var value = propertyMapping.FormatValueFromDirectory(null, "dn");

            //assert
            value.Should().Be.Null();
        }
        public void FormatValueFromDirectory_X509CertificateArray_ReturnsX509CertificateArray()
        {
            //prepare
            _mappingArguments.PropertyType = typeof(X509Certificate[]);
            var certs           = new[] { new X509Certificate(Resources.ResourceHelper.GetAssemblyResource(@"Resources\cert.cer")), new X509Certificate(Resources.ResourceHelper.GetAssemblyResource(@"Resources\cert.cer")) };
            var propertyMapping = new X509Certificate2ArrayPropertyMapping <X509Certificate2ArrayPropertyMappingTest>(_mappingArguments);

            //act
            var value = propertyMapping.FormatValueFromDirectory(new DirectoryAttribute("name", certs.Select(c => c.GetRawCertData()).ToArray()), "dn");

            //assert
            value.As <X509Certificate[]>().Should().Have.SameSequenceAs(certs);
        }
        public void FormatValueFromDirectory_SingleX509Certificate_ReturnsAsX509Certificate2Array()
        {
            //prepare
            var certs = new X509Certificate(Resources.ResourceHelper.GetAssemblyResource(@"Resources\cert.cer"));

            _mappingArguments.PropertyType = typeof(X509Certificate[]);
            var propertyMapping = new X509Certificate2ArrayPropertyMapping <X509Certificate2ArrayPropertyMappingTest>(_mappingArguments);

            //act
            var value = propertyMapping.FormatValueFromDirectory(new DirectoryAttribute("name", certs.GetRawCertData()), "dn");

            //assert
            value.As <X509Certificate[]>().Should().Contain(certs);
        }