예제 #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);
        }
예제 #2
0
        public ActionResult Disable(int capitalAccountID)
        {
            var cmd = new DisableCapitalAccount(capitalAccountID, this.CurrentUser.UserID);
            this.CommandBus.Send(cmd);

            return Json(JsonResult.Success);
        }