Пример #1
0
        public async Task PublishValueAsync_ValueIIdentifier()
        {
            ExecutionContext.Reset();
            var start = Cleaner.Clean(DateTime.Now);

            var tep = new TestEventPublisher();
            var v   = new Entity {
                Id = 123
            };

            await tep.PublishValue(v, "domain.entity.123", "create").SendAsync().ConfigureAwait(false);

            Assert.AreEqual(1, tep.Events.Count);
            var ed = (EventData <Entity>)tep.Events[0];

            Assert.IsNotNull(ed.EventId);
            Assert.IsNotNull(ed);
            Assert.AreEqual("domain.entity.123", ed.Subject);
            Assert.AreEqual("create", ed.Action);
            Assert.AreEqual(123, ed.Key);
            Assert.IsTrue(ed.HasValue);
            Assert.IsTrue(ed.Timestamp >= start);
            Assert.AreEqual(v, ed.Value);
            Assert.IsNull(ed.PartitionKey);
        }