예제 #1
0
        public void EnumValueIsSerializedAsString(string encodingWebName)
        {
            var encoding = Encoding.GetEncoding(encodingWebName);

            // arrange
            serializer.SpecifyEncoding(encoding);
            serializer.SerializeEnumAsStrings(true);

            // act
            var message = serializer.Serialize(new Message {
                Messages = new[] { new SomeMessageWithEnums {
                                       SomeEnum = SomeEnumValue.IAmTheValueTwo
                                   } }
            });

            // assert
            encoding.GetString(message.Body).ShouldContain(SomeEnumValue.IAmTheValueTwo.ToString());
        }
예제 #2
0
 /// <summary>
 /// Configure the serializer to serialize the enums as string.
 /// </summary>
 public JsonSerializationOptions SerializeEnumAsStrings(bool camelCaseText)
 {
     jsonMessageSerializer.SerializeEnumAsStrings(camelCaseText);
     return(this);
 }