public static void GetFieldName(bool camelCaseFieldNames, string prefix, string expected)
        {
            var memberInfo = MethodBase.GetCurrentMethod();
            var mapping = new ElasticMapping(camelCaseFieldNames: camelCaseFieldNames);

            var actual = mapping.GetFieldName(prefix, memberInfo);

            Assert.Equal(expected, actual);
        }
        public static void GetFieldName_HonorsJsonPropertyName()
        {
            var memberInfo = TypeHelper.GetMemberInfo((FormatClass f) => f.NotSoCustom);
            var mapping = new ElasticMapping();

            var actual = mapping.GetFieldName("", memberInfo);

            Assert.Equal("CustomPropertyName", actual);
        }
        public static void GetFieldName_GuardClause()
        {
            var mapping = new ElasticMapping();

            Assert.Throws<ArgumentNullException>(() => mapping.GetFieldName("", (MemberExpression)null));
            Assert.Throws<NotSupportedException>(() => mapping.GetFieldName("", Expression.Field(Expression.Constant(new FieldClass { AField = "test" }), "AField")));
            Assert.Throws<ArgumentNullException>(() => mapping.GetFieldName("", (MemberInfo)null));
        }
        [ExcludeFromCodeCoverage] // Expression isn't "executed"
        public static void GetFieldName_GuardClause()
        {
            var mapping = new ElasticMapping();

            Assert.Throws<ArgumentNullException>(() => mapping.GetFieldName("", null));
        }
        public static void GetFieldName_Correctly_Cases_Property_Name(bool camelCaseFieldNames, string expected)
        {
            Expression<Func<Sample, string>> stringAccess = (Sample s) => s.StringProperty;
            var mapping = new ElasticMapping(camelCaseFieldNames: camelCaseFieldNames);

            var actual = mapping.GetFieldName(typeof(Sample), (MemberExpression) stringAccess.Body);

            Assert.Equal(expected, actual);
        }