public void ConvertEventData_BadDataType() { var evt = new CloudEvent("type", new Uri("//source")) { Data = Guid.NewGuid() }; var converter = new ProtobufCloudEventDataConverter <StorageObjectData>(); Assert.Throws <ArgumentException>(() => converter.ConvertEventData(evt)); }
public void ConvertEventData_Json() { var original = new StorageObjectData { Bucket = "my-bucket" }; var evt = new CloudEvent("type", new Uri("//source")) { Data = "{ \"bucket\": \"my-bucket\" }" }; var converter = new ProtobufCloudEventDataConverter <StorageObjectData>(); var result = converter.ConvertEventData(evt); Assert.Equal(original, result); }