コード例 #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);
            }
コード例 #3
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);
            }