public void TestUpdate()
        {
            // arrange
            UnitOfWork unitOfWork = new UnitOfWork();
            GenericRepository <TblBusiness> businessRepo = unitOfWork.BusinessRepository;

            // act
            try
            {
                IList <TblBusiness> allBusinesses = businessRepo.GetAll().ToList <TblBusiness>();
                int         lastBusinessId        = allBusinesses.Max(b => b.id);
                TblBusiness lastBusiness          = allBusinesses.Where(b => b.id == lastBusinessId).SingleOrDefault <TblBusiness>();
                Assert.IsNotNull(lastBusiness, "Business - Last Business was not retrieved");
                if (lastBusiness != null)
                {
                    lastBusiness.name = "Updated - Test Business";
                    businessRepo.Update(lastBusiness);
                    unitOfWork.Save();
                }
            }
            catch (Exception)
            {
                // assert
                Assert.Fail("Business - Update fialed");
                return;
            }
        }
        public void TestInsert()
        {
            // arrange
            UnitOfWork unitOfWork = new UnitOfWork();
            GenericRepository <TblBusiness> businessRepo = unitOfWork.BusinessRepository;
            int         actualCount   = businessRepo.GetAll().Count();
            int         expectedCount = ++actualCount;
            TblBusiness business      = new TblBusiness()
            {
                name          = "Test Business 1",
                logo          = null,
                addressLine1  = "123",
                addressLine2  = "Elm Grove",
                addressLine3  = "Worthing",
                postcode      = "WA1 3RW",
                country       = "UK",
                bank          = "Santander",
                accountNumber = "0987654321",
                sortcode      = "4567",
                iban          = "12",
                swift         = "34"
            };

            // act
            try
            {
                businessRepo.Insert(business);
                unitOfWork.Save();
                actualCount = businessRepo.GetAll().Count();
            }
            catch (Exception)
            {
                // assert
                Assert.Fail("Business - Insertion Failed");
                return;
            }

            // assert
            Assert.AreEqual(expectedCount, actualCount, "Business - Excpected and actual record counts after insertion do not match");
        }
        public void TestGetByPrimaryKey()
        {
            // arrange
            UnitOfWork unitOfWork = new UnitOfWork();
            GenericRepository <TblBusiness> businessRepository = unitOfWork.BusinessRepository;

            // act
            try
            {
                IList <TblBusiness> allBusinesses = businessRepository.GetAll().ToList <TblBusiness>();
                Assert.IsNotNull(allBusinesses, "");
                int         lastId       = allBusinesses.Max(b => b.id);
                TblBusiness lastBusiness = businessRepository.GetByPrimaryKey(lastId);
                // assert
                Assert.IsNotNull(lastBusiness, "Business - Get by Primary key not working");
            }
            catch (Exception)
            {
                // assert
                Assert.Fail("Business - Get By Primary Key Failed");
                return;
            }
        }