Beispiel #1
0
        public void when_publishing_null_as_inception_message_it_should_fail()
        {
            var publisher = new VentureMessagePublisher(new FakeMessageRouter());
            // ReSharper disable once AssignNullToNotNullAttribute - it's a test against null.
            Func <Task> sut = () => publisher.PublishInceptionMessage <object>(message: null, DateTimeOffset.UtcNow);

            sut.Should().Throw <ArgumentNullException>().Where(exception => exception.ParamName.Equals("message"), "message should be specified");
        }
Beispiel #2
0
        public async Task when_publishing_inception_message_it_should_assign_proper_message_ids()
        {
            var messageRouter = new FakeMessageRouter();
            var sut           = new VentureMessagePublisher(messageRouter);
            var message       = new object();

            await sut.PublishInceptionMessage(message, DateTimeOffset.UtcNow);

            messageRouter.Message.Should().BeSameAs(message, "it should pass message without changes");
            messageRouter.MessageId.Should().NotBeNullOrWhiteSpace("it should generate message ID");
            messageRouter.CorrelationId.Should().Be(messageRouter.MessageId, "correlation ID and message ID should be the same");
            messageRouter.CausationId.Should().Be(messageRouter.MessageId, "causation ID and message ID should be the same");
        }