A convention that uses the names of the creator parameters to find the matching members.
Inheritance: ConventionBase, ICreatorMapConvention
        public void Apply_should_set_arguments_when_constructor_parameter_names_match_a_field()
        {
            var subject = new NamedParameterCreatorMapConvention();
            var classMap = new BsonClassMap<C>();
            var constructorInfo = typeof(C).GetTypeInfo().GetConstructor(new[] { typeof(long) });
            var creatorMap = classMap.MapConstructor(constructorInfo);
            creatorMap.Arguments.Should().BeNull();

            subject.Apply(creatorMap);

            creatorMap.Arguments.Cast<FieldInfo>().Select(p => p.Name).Should().Equal(new[] { "F" });
        }
        public void Apply_should_do_nothing_when_constructor_parameter_name_does_not_match_any_property_or_field()
        {
            var subject = new NamedParameterCreatorMapConvention();
            var classMap = new BsonClassMap<C>();
            var constructorInfo = typeof(C).GetTypeInfo().GetConstructor(new[] { typeof(int) });
            var creatorMap = classMap.MapConstructor(constructorInfo);
            creatorMap.Arguments.Should().BeNull();

            subject.Apply(creatorMap);

            creatorMap.Arguments.Should().BeNull();
        }
        public void Apply_should_do_nothing_when_creator_map_already_has_arguments_configured()
        {
            var subject = new NamedParameterCreatorMapConvention();
            var classMap = new BsonClassMap<C>();
            var constructorInfo = typeof(C).GetTypeInfo().GetConstructor(new[] { typeof(int) });
            var creatorMap = classMap.MapConstructor(constructorInfo, "Y");
            var originalArguments = creatorMap.Arguments;

            subject.Apply(creatorMap);

            creatorMap.Arguments.Should().BeSameAs(originalArguments);
        }
        public void Apply_should_do_nothing_when_member_info_is_null()
        {
            var subject = new NamedParameterCreatorMapConvention();
            var classMap = new BsonClassMap<C>();
            var @delegate = (Func<int, C>)(y => new C(y));
            var creatorMap = classMap.MapCreator(@delegate);
            creatorMap.Arguments.Should().BeNull();
            creatorMap.MemberInfo.Should().BeNull();

            subject.Apply(creatorMap);

            creatorMap.Arguments.Should().BeNull();
        }