public IEnumerable <JobProfileOverloadForWhatItTakes> GetLiveJobProfilesBySocCode(string socCode)
        {
            var socCodeItem = repository.Get(item => item.Status == ContentLifecycleStatus.Live && item.GetValue <string>(nameof(SocCode.SOCCode)) == socCode);

            if (socCodeItem != null)
            {
                var jobProfiles = dynamicContentExtensions.GetRelatedParentItems(socCodeItem, DynamicTypes.JobprofileContentType, repository.GetProviderName());

                if (jobProfiles.Any())
                {
                    var jobProfileOverloadForWhatItTakesList = new List <JobProfileOverloadForWhatItTakes>();
                    foreach (var jobProfile in jobProfiles)
                    {
                        var isCheckedOut = jpRepository.IsCheckedOut(jobProfile);

                        jobProfileOverloadForWhatItTakesList.Add(isCheckedOut ? new JobProfileOverloadForWhatItTakes {
                            UrlName = dynamicContentExtensions.GetFieldValue <Lstring>(jobProfile, nameof(JobProfile.UrlName)), Locked = true
                        } : converterLight.ConvertFrom(jobProfile));
                    }

                    return(jobProfileOverloadForWhatItTakesList);
                }
            }

            return(Enumerable.Empty <JobProfileOverloadForWhatItTakes>().AsQueryable());
        }
        public void GetLiveJobProfilesBySocCodeTest(bool validSoc, bool jobsAvailable)
        {
            //Assign
            var fakeRepo = GetTestJobProfileSocCodeRepository(validSoc);

            A.CallTo(() => fakeJpRepository.IsCheckedOut(A <DynamicContent> ._)).Returns(false);
            var dummyJobProfiles = jobsAvailable ? A.CollectionOfDummy <DynamicContent>(2).AsEnumerable().AsQueryable() : Enumerable.Empty <DynamicContent>().AsQueryable();

            A.CallTo(() => fakeDynamicContentExtensions.GetRelatedParentItems(A <DynamicContent> ._, A <string> ._, A <string> ._)).Returns(dummyJobProfiles);
            var socCode = nameof(JobProfileSocCodeRepositoryTest);

            //Act
            fakeRepo.GetLiveJobProfilesBySocCode(socCode);

            //Assert
            if (validSoc)
            {
                A.CallTo(() => fakeDynamicContentExtensions.GetRelatedParentItems(A <DynamicContent> ._, A <string> ._, A <string> ._)).MustHaveHappened();

                if (jobsAvailable)
                {
                    A.CallTo(() => fakeJpRepository.IsCheckedOut(A <DynamicContent> ._)).MustHaveHappened();
                    A.CallTo(() => fakeConverterLight.ConvertFrom(A <DynamicContent> ._)).MustHaveHappened();
                }
                else
                {
                    A.CallTo(() => fakeJpRepository.IsCheckedOut(A <DynamicContent> ._)).MustNotHaveHappened();
                    A.CallTo(() => fakeConverterLight.ConvertFrom(A <DynamicContent> ._)).MustNotHaveHappened();
                }
            }
            else
            {
                A.CallTo(() => fakeDynamicContentExtensions.GetRelatedParentItems(A <DynamicContent> ._, A <string> ._, A <string> ._)).MustNotHaveHappened();
            }

            A.CallTo(() => fakeRepository.Get(A <Expression <Func <DynamicContent, bool> > > .That.Matches(m => LinqExpressionsTestHelper.IsExpressionEqual(m, item => item.Status == ContentLifecycleStatus.Live && item.GetValue <string>(nameof(SocCode.SOCCode)) == socCode)))).MustHaveHappened();
        }