public static void RoundTripTypeNameClash() { RepeatedTypes.Location expected = CreateRepeatedLocation(); string json = JsonSerializer.Serialize(expected, JsonContext.Default.RepeatedLocation); RepeatedTypes.Location obj = JsonSerializer.Deserialize(json, JsonContext.Default.RepeatedLocation); VerifyRepeatedLocation(expected, obj); }
private static void VerifyRepeatedLocation(RepeatedTypes.Location expected, RepeatedTypes.Location obj) { Assert.Equal(expected.FakeAddress1, obj.FakeAddress1); Assert.Equal(expected.FakeAddress2, obj.FakeAddress2); Assert.Equal(expected.FakeCity, obj.FakeCity); Assert.Equal(expected.FakeState, obj.FakeState); Assert.Equal(expected.FakePostalCode, obj.FakePostalCode); Assert.Equal(expected.FakeName, obj.FakeName); Assert.Equal(expected.FakePhoneNumber, obj.FakePhoneNumber); Assert.Equal(expected.FakeCountry, obj.FakeCountry); }
public override void RoundTripTypeNameClash() { RepeatedTypes.Location expected = CreateRepeatedLocation(); string json = JsonSerializer.Serialize(expected, DefaultContext.RepeatedLocation); JsonTestHelper.AssertThrows_PropMetadataInit(() => JsonSerializer.Deserialize(json, DefaultContext.RepeatedLocation), typeof(RepeatedTypes.Location)); RepeatedTypes.Location obj = JsonSerializer.Deserialize(json, ((ITestContext)MetadataWithPerTypeAttributeContext.Default).RepeatedLocation); VerifyRepeatedLocation(expected, obj); AssertFastPathLogicCorrect(json, obj, DefaultContext.RepeatedLocation); }