public void FormatValueFromDirectory_Null_ReturnsNull() { //prepare _mappingArguments.PropertyType = typeof(Collection <X509Certificate2>); var propertyMapping = new X509Certificate2CollectionPropertyMapping <X509Certificate2CollectionPropertyMappingTest>(_mappingArguments); //act var value = propertyMapping.FormatValueFromDirectory(null, "dn"); //assert value.Should().Be.Null(); }
public void FormatValueFromDirectory_X509Certificate2Collection_ReturnsX509Certificate2Collection() { //prepare _mappingArguments.PropertyType = typeof(Collection <X509Certificate2>); var certs = new Collection <X509Certificate2>(new[] { new X509Certificate2(Resources.cert), new X509Certificate2(Resources.cert) }); var propertyMapping = new X509Certificate2CollectionPropertyMapping <X509Certificate2CollectionPropertyMappingTest>(_mappingArguments); //act var value = propertyMapping.FormatValueFromDirectory(new DirectoryAttribute("name", certs.Select(c => c.GetRawCertData()).ToArray()), "dn"); //assert value.As <Collection <X509Certificate2> >().Should().Have.SameSequenceAs(certs); }
public void FormatValueFromDirectory_SingleX509Certificate_ReturnsAsX509Certificate2Collection() { //prepare var certs = new X509Certificate(Resources.cert); _mappingArguments.PropertyType = typeof(Collection <X509Certificate>); var propertyMapping = new X509Certificate2CollectionPropertyMapping <X509Certificate2CollectionPropertyMappingTest>(_mappingArguments); //act var value = propertyMapping.FormatValueFromDirectory(new DirectoryAttribute("name", certs.GetRawCertData()), "dn"); //assert value.As <Collection <X509Certificate> >().Should().Contain(certs); }