Exemplo n.º 1
0
        public ActionResult Create(CreateVoucherViewModel model)
        {
            if (!ModelState.IsValid)
                return View(model);

            var command = new CreateVoucher(model.CustomerId, model.Amount);
            Bus.Send<CreateVoucher>(command);

            return RedirectToAction("Index");
        }
Exemplo n.º 2
0
        public void CreateVoucher()
        {
            var controller = _container.GetInstance<VoucherController>();
            var model = new CreateVoucherViewModel()
            {
                CustomerId = Guid.NewGuid(),
                Amount = 10m
            };

            var result = controller.Create(model) as RedirectToRouteResult;
            object view;
            result.RouteValues.TryGetValue("action", out view);
            Assert.AreEqual("Index", view);
        }