コード例 #1
0
        public void PublishingEventPassesCorrectInstance()
        {
            TestEvent receivedEvent = null;
            var       sentEvent     = new TestEvent();

            this.eventAggregator.Subscribe <TestEvent>(e => receivedEvent = e, false, EventPriority.Normal, ThreadTarget.PublisherThread);

            this.eventAggregator.Publish(sentEvent);

            receivedEvent.Should().BeSameAs(sentEvent);
        }
コード例 #2
0
        public void Properties_on_the_base_Event_type_are_not_serialized()
        {
            var serialized = new TestEvent
            {
                AggregateId    = Guid.NewGuid(),
                SequenceNumber = 1,
                Timestamp      = DateTimeOffset.Now,
                Id             = 7,
                Data           = "abc"
            }.ToStorableEvent().Body;

            serialized.Should().Be("{\"Id\":7,\"Data\":\"abc\"}");
        }