Пример #1
0
        public ActionResult ModifyCurrencyWithdrawDayLimit(int currencyID, decimal dayLimit)
        {
            var cmd = new ModifyCurrencyWithdrawDayLimit(currencyID, dayLimit, this.CurrentUser.UserID);
            this.CommandBus.Send(cmd);

            return Json(JsonResult.Success);
        }
Пример #2
0
        public void TestModifyCurrencyWithdrawDayLimit()
        {
            var userID = new Random().Next(1, 10);
            var currency = GetOneCurrency();
            var dayLimit = 50000;

            var cmd = new ModifyCurrencyWithdrawDayLimit(currency.ID, dayLimit, userID);

            if (!currency.IsEnable)
            {
                var ex = Assert.Throws<CommandExecutionException>(() => { this.commandBus.Send(cmd); });
                Assert.Equal(ex.ErrorCode, (int)ErrorCode.CurrencyIsDisabled);
                this.commandBus.Send(new EnableCurrency(currency.ID, userID));
            }

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

            var savedCurrency = IoC.Resolve<IRepository>().FindById<Currency>(currency.ID);

            Assert.Equal(savedCurrency.WithdrawDayLimit, dayLimit);
        }