public async Task UpdatePayeeAsync_edits_payee_then_saves()
        {
            // Arrange
            var testID = 1;
            var payee  = new Payee {
                ID            = testID,
                Name          = "test",
                EffectiveFrom = DateTime.Parse("1/1/2017")
            };
            var sequence = new MockSequence();

            _mockRepo.Setup(m => m.GetPayees(It.IsAny <bool>(), It.IsAny <bool>(), It.IsAny <bool>())).Returns(new List <Payee>().AsQueryable());
            _mockRepo.InSequence(sequence).Setup(m => m.EditPayee(It.IsAny <Payee>()));
            _mockRepo.InSequence(sequence).Setup(m => m.SaveChangesAsync()).ReturnsAsync(1);

            // Act
            await _testService.UpdatePayeeAsync(testID, payee);

            // Assert
            _mockRepo.Verify(m => m.EditPayee(payee), Times.Once());
            _mockRepo.Verify(m => m.SaveChangesAsync(), Times.Once());
        }
        /// <summary>
        /// The default constructor
        /// </summary>
        /// <param name="service">The service to use in the controller</param>
        public PayeeController(IPayeeManagerService service) : base(
                singleAdder: payee => service.AddPayeeAsync(payee),
                singleEditor: payee => service.UpdatePayeeAsync(payee),
                existanceChecker: payee => service.PayeeExists(payee.NavId),
                singleDeleter: id => service.RemovePayeeAsync(id)
                )
        {
            // Setup category name collection
            _allCategoryNames = service.GetCategories().Select(c => c.Name).ToList();

            // Setup CRUDController functions
            CollectionGetter   = () => GetViewModelCollection(service);
            ViewModelCreator   = id => GetViewModel(id, service);
            FailedPostRebinder = payee => payee.CategoryOptions = _allCategoryNames;

            // Setup error handling
            ExceptionHandling = new Dictionary <Type, Func <Exception, IActionResult> > {
                { typeof(ExpenseTrackerException), ex => NotFound() },
                { typeof(NullModelException), ex => {
                      ModelState.AddModelError("", ex.Message);
                      return(null);
                  } }
            };
        }