Exemplo n.º 1
0
        public static void Serializer_serializes_camel_cased_enumerations()
        {
            var value = new CamelCasedEnumTest()
            {
                Value = TestEnum.FirstOption,
            };

            var result = new NaosJsonSerializer(unregisteredTypeEncounteredStrategy: UnregisteredTypeEncounteredStrategy.Attempt).SerializeToString(value);

            var serializedValue = "{" + Environment.NewLine +
                                  "  \"value\": \"firstOption\"" + Environment.NewLine +
                                  "}";

            result.Should().Be(serializedValue);
        }
Exemplo n.º 2
0
        public static void Serializer_serializes_camel_cased_enumerations()
        {
            var value = new CamelCasedEnumTest()
            {
                Value = TestEnum.FirstOption,
            };

            var result = new ObcJsonSerializer().SerializeToString(value);

            var serializedValue = "{" + Environment.NewLine +
                                  "  \"value\": \"firstOption\"" + Environment.NewLine +
                                  "}";

            result.Should().Be(serializedValue);
        }
Exemplo n.º 3
0
        public void Serializer_serializes_camel_cased_enumerations()
        {
            var value = new CamelCasedEnumTest()
            {
                Value = TestEnum.FirstOption
            };

            var result = JsonConvert.SerializeObject(value, JsonConfiguration.DefaultSerializerSettings);

            var serializedValue = "{" + Environment.NewLine +
                                  "  \"value\": \"firstOption\"" + Environment.NewLine +
                                  "}";

            Assert.That(result, Is.EqualTo(serializedValue));
        }