コード例 #1
0
        public void FormatValueFromDirectory_Null_ReturnsNull()
        {
            //prepare
            _mappingArguments.PropertyType = typeof(Collection <byte[]>);
            var propertyMapping = new ByteArrayCollectionPropertyMapping <ByteArrayCollectionPropertyMappingTest>(_mappingArguments);

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

            //assert
            value.Should().Be.Null();
        }
コード例 #2
0
        public void FormatValueFromDirectory_ByteArrayArray_ReturnsByteArrayCollection()
        {
            //prepare
            var bytes           = new[] { new byte[] { 1, 2 }, new byte[] { 3, 4 } };
            var propertyMapping = new ByteArrayCollectionPropertyMapping <ByteArrayCollectionPropertyMappingTest>(_mappingArguments);

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

            //assert
            value.As <Collection <byte[]> >().Should().Have.SameSequenceAs(bytes);
        }
コード例 #3
0
        public void FormatValueFromDirectory_SingleByteArray_ReturnsAsByteArrayCollection()
        {
            //prepare
            var bytes = new byte[] { 1, 2, 3, 4 };

            _mappingArguments.PropertyType = typeof(Collection <byte[]>);
            var propertyMapping = new ByteArrayCollectionPropertyMapping <ByteArrayCollectionPropertyMappingTest>(_mappingArguments);

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

            //assert
            value.As <Collection <byte[]> >().Should().Contain(bytes);
        }