public static void Format_WithEnumPropertyProducesIntWhenMappingSpecifiesIntFormat()
        {
            var mapping = new ElasticMapping(enumFormat: EnumFormat.Integer);
            var memberInfo = TypeHelper.GetMemberInfo((FormatClass f) => f.DayProperty);

            var actual = mapping.FormatValue(memberInfo, (int)Day.Saturday);

            Assert.Equal((int)Day.Saturday, actual);
        }
        public static void FormatValue(bool lowerCaseAnalyzedFieldValues, string propertyName, object inputValue, string expected)
        {
            var memberInfo = typeof(FormatClass).GetProperty(propertyName);
            var mapping = new ElasticMapping(lowerCaseAnalyzedFieldValues: lowerCaseAnalyzedFieldValues);

            var result = mapping.FormatValue(memberInfo, inputValue);

            Assert.Equal(expected, result.ToString(Formatting.None));
        }
        public static void Format_WithEnumPropertyThrowsArgumentOutOfRangeWithUndefinedEnum()
        {
            var mapping = new ElasticMapping(enumFormat: EnumFormat.String);
            var memberInfo = TypeHelper.GetMemberInfo((FormatClass f) => f.DayProperty);

            Assert.Throws<ArgumentOutOfRangeException>(() => mapping.FormatValue(memberInfo, 127));
        }
        public static void FormatValue_GuardClause()
        {
            var mapping = new ElasticMapping();

            Assert.Throws<ArgumentNullException>(() => mapping.FormatValue(null, "value"));
        }