Ejemplo n.º 1
0
        public void TestCreateAndEnableAndDisableCapitalAccount()
        {
            var account = "6221234664962155796315".Substring(0, 19);
            var accountOwner = "张三";
            var createBy = 1;
            var capitalAccountID = 1;

            var createCommand = new CreateCapitalAccount(account, accountOwner, Bank.ICBC, createBy);

            Assert.DoesNotThrow(() =>
            {
                this.commandBus.Send(createCommand);
            });

            var enableCmd = new EnableCapitalAccount(capitalAccountID, createBy);
            var disableCmd = new DisableCapitalAccount(capitalAccountID, createBy);

            Assert.DoesNotThrow(() =>
            {
                this.commandBus.Send(enableCmd);
            });

            var enableCapitalAccount = IoC.Resolve<IRepository>().FindById<CapitalAccount>(capitalAccountID);

            Assert.True(enableCapitalAccount.IsEnable);

            Assert.DoesNotThrow(() =>
            {
                this.commandBus.Send(disableCmd);
            });

            var disableCapitalAccount = IoC.Resolve<IRepository>().FindById<CapitalAccount>(capitalAccountID);

            Assert.False(enableCapitalAccount.IsEnable);
        }
Ejemplo n.º 2
0
        public ActionResult Create(string BankAccount, string OwnerName, Bank Bank)
        {
            try
            {
                var cmd = new CreateCapitalAccount( BankAccount,  OwnerName,  Bank, this.CurrentUser.UserID);
                this.CommandBus.Send(cmd);

                return Json(JsonResult.Success);
            }
            catch (CommandExecutionException ex)
            {
                return Json(new JsonResult(ex.ErrorCode));
            }
        }