public void Value_List_WithNullElement() { var expected = Value.ForList(Value.ForString("x"), Value.ForNull(), Value.ForString("y")); var actual = Value.Parser.ParseText("[\"x\", null, \"y\"]"); Assert.Equal(expected, actual); }
public void StructValue_NullElement() { var expected = Value.ForStruct(new Struct { Fields = { { "x", Value.ForNull() } } }); var actual = Value.Parser.ParseText("x: null"); Assert.Equal(expected, actual); }
public void ExplicitNullValue() { string json = "valueField: null"; var message = TextParser.Default.Parse <TestWellKnownTypes>(json); Assert.Equal(new TestWellKnownTypes { ValueField = Value.ForNull() }, message); }
public void SingularWrappers_ExplicitNulls() { // When we parse the "valueField": null part, we remember it... basically, it's one case // where explicit default values don't fully roundtrip. var message = new TestWellKnownTypes { ValueField = Value.ForNull() }; var json = TextFormatter.Default.Format(message); var parsed = TextParser.Default.Parse <TestWellKnownTypes>(json); Assert.Equal(message, parsed); }