private dataAccess.Entity.Cost BuildCost(Guid costId, CostUser[] costUsers, dataAccess.Entity.Project project)
        {
            const string     agencyName    = "Saatchi";
            const string     brandName     = "P&G";
            const string     costNumber    = "P101";
            const CostStages costStageName = CostStages.OriginalEstimate;

            var cost = new dataAccess.Entity.Cost
            {
                Parent = new AbstractType()
            };

            var costOwner = costUsers[0];

            var latestRevision = new CostStageRevision();
            var costStage      = new CostStage();
            var brand          = new dataAccess.Entity.Brand();
            var agency         = new dataAccess.Entity.Agency();

            cost.CostNumber = costNumber;
            cost.LatestCostStageRevision = latestRevision;
            cost.Project             = project;
            cost.Parent.Agency       = agency;
            costOwner.Agency         = agency;
            costOwner.Id             = Guid.NewGuid();
            latestRevision.CostStage = costStage;

            agency.Name    = agencyName;
            brand.Name     = brandName;
            cost.Id        = costId;
            costStage.Name = costStageName.ToString();

            latestRevision.Id = Guid.NewGuid();

            return(cost);
        }
        private void SetupDataSharedAcrossTests()
        {
            const string     agencyLocation      = "United Kingdom";
            const string     agencyName          = "Saatchi";
            const string     brandName           = "P&G";
            const string     costNumber          = "P101";
            const CostStages costStageName       = CostStages.OriginalEstimate;
            const string     costOwnerGdamUserId = "57e5461ed9563f268ef4f19d";
            const string     costOwnerFullName   = "Mr Cost Owner";
            const string     projectName         = "Pampers";
            const string     projectGdamId       = "57e5461ed9563f268ef4f19c";
            const string     projectNumber       = "PandG01";

            var projectId = Guid.NewGuid();

            _cost = new Cost();
            var costOwner = new CostUser
            {
                UserBusinessRoles = new List <UserBusinessRole>
                {
                    new UserBusinessRole
                    {
                        BusinessRole = new BusinessRole
                        {
                            Key   = Constants.BusinessRole.FinanceManager,
                            Value = Constants.BusinessRole.FinanceManager
                        }
                    }
                }
            };
            var approverUser = new CostUser
            {
                UserBusinessRoles = new List <UserBusinessRole>
                {
                    new UserBusinessRole
                    {
                        BusinessRole = new BusinessRole
                        {
                            Key   = Constants.BusinessRole.Ipm,
                            Value = Constants.BusinessRole.Ipm
                        }
                    }
                }
            };
            var insuranceUser = new CostUser
            {
                UserBusinessRoles = new List <UserBusinessRole>
                {
                    new UserBusinessRole
                    {
                        BusinessRole = new BusinessRole
                        {
                            Key   = Constants.BusinessRole.InsuranceUser,
                            Value = Constants.BusinessRole.InsuranceUser
                        }
                    }
                }
            };

            var latestRevision = new CostStageRevision();
            var costStage      = new CostStage();
            var project        = new dataAccess.Entity.Project();
            var brand          = new Brand();
            var agency         = new dataAccess.Entity.Agency();
            var country        = new Country();

            agency.Country   = country;
            approverUser.Id  = _approverUserId;
            _cost.CostNumber = costNumber;
            _cost.LatestCostStageRevision = latestRevision;
            _cost.Project            = project;
            _cost.Owner              = costOwner;
            costOwner.Agency         = agency;
            costOwner.Id             = _costOwnerId;
            insuranceUser.Id         = _insuranceUserId;
            latestRevision.CostStage = costStage;
            project.Brand            = brand;

            agency.Name           = agencyName;
            brand.Name            = brandName;
            _cost.Id              = _costId;
            costStage.Name        = costStageName.ToString();
            costOwner.FullName    = costOwnerFullName;
            costOwner.GdamUserId  = costOwnerGdamUserId;
            costOwner.Id          = _costOwnerId;
            latestRevision.Id     = _costStageRevisionId;
            project.Id            = projectId;
            project.Name          = projectName;
            project.GdamProjectId = projectGdamId;
            project.AdCostNumber  = projectNumber;
            country.Name          = agencyLocation;

            var agencies = new List <dataAccess.Entity.Agency> {
                agency
            };
            var brands = new List <Brand> {
                brand
            };
            var costs = new List <Cost> {
                _cost
            };
            var costStages = new List <CostStageRevision> {
                latestRevision
            };
            var costUsers = new List <CostUser> {
                approverUser, costOwner, insuranceUser
            };
            var countries = new List <Country> {
                country
            };
            var projects = new List <dataAccess.Entity.Project> {
                project
            };
            var insuranceUsers = new List <string> {
                _insuranceUserGdamId
            };

            _efContextMock.MockAsyncQueryable(agencies.AsQueryable(), c => c.Agency);
            _efContextMock.MockAsyncQueryable(brands.AsQueryable(), c => c.Brand);
            _efContextMock.MockAsyncQueryable(costs.AsQueryable(), c => c.Cost);
            _efContextMock.MockAsyncQueryable(costStages.AsQueryable(), c => c.CostStageRevision);
            _efContextMock.MockAsyncQueryable(costUsers.AsQueryable(), c => c.CostUser);
            _efContextMock.MockAsyncQueryable(countries.AsQueryable(), c => c.Country);
            _efContextMock.MockAsyncQueryable(projects.AsQueryable(), c => c.Project);

            _costUserServiceMock.Setup(cus => cus.GetInsuranceUsers(It.IsAny <dataAccess.Entity.Agency>())).Returns(Task.FromResult(insuranceUsers));
            _efContextMock.MockAsyncQueryable(new List <NotificationSubscriber>
            {
                new NotificationSubscriber
                {
                    CostId     = _cost.Id,
                    CostUserId = _costOwnerId,
                    CostUser   = costOwner
                }
            }.AsQueryable(), a => a.NotificationSubscriber);
        }