public void PayeeExists_tells_if_an_id_exists(int testId, bool expectedResult)
        {
            // Arrange
            var payees = new List <Payee> {
                new Payee {
                    ID = 1
                }
            }.AsQueryable();

            _mockRepo.Setup(m => m.GetPayees(It.IsAny <bool>(), It.IsAny <bool>(), It.IsAny <bool>())).Returns(payees);

            // Act
            var result = _testService.PayeeExists(testId);

            // Assert
            Assert.AreEqual(expectedResult, result);
        }
        /// <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);
                  } }
            };
        }