public async Task EventDataValueOnly()
        {
            var eds = new NewtonsoftJsonEventDataSerializer {
                SerializeValueOnly = true
            };
            var bytes = await eds.SerializeAsync(new EventData(CreateEventMetadata()));

            Assert.AreEqual(bytes.Length, 0);

            var ed = await eds.DeserializeAsync(bytes);

            Assert.NotNull(ed);
            Assert.Null(ed.Subject);
            Assert.IsFalse(ed.HasValue);
        }
        public async Task EventDataEndToEnd()
        {
            var eds   = new NewtonsoftJsonEventDataSerializer();
            var bytes = await eds.SerializeAsync(new EventData(CreateEventMetadata()));

            Assert.Greater(bytes.Length, 0);

            var json = Encoding.UTF8.GetString(bytes);

            Assert.AreEqual("{\"eventId\":\"00000001-0000-0000-0000-000000000000\",\"tenantId\":\"00000002-0000-0000-0000-000000000000\",\"subject\":\"Test.Subject\",\"action\":\"Created\",\"source\":\"/test\",\"key\":1,\"username\":\"Bob\",\"userid\":\"123\",\"timestamp\":\"2001-01-15T12:48:16Z\",\"correlationId\":\"XXX\",\"etag\":\"YYY\",\"partitionKey\":\"PK\"}", json);

            var ed = await eds.DeserializeAsync(bytes);

            AssertEventMetadata(ed);
        }
        public async Task EventDataTValueOnly()
        {
            var eds = new NewtonsoftJsonEventDataSerializer {
                SerializeValueOnly = true
            };
            var bytes = await eds.SerializeAsync(new EventData <int>(CreateEventMetadata()) { Value = 88 });

            Assert.Greater(bytes.Length, 0);

            var ed = await eds.DeserializeAsync(typeof(int), bytes);

            Assert.NotNull(ed);
            Assert.Null(ed.Subject);
            Assert.IsTrue(ed.HasValue);
            Assert.AreEqual(88, ed.GetValue());
            Assert.AreEqual(88, ((EventData <int>)ed).Value);
        }