Exemplo n.º 1
0
        public void FormatValueFromDirectory_Null_ReturnsNull()
        {
            //prepare
            _mappingArguments.PropertyType = typeof(Collection <SecurityIdentifier>);
            var propertyMapping = new SecurityIdentifierCollectionPropertyMapping <SecurityIdentifierCollectionPropertyMappingTest>(_mappingArguments);

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

            //assert
            value.Should().Be.Null();
        }
Exemplo n.º 2
0
        public void FormatValueFromDirectory_SingleSecurityIdentifier_ReturnsAsSecurityIdentifierCollection()
        {
            //prepare
            _mappingArguments.PropertyType = typeof(Collection <SecurityIdentifier>);
            var propertyMapping = new SecurityIdentifierCollectionPropertyMapping <SecurityIdentifierCollectionPropertyMappingTest>(_mappingArguments);

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

            //assert
            value.As <Collection <SecurityIdentifier> >().Should().Contain(_identifier);
        }
Exemplo n.º 3
0
        public void FormatValueFromDirectory_SecurityIdentifierCollection_ReturnsSecurityIdentifierCollection()
        {
            //prepare
            _mappingArguments.PropertyType = typeof(Collection <SecurityIdentifier>);
            var identifiers     = new Collection <SecurityIdentifier>(new[] { _identifier, _identifier2 });
            var propertyMapping = new SecurityIdentifierCollectionPropertyMapping <SecurityIdentifierCollectionPropertyMappingTest>(_mappingArguments);

            //act
            var value = propertyMapping.FormatValueFromDirectory(new DirectoryAttribute("name", identifiers.Select(
                                                                                            x =>
            {
                var bytes = new byte[x.BinaryLength];
                x.GetBinaryForm(bytes, 0);
                return(bytes);
            }).ToArray()), "dn");

            //assert
            value.As <Collection <SecurityIdentifier> >().Should().Have.SameSequenceAs(identifiers);
        }