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())); }
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")); }