示例#1
0
        public ActionResult SaveWaiter(StaffMemberViewModel viewModel)
        {
            var action = new SaveWaiterAction <ActionResult>(ServiceRegistry)
            {
                OnSuccess = () => RedirectToAction("ManageWaiters"),
                OnFailure = (errors) => EditFailed(viewModel.Staff.Id, errors)
            };

            return(action.Invoke(viewModel, ResolveRestaurantId()));
        }
示例#2
0
        public void EnsureGuardAgainstNullFailure()
        {
            var error = "";

            try
            {
                var action = new SaveWaiterAction <dynamic>(A.Fake <IServiceRegistry>())
                {
                    OnSuccess = () => new {  },
                };

                action.Invoke(new StaffMemberViewModel(), 1);
            }
            catch (Exception ex)
            {
                error = ex.Message;
            }

            Assert.IsTrue(error.Contains("OnFailure"));
        }