예제 #1
0
            public void HandlesEnum()
            {
                var item = new ObjectWithEnumProperty
                {
                    Name     = "Ferris Bueller",
                    SomeEnum = SomeEnum.PlusOne
                };

                var json = new SimpleJsonSerializer().Serialize(item);

                Assert.Equal("{\"name\":\"Ferris Bueller\",\"some_enum\":\"+1\"}", json);
            }
예제 #2
0
            public void HandlesEnum()
            {
                var item = new ObjectWithEnumProperty
                {
                    Name               = "Ferris Bueller",
                    SomeEnum           = SomeEnum.Unicode,
                    SomeEnumNullable   = SomeEnum.Unicode,
                    StringEnum         = SomeEnum.SomethingElse,
                    StringEnumNullable = SomeEnum.SomethingElse
                };

                var json = new SimpleJsonSerializer().Serialize(item);

                Assert.Equal("{\"name\":\"Ferris Bueller\",\"some_enum\":\"unicode\",\"some_enum_nullable\":\"unicode\",\"string_enum\":\"something else\",\"string_enum_nullable\":\"something else\"}", json);
            }
            public void HandlesEnum()
            {
                var item = new ObjectWithEnumProperty
                {
                    Name = "Ferris Bueller",
                    SomeEnum = SomeEnum.PlusOne
                };

                var json = new SimpleJsonSerializer().Serialize(item);

                Assert.Equal("{\"name\":\"Ferris Bueller\",\"some_enum\":\"+1\"}", json);
            }