Beispiel #1
0
        public ActionResult Enable(int currencyID)
        {
            var cmd = new EnableCurrency(currencyID, this.CurrentUser.UserID);
            this.CommandBus.Send(cmd);

            return Json(JsonResult.Success);
        }
Beispiel #2
0
        public void TestEnableAndDisableCurrency()
        {
            var userID = new Random().Next(1, 10);
            var currency = GetOneCurrency();

            var enableCmd = new EnableCurrency(currency.ID, userID);
            var disableCmd = new DisableCurrency(currency.ID, userID);

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

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

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

            savedCurrency = IoC.Resolve<IRepository>().FindById<Currency>(currency.ID);
            Assert.True(savedCurrency.IsEnable);
        }