예제 #1
0
        public void Does_serialize_EnumMember_Value()
        {
            var dto = new EnumMemberDto {
                Day = Day.Sunday
            };
            var json = dto.ToJson();

            Assert.That(json, Is.EqualTo("{\"Day\":\"SUN\"}"));

            var fromDto = json.FromJson <EnumMemberDto>();

            Assert.That(fromDto.Day, Is.EqualTo(Day.Sunday));
        }
예제 #2
0
        public void Does_serialize_EnumMember_Value()
        {
            var dto = new EnumMemberDto {
                Day = Day.Sunday
            };

            var json = dto.ToJson();

            Assert.That(json, Is.EqualTo("{\"Day\":\"SUN\"}"));
            var fromDto = json.FromJson <EnumMemberDto>();

            Assert.That(fromDto.Day, Is.EqualTo(Day.Sunday));

            var jsv = dto.ToJsv();

            Assert.That(jsv, Is.EqualTo("{Day:SUN}"));
            fromDto = jsv.FromJsv <EnumMemberDto>();
            Assert.That(fromDto.Day, Is.EqualTo(Day.Sunday));

            var csv = dto.ToCsv();

            Assert.That(csv.NormalizeNewLines(), Is.EqualTo("Day,NDay\nSUN,\n".NormalizeNewLines()));
        }