Beispiel #1
0
        public void GetStronglyTypedContentTest()
        {
            TestEvent     testEvent = new TestEvent("some event");
            EventEnvelope envelope  = new EventEnvelope("Test", type => testEvent);

            TestEvent content = envelope.GetContent <TestEvent>();

            content.Should().NotBeNull();
            content.ShouldBeEquivalentTo(testEvent);
        }
Beispiel #2
0
        public void GetDynamicContentFromJsonTest()
        {
            TestEvent     testEvent = new TestEvent("some event");
            string        json      = JsonConvert.SerializeObject(testEvent);
            EventEnvelope envelope  = new EventEnvelope("Test", type => this.FromJson(type, json));

            dynamic content = envelope.GetContent();

            ((DateTime)content.EventDate).ShouldBeEquivalentTo(testEvent.EventDate);
            Assert.AreEqual(testEvent.EventId, Guid.Parse(content.EventId));
            ((string)content.Name).ShouldBeEquivalentTo(testEvent.Name);
            ((string)content.Value).ShouldBeEquivalentTo(testEvent.Value);
        }
Beispiel #3
0
        public void GetStronglyTypedContentFromJsonTest()
        {
            TestEvent     testEvent = new TestEvent("some event");
            string        json      = JsonConvert.SerializeObject(testEvent);
            EventEnvelope envelope  = new EventEnvelope("Test", type => this.FromJson(type, json));

            TestEvent content = envelope.GetContent <TestEvent>();

            content.Should().NotBeNull();
            content.EventDate.ShouldBeEquivalentTo(testEvent.EventDate);
            content.EventId.ShouldBeEquivalentTo(testEvent.EventId);
            content.Name.ShouldBeEquivalentTo(testEvent.Name);
            content.Value.ShouldBeEquivalentTo(testEvent.Value);
        }