public void DecodeStructured_Invalid(string resource) { var bytes = TestResourceHelper.LoadBytes(resource); var converter = new ProtobufJsonCloudEventFormatter <StorageObjectData>(); Assert.Throws <InvalidOperationException>(() => converter.DecodeStructuredModeMessage(bytes, null, null)); }
public void DecodeStructured() { var bytes = TestResourceHelper.LoadBytes("structured-mode-body.json"); var expectedEvent = CreateSampleEvent(); var converter = new ProtobufJsonCloudEventFormatter <StorageObjectData>(); var actualEvent = converter.DecodeStructuredModeMessage(bytes, new ContentType("application/cloudevents+json"), null); AssertCloudEventsEqual(expectedEvent, actualEvent); }