//[Test]
        //public void TestUpdateBranchReturnsSuccess()
        //{
        //    BranchRequestModel fakeBranchRequest = this.GetFakeBranchRequestModel();

        //    iBranchMock.Setup(x => x.ExecuteStoredProcedureInsertUpdate(It.IsAny<string>(), It.IsAny<DynamicParameters>())).Returns(Task.FromResult(new BaseResult<bool>() { Result = true }));

        //    var result = branchRepositoryMock.UpdateBranch(fakeBranchRequest, true, false).Result;

        //    Assert.IsTrue(result.Result);
        //}

        //[Test]
        //public void TestUpdateBranchReturnsBranchContactsCountIsZeroSuccess()
        //{
        //    BranchRequestModel fakeBranchRequest = this.GetFakeBranchRequestModel();
        //    fakeBranchRequest.BranchContacts = new List<BranchContacts> { };

        //    iBranchMock.Setup(x => x.ExecuteStoredProcedureInsertUpdate(It.IsAny<string>(), It.IsAny<DynamicParameters>())).Returns(Task.FromResult(new BaseResult<bool>() { Result = true }));

        //    var result = branchRepositoryMock.UpdateBranch(fakeBranchRequest, true, false).Result;

        //    Assert.IsTrue(result.Result);
        //}

        //[Test]
        //public void TestDeleteBranchReturnsSuccess()
        //{
        //    BranchRequestModel fakeBranchRequest = this.GetFakeBranchRequestModel();

        //    iBranchMock.Setup(x => x.UpdateEntityByDapper(fakeBranchRequest.Branch)).Returns(Task.FromResult(new BaseResult<bool>() { Result = true }));

        //    var result = branchRepositoryMock.UpdateBranch(fakeBranchRequest, false, true).Result;

        //    Assert.IsTrue(result.Result);
        //}

        private void MockGetAllBranchesResponseTables(bool ifSuccess)
        {
            Models.Response.Branch fakeBranchResponse = this.GetFakeBranchResponseModel();

            var branchContacts = new BranchContacts
            {
                Id            = 1,
                ContactPerson = "Jon Doe",
                DesignationId = 1,
                Email         = "*****@*****.**",
                ContactNumber = "1234567890",
                IsPrimary     = true,
                CreatedBy     = "sa",
                UpdatedBy     = "sa",
                IsActive      = true,
                IsDeleted     = false
            };

            var agencyId   = 5;
            var branchPred = new Func <Branch, bool>(x => x.IsActive && !x.IsDeleted && x.AgencyId == (agencyId != 0 ? agencyId : x.AgencyId));

            if (ifSuccess)
            {
                iBranchMock.Setup(x => x.GetListByPredicate(It.Is <Func <Branch, bool> >(a => a.GetType() == branchPred.GetType()))).Returns(Task.FromResult(new BaseResult <List <Branch> > {
                    Result = new List <Branch>()
                    {
                        fakeBranchResponse.MGBranch
                    }, IsError = false
                }));
            }
            else
            {
                iBranchMock.Setup(x => x.GetListByPredicate(It.Is <Func <Branch, bool> >(a => a.GetType() == branchPred.GetType()))).Returns(Task.FromResult(new BaseResult <List <Branch> > {
                    Result = new List <Branch>(), IsError = false
                }));
            }

            var agencyContactsPred = new Func <BranchContacts, bool>(a => a.IsActive && !a.IsDeleted && a.BranchId == fakeBranchResponse.MGBranch.Id);

            iBranchContactsMock.Setup(x => x.GetListByPredicate(It.Is <Func <BranchContacts, bool> >(a => a.GetType() == agencyContactsPred.GetType()))).Returns(Task.FromResult(new BaseResult <List <BranchContacts> > {
                Result = new List <BranchContacts>()
                {
                    branchContacts
                }, IsError = false
            }));
        }
        private Models.Response.Branch GetFakeBranchResponseModel()
        {
            Models.Response.Branch fakeBranchResponseModel = new Models.Response.Branch()
            {
                MGBranch = new Branch
                {
                    Id         = 1,
                    Name       = "Insert Test",
                    AgencyId   = 6,
                    Address1   = "Test Address Insert",
                    Address2   = "Add2",
                    CityId     = 2,
                    CountryId  = 4,
                    NameItemId = 1,
                    ZipCode    = "13455",
                    CreatedBy  = "MGIT",
                    UpdatedBy  = "MGIT"
                },

                BranchContacts = new List <BranchContacts>
                {
                    new BranchContacts
                    {
                        ContactPerson = "Test Contact Insert", Email = "*****@*****.**", ContactNumber = "213242343", DesignationId = 1, CreatedBy = "MGIT",
                        UpdatedBy     = "MGIT", BranchId = 1
                    },
                    new BranchContacts
                    {
                        ContactPerson = "Test Contact2 Insert", Email = "*****@*****.**", ContactNumber = "45646546", DesignationId = 1, CreatedBy = "MGIT",
                        UpdatedBy     = "MGIT", BranchId = 1
                    },
                    new BranchContacts
                    {
                        ContactPerson = "Test Contact3 Insert", Email = "*****@*****.**", ContactNumber = "45646546",
                        IsPrimary     = true, DesignationId = 1, CreatedBy = "MGIT", BranchId = 1, UpdatedBy = "MGIT"
                    }
                }
            };

            return(fakeBranchResponseModel);
        }