public void Deserialize_WhenGivenEmpty_ReturnsDefaults() { var test = TestJson.Deserialize("{}"); Assert.NotNull(test); Assert.Null(test.name); Assert.Equal(0, test.age); Assert.Null(test.home); }
public void Deserialize_WhenGivenFilled_ReturnsExpected() { var test = TestJson.Deserialize(@" { ""name"": ""john"", ""age"": 24, ""home"": { ""address"": ""123 house street"" } }" ); Assert.NotNull(test); Assert.NotNull(test.home); Assert.Equal("john", test.name); Assert.Equal(24, test.age); Assert.Equal("123 house street", test.home.address); }