コード例 #1
0
        public void when_sending_then_sets_command_id_as_messageid()
        {
            var sender = new MessageSenderMock();
            var sut    = new CommandBus(sender, Mock.Of <IMetadataProvider>(), new JsonTextSerializer());

            var command = new FooCommand {
                Id = Guid.NewGuid()
            };

            sut.Send(command);

            Assert.IsTrue(command.Id.ToString() == sender.Sent.Single().MessageId);
        }
コード例 #2
0
        public void when_specifying_delay_then_sets_in_message()
        {
            var sender = new MessageSenderMock();
            var sut    = new CommandBus(sender, Mock.Of <IMetadataProvider>(), new JsonTextSerializer());

            var command = new Envelope <ICommand>(new FooCommand {
                Id = Guid.NewGuid()
            })
            {
                Delay = TimeSpan.FromMinutes(15)
            };

            sut.Send(command);
            Assert.IsTrue(sender.Sent.Single().TimeToLive > TimeSpan.FromMinutes(14.9) && sender.Sent.Single().TimeToLive < TimeSpan.FromMinutes(15.1));
        }