Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fixed samples
Parse method doesn't allow trailing commas in JSON
  • Loading branch information
Kerri Lee committed Sep 3, 2020
commit be460eae29135f9d815a06d1201dfac9a880c239
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ namespace Azure.Messaging.EventGrid.Tests.Samples
public partial class EventGridSamples : SamplesBase<EventGridTestEnvironment>
{
// Example JSON payloads
private readonly string jsonPayloadSampleOne = "[{ \"id\": \"2d1781af-3a4c\", \"topic\": \"/examples/test/payload\", \"subject\": \"\", \"data\": { \"name\": \"example\",\"age\": 20 },\"eventType\": \"MyApp.Models.CustomEventType\",\"eventTime\": \"2018-01-25T22:12:19.4556811Z\",\"dataVersion\": \"1\"}]";
private readonly string jsonPayloadSampleOne = "[{ \"id\": \"2d1781af-3a4c\", \"topic\": \"/examples/test/payload\", \"subject\": \"\", \"data\": { \"Name\": \"example\",\"Age\": 20 },\"eventType\": \"MyApp.Models.CustomEventType\",\"eventTime\": \"2018-01-25T22:12:19.4556811Z\",\"dataVersion\": \"1\"}]";

private readonly string jsonPayloadSampleTwo = "[{ \"id\": \"2d1781af-3a4c\", \"source\": \"/examples/test/payload\", \"data\": { \"Name\": \"example\",\"Age\": 20, },\"type\": \"MyApp.Models.CustomEventType\",\"time\": \"2018-01-25T22:12:19.4556811Z\",\"specversion\": \"1\"},]";
private readonly string jsonPayloadSampleTwo = "[{ \"id\": \"2d1781af-3a4c\", \"source\": \"/examples/test/payload\", \"data\": { \"name\": \"example\",\"age\": 20 },\"type\": \"MyApp.Models.CustomEventType\",\"time\": \"2018-01-25T22:12:19.4556811Z\",\"specversion\": \"1\"}]";

// This sample demonstrates how to parse EventGridEvents from JSON and access event data using GetData()
[Test]
Expand Down Expand Up @@ -65,7 +65,6 @@ public async Task GenericReceiveAndDeserializeEventGridEvents()
JsonObjectSerializer myCustomSerializer = new JsonObjectSerializer(
new JsonSerializerOptions()
{
AllowTrailingCommas = true,
PropertyNameCaseInsensitive = true
});

Expand Down