public static void RoundTripActiveOrUpcomingEvent() { ActiveOrUpcomingEvent expected = CreateActiveOrUpcomingEvent(); string json = JsonSerializer.Serialize(expected, JsonContext.Default.ActiveOrUpcomingEvent); ActiveOrUpcomingEvent obj = JsonSerializer.Deserialize(json, JsonContext.Default.ActiveOrUpcomingEvent); VerifyActiveOrUpcomingEvent(expected, obj); }
private static void VerifyActiveOrUpcomingEvent(ActiveOrUpcomingEvent expected, ActiveOrUpcomingEvent obj) { Assert.Equal(expected.CampaignManagedOrganizerName, obj.CampaignManagedOrganizerName); Assert.Equal(expected.CampaignName, obj.CampaignName); Assert.Equal(expected.Description, obj.Description); Assert.Equal(expected.EndDate, obj.EndDate); Assert.Equal(expected.Id, obj.Id); Assert.Equal(expected.ImageUrl, obj.ImageUrl); Assert.Equal(expected.Name, obj.Name); Assert.Equal(expected.StartDate, obj.StartDate); }
public override void RoundTripActiveOrUpcomingEvent() { ActiveOrUpcomingEvent expected = CreateActiveOrUpcomingEvent(); string json = JsonSerializer.Serialize(expected, DefaultContext.ActiveOrUpcomingEvent); JsonTestHelper.AssertThrows_PropMetadataInit(() => JsonSerializer.Deserialize(json, DefaultContext.ActiveOrUpcomingEvent), typeof(ActiveOrUpcomingEvent)); ActiveOrUpcomingEvent obj = JsonSerializer.Deserialize(json, ((ITestContext)MetadataWithPerTypeAttributeContext.Default).ActiveOrUpcomingEvent); VerifyActiveOrUpcomingEvent(expected, obj); AssertFastPathLogicCorrect(json, obj, DefaultContext.ActiveOrUpcomingEvent); }