Esempio n. 1
0
        public void ToStringUsesJson()
        {
            var dto = new TestDto {
                Id = 3, Name = "Three", Children = new[] { new TestDto {
                                                               Name = "child"
                                                           } }
            };

            dto.ToString().Should().Be(@"{""id"":3,""name"":""Three"",""children"":[{""name"":""child""}]}");
        }
    public void ToStringUsesJson()
    {
        var dto = new TestDto {
            Id = 3, Name = "Three", Children = new[] { new TestDto {
                                                           Name = "child"
                                                       } }
        };
        var json = @"{""id"":3,""name"":""Three"",""children"":[{""name"":""child""}]}";

        dto.ToString().Should().Be(json);

        if (Serializer is JsonServiceSerializer jsonSerializer)
        {
            jsonSerializer.ToJson(dto).Should().Be(json);
        }
    }