Exemple #1
0
        public async Task PublishAsync_should_throw_if_message_null()
        {
            var repo = NSubstitute.Substitute.For <IOutboxRepository>();
            var sut  = new DefaultMessageBus(repo);

            await Assert.ThrowsAsync <ArgumentNullException>(async() => await sut.PublishAsync <StartDummySaga>(null));
        }
        public static Configuration InitializeCQRSAssemblies(this Configuration configuration, IEventStore es, Assembly[] assemblies)
        {
            DefaultMessageBus dispatcher = new DefaultMessageBus(es);

            dispatcher.ScanAssembly(assemblies);
            Configuration.Instance.SetDefault <DefaultMessageBus, DefaultMessageBus>(dispatcher);

            return(configuration);
        }
Exemple #3
0
        public async Task PublishAsync_should_append_to_outbox()
        {
            var repo = NSubstitute.Substitute.For <IOutboxRepository>();
            var sut  = new DefaultMessageBus(repo);

            var message = StartDummySaga.New();
            await sut.PublishAsync(message);

            await repo.Received(1).AppendAsync(message, Arg.Any <CancellationToken>());
        }
Exemple #4
0
        public void Can_send_and_receive_messages()
        {
            bool seen = false;

            var mb = new DefaultMessageBus();
            mb.Subscribe<ITestMessage>(msg =>
            {
                seen = msg.Test == "1";
            });
            mb.Send<ITestMessage>(msgBuilder => { msgBuilder.Test = "1"; }).Wait();

            Assert.IsTrue(seen);
        }
Exemple #5
0
        public async Task PublishAsync_should_pass_transaction_if_set()
        {
            var repo = NSubstitute.Substitute.For <IOutboxRepository>();
            var sut  = new DefaultMessageBus(repo);

            var message = StartDummySaga.New();

            var transaction = NSubstitute.Substitute.For <ITransaction>();

            sut.SetTransaction(transaction);

            await sut.PublishAsync(message);

            await repo.Received(1).AppendAsync(message, transaction, Arg.Any <CancellationToken>());
        }
Exemple #6
0
 public UserController(DefaultMessageBus messageDispatcher, UserView userView)
 {
     _messageDispatcher = messageDispatcher;
     _userView          = userView;
 }
Exemple #7
0
 public RoleController(DefaultMessageBus messageDispatcher, RoleView roleView)
 {
     _messageDispatcher = messageDispatcher;
     _roleView          = roleView;
 }
Exemple #8
0
 public ReadModelController(DefaultMessageBus messageDispatcher)
 {
     _messageDispatcher = messageDispatcher;
 }
Exemple #9
0
 public CategoryTypeSchemeController(DefaultMessageBus messageDispatcher, CategoryTypeSchemeView categoryTypeSchemeView)
 {
     _messageDispatcher      = messageDispatcher;
     _categoryTypeSchemeView = categoryTypeSchemeView;
 }
Exemple #10
0
 public PartyRoleController(DefaultMessageBus messageDispatcher, PartyRoleView partyRoleView)
 {
     _messageDispatcher = messageDispatcher;
     _partyRoleView     = partyRoleView;
 }
Exemple #11
0
 public AssociationController(DefaultMessageBus messageDispatcher, AssociationView associationView)
 {
     _messageDispatcher = messageDispatcher;
     _associationView   = associationView;
 }
Exemple #12
0
 public PopTemplateController(DefaultMessageBus messageDispatcher, PopTemplateView popTemplateView)
 {
     _messageDispatcher = messageDispatcher;
     _popTemplateView   = popTemplateView;
 }
Exemple #13
0
 public InitData()
 {
     _messageDispatcher = ObjectContainer.Resolve <DefaultMessageBus>();
 }
Exemple #14
0
 public DdlController(DefaultMessageBus messageDispatcher, DropDownView dropDownView, UserView userView)
 {
     _messageDispatcher = messageDispatcher;
     _dropDownView      = dropDownView;
     _userView          = userView;
 }
Exemple #15
0
 public EntityController(DefaultMessageBus messageDispatcher, EntityView entityView)
 {
     _messageDispatcher = messageDispatcher;
     _entityView        = entityView;
 }
Exemple #16
0
 public FieldController(DefaultMessageBus messageDispatcher, FieldView fieldView, CategoryView categoryView)
 {
     _messageDispatcher = messageDispatcher;
     _fieldView         = fieldView;
     _categoryView      = categoryView;
 }
Exemple #17
0
 public ModuleController(DefaultMessageBus messageDispatcher, ModuleView moduleView)
 {
     _messageDispatcher = messageDispatcher;
     _moduleView        = moduleView;
 }