Exemplo n.º 1
0
        public void ThrowsArgumentNullExceptionWhenPassingNullContact()
        {
            SetAccountNrOfContactsCommand cmd = new SetAccountNrOfContactsCommand {
                FromContact = null
            };

            Assert.ThrowsException <ArgumentNullException>(() => CmdBus.Handle(cmd, FlowArgs));
        }
        public override VoidEvent Execute(CommandTriggeringCommand command)
        {
            SetAccountNrOfContactsCommand childCommand = new SetAccountNrOfContactsCommand {
                FromContact = command.FromContact
            };

            TriggerCommand(childCommand);

            return(VoidEvent);
        }
Exemplo n.º 3
0
        public void CanResolveCommandHandlerWithUserContextRepo()
        {
            ICommandBus cmdBus = new Bus();

            SetAccountNrOfContactsCommand cmd = new SetAccountNrOfContactsCommand {
                FromContact = new Contact()
            };

            cmdBus.Handle(cmd, FlowArgs);
        }
Exemplo n.º 4
0
        private void Execute(LocalPluginContext localContext)
        {
            Ctx.Contact targetContact = localContext.GetTarget <Ctx.Contact>();

            var setAccountNrOfContactsCommand = new SetAccountNrOfContactsCommand
            {
                FromContact = targetContact
            };

            localContext.Handle(setAccountNrOfContactsCommand);
        }
Exemplo n.º 5
0
        public void AccountsNameIsCorrectlySet()
        {
            SetAccountNrOfContactsCommand cmd = new SetAccountNrOfContactsCommand {
                FromContact = GetTriggeringContact()
            };

            CmdBusWithNoEventPropagation.Handle(cmd, FlowArgs);

            Account account = GetTargetAccount();

            Assert.AreEqual($"I have 2 contacts", account.Name);
        }