Exemplo n.º 1
0
        public async Task DecodeBatchModeMessageAsync_Minimal()
        {
            var obj = new JObject
            {
                ["specversion"] = "1.0",
                ["type"]        = "test-type",
                ["id"]          = "test-id",
                ["source"]      = SampleUriText,
            };

            byte[] bytes = Encoding.UTF8.GetBytes(new JArray {
                obj
            }.ToString());
            var stream      = new MemoryStream(bytes);
            var formatter   = new JsonEventFormatter();
            var cloudEvents = await formatter.DecodeBatchModeMessageAsync(stream, s_jsonCloudEventBatchContentType, null);

            var cloudEvent = Assert.Single(cloudEvents);

            Assert.Equal("test-type", cloudEvent.Type);
            Assert.Equal("test-id", cloudEvent.Id);
            Assert.Equal(SampleUri, cloudEvent.Source);
        }