public void GetByJobProfileUrlNameTests(string urlName, bool validJobProfile, bool validDataInjection)
        {
            //Assign
            //Setup Fakes
            A.CallTo(() => fakeJobprofileRepository.Get(A <Expression <Func <DynamicContent, bool> > > ._)).Returns(validJobProfile ? dummyDynamicContent : null);
            A.CallTo(() => fakeDynamicContentExtensions.GetRelatedParentItems(A <DynamicContent> ._, A <string> ._, A <string> ._)).Returns(validDataInjection ? new EnumerableQuery <DynamicContent>(new List <DynamicContent> {
                dummyDynamicContent
            }) : Enumerable.Empty <DynamicContent>().AsQueryable());
            A.CallTo(() => fakeConverter.ConvertFrom(A <DynamicContent> ._)).Returns(new StructuredDataInjection());

            //Act
            var result = structuredDataInjectionRepository.GetByJobProfileUrlName(urlName);

            //Assert
            A.CallTo(() => fakeJobprofileRepository.Get(A <Expression <Func <DynamicContent, bool> > > ._))
            .MustHaveHappenedOnceExactly();
            if (validDataInjection)
            {
                A.CallTo(() => fakeConverter.ConvertFrom(A <DynamicContent> ._))
                .MustHaveHappenedOnceExactly();
            }

            if (!validDataInjection || !validJobProfile)
            {
                result.Should().BeNull();
            }
        }
        public IQueryable <ApprenticeVacancy> GetApprenticeVacanciesBySocCode(string socCode)
        {
            var socCodeItem = repository.Get(item => item.Visible && item.Status == ContentLifecycleStatus.Live && item.GetValue <string>(nameof(SocCode.SOCCode)) == socCode);
            var vacancies   = dynamicContentExtensions.GetRelatedParentItems(socCodeItem, DynamicTypes.JobProfileApprenticeshipContentType, repository.GetProviderName());

            if (vacancies.Any())
            {
                return(vacancies.Select(item => converter.ConvertFrom(item)));
            }

            return(Enumerable.Empty <ApprenticeVacancy>().AsQueryable());
        }
        public void UpsertSocSkillMatrixTest(bool skillAvailable)
        {
            //Arrange
            var dummySocSkill = new SocSkillMatrix {
                Title = "title test", SocCode = nameof(SocSkillMatrix.SocCode), Skill = nameof(SocSkillMatrix.Skill)
            };
            var dummyDynamicContent = A.Dummy <DynamicContent>();

            // Dummies and fakes
            SetupRepositoryCalls(dummyDynamicContent, skillAvailable);

            var socSkillMatrixRepository = new SocSkillMatrixRepository(fakeFrameworkSkillRepository, fakeSocMatrixRepository, fakeDynamicContentExtensions, fakeSocCodeRepository, fakeSocSkillConverter);

            // Act
            socSkillMatrixRepository.UpsertSocSkillMatrix(dummySocSkill);

            // Assert
            if (!skillAvailable)
            {
                A.CallTo(() => fakeSocMatrixRepository.Create()).MustHaveHappenedOnceExactly();
                A.CallTo(() => fakeSocMatrixRepository.Add(dummyDynamicContent)).MustHaveHappenedOnceExactly();
            }
            else
            {
                A.CallTo(() => fakeSocMatrixRepository.GetMaster(dummyDynamicContent))
                .MustHaveHappenedOnceExactly();
                A.CallTo(() => fakeSocMatrixRepository.GetTemp(dummyDynamicContent)).MustHaveHappenedOnceExactly();
                A.CallTo(() => fakeSocMatrixRepository.CheckinTemp(dummyDynamicContent)).MustHaveHappenedOnceExactly();
                A.CallTo(() => fakeSocMatrixRepository.Publish(dummyDynamicContent, A <string> ._))
                .MustHaveHappenedOnceExactly();
                A.CallTo(() =>
                         fakeDynamicContentExtensions.SetRelatedFieldValue(dummyDynamicContent, dummyDynamicContent, A <string> ._, A <float> ._)).MustHaveHappened(2, Times.OrLess);
                A.CallTo(() =>
                         fakeDynamicContentExtensions.DeleteRelatedFieldValues(dummyDynamicContent, A <string> ._))
                .MustHaveHappened(2, Times.OrLess);
                A.CallTo(() =>
                         fakeDynamicContentExtensions.SetFieldValue(dummyDynamicContent, A <string> ._, A <string> ._))
                .MustHaveHappened();
                A.CallTo(() =>
                         fakeDynamicContentExtensions.SetFieldValue(dummyDynamicContent, A <string> ._, A <decimal?> ._))
                .MustHaveHappened(2, Times.Exactly);
                A.CallTo(() => fakeSocCodeRepository.Get(A <Expression <Func <DynamicContent, bool> > > .That.Matches(m =>
                                                                                                                      LinqExpressionsTestHelper.IsExpressionEqual(m, d =>
                                                                                                                                                                  d.Status == ContentLifecycleStatus.Master &&
                                                                                                                                                                  d.GetValue <string>(nameof(SocCode.SOCCode)) == dummySocSkill.SocCode))))
                .MustHaveHappened();

                A.CallTo(() => fakeSocMatrixRepository.Get(A <Expression <Func <DynamicContent, bool> > > .That.Matches(m =>
                                                                                                                        LinqExpressionsTestHelper.IsExpressionEqual(m, item =>
                                                                                                                                                                    item.Visible && item.Status == ContentLifecycleStatus.Live && item.UrlName == dummySocSkill.SfUrlName)))).MustHaveHappened();
                A.CallTo(() => fakeSocMatrixRepository.Commit()).MustHaveHappened();
            }
        }
        /// <summary>
        /// Returns a jobprofile for normal front end view.
        /// Only live profiles are returned.
        /// </summary>
        /// <param name="urlName">URL of the jobprofile to return</param>
        /// <returns>JobProfile</returns>
        public JobProfile GetByUrlName(string urlName)
        {
            var key = urlName.ToLower();

            if (!cachedJobProfiles.ContainsKey(key))
            {
                var jobProfile = ConvertDynamicContent(repository.Get(item =>
                                                                      item.UrlName == urlName && item.Status == ContentLifecycleStatus.Live && item.Visible == true));
                cachedJobProfiles.Add(key, jobProfile);
            }

            return(cachedJobProfiles[key]?.IsImported == true ? null : cachedJobProfiles[key]);
        }
        public void UpsertFrameworkSkillTest(bool skillAvailable)
        {
            //Arrange
            var dummySkill = new FrameworkSkill {
                Title = "title test"
            };
            var dummyDynamicContent = A.Dummy <DynamicContent>();

            // Dummies and fakes
            A.CallTo(() => fakeFrameworkSkillRepository.Get(A <Expression <Func <DynamicContent, bool> > > ._)).Returns(skillAvailable ? dummyDynamicContent : null);
            A.CallTo(() => fakeFrameworkSkillRepository.GetMaster(dummyDynamicContent)).Returns(dummyDynamicContent);
            A.CallTo(() => fakeFrameworkSkillRepository.GetTemp(dummyDynamicContent)).Returns(dummyDynamicContent);
            A.CallTo(() => fakeFrameworkSkillRepository.CheckinTemp(dummyDynamicContent)).Returns(dummyDynamicContent);
            A.CallTo(() => fakeFrameworkSkillRepository.Create()).Returns(dummyDynamicContent);
            A.CallTo(() => fakeFrameworkSkillRepository.Add(dummyDynamicContent)).DoesNothing();
            A.CallTo(() => fakeFrameworkSkillRepository.Publish(dummyDynamicContent, A <string> ._)).DoesNothing();
            A.CallTo(() => fakeFrameworkSkillRepository.Commit()).DoesNothing();
            A.CallTo(() => fakeFrameworkSkillRepository.CheckinTemp(dummyDynamicContent)).Returns(dummyDynamicContent);
            A.CallTo(() =>
                     fakeDynamicContentExtensions.SetFieldValue(dummyDynamicContent, A <string> ._, A <string> ._)).DoesNothing();

            var frameworkSkillRepository = new FrameworkSkillRepository(fakeFrameworkSkillRepository, fakeDynamicContentExtensions, fakeFrameworkSkillConverter);

            // Act
            frameworkSkillRepository.UpsertFrameworkSkill(dummySkill);

            // Assert
            if (skillAvailable)
            {
                A.CallTo(() => fakeFrameworkSkillRepository.GetMaster(dummyDynamicContent))
                .MustHaveHappenedOnceExactly();
                A.CallTo(() => fakeFrameworkSkillRepository.GetTemp(dummyDynamicContent)).MustHaveHappenedOnceExactly();
                A.CallTo(() => fakeFrameworkSkillRepository.CheckinTemp(dummyDynamicContent)).MustHaveHappenedOnceExactly();
                A.CallTo(() => fakeFrameworkSkillRepository.Publish(dummyDynamicContent, A <string> ._)).MustHaveHappenedOnceExactly();
                A.CallTo(() => fakeFrameworkSkillRepository.Commit()).MustHaveHappenedOnceExactly();
                A.CallTo(() =>
                         fakeDynamicContentExtensions.SetFieldValue(dummyDynamicContent, A <string> ._, A <string> ._)).MustHaveHappened(2, Times.Exactly);
            }
            else
            {
                A.CallTo(() => fakeFrameworkSkillRepository.Create()).MustHaveHappenedOnceExactly();
                A.CallTo(() => fakeFrameworkSkillRepository.Add(dummyDynamicContent)).MustHaveHappenedOnceExactly();
                A.CallTo(() => fakeFrameworkSkillRepository.Commit()).MustHaveHappenedOnceExactly();
                A.CallTo(() =>
                         fakeDynamicContentExtensions.SetFieldValue(dummyDynamicContent, A <string> ._, A <string> ._)).MustHaveHappened(3, Times.Exactly);
            }

            A.CallTo(() => fakeFrameworkSkillRepository.Get(A <Expression <Func <DynamicContent, bool> > > .That.Matches(m => LinqExpressionsTestHelper.IsExpressionEqual(m, item =>
                                                                                                                                                                          item.Visible && item.Status == ContentLifecycleStatus.Live && item.UrlName == dummySkill.SfUrlName)))).MustHaveHappened();
        }
        public void GetByParentNameTest(string urlName, int numberOfItemsToReturn)
        {
            //Assign
            var fakeRepo = GetTestJobProfilesRelatedCareersRepository(1, true);

            //Act
            fakeRepo.GetByParentName(urlName, numberOfItemsToReturn);

            // Assert
            A.CallTo(() => fakeDynamicContentExtensions.GetRelatedItems(A <DynamicContent> ._, A <string> ._, A <int> ._))
            .MustHaveHappened();
            A.CallTo(() => fakeRepository.Get(A <Expression <Func <DynamicContent, bool> > >
                                              .That.Matches(m => LinqExpressionsTestHelper.IsExpressionEqual(m, item => item.UrlName == urlName && item.Status == ContentLifecycleStatus.Live && item.Visible))))
            .MustHaveHappened();
        }
        private void SetupRepositoryCalls(DynamicContent dummyDynamicContent, bool skillAvailable)
        {
            A.CallTo(() => fakeSocMatrixRepository.Get(A <Expression <Func <DynamicContent, bool> > > ._))
            .Returns(skillAvailable ? dummyDynamicContent : null);

            A.CallTo(() => fakeFrameworkSkillRepository.Get(A <Expression <Func <DynamicContent, bool> > > ._))
            .Returns(dummyDynamicContent);

            A.CallTo(() => fakeSocCodeRepository.Get(A <Expression <Func <DynamicContent, bool> > > ._))
            .Returns(dummyDynamicContent);

            A.CallTo(() => fakeSocMatrixRepository.GetMaster(dummyDynamicContent)).Returns(dummyDynamicContent);
            A.CallTo(() => fakeSocMatrixRepository.GetTemp(dummyDynamicContent)).Returns(dummyDynamicContent);
            A.CallTo(() => fakeSocMatrixRepository.CheckinTemp(dummyDynamicContent)).Returns(dummyDynamicContent);
            A.CallTo(() => fakeSocMatrixRepository.Create()).Returns(dummyDynamicContent);
            A.CallTo(() => fakeSocMatrixRepository.Add(dummyDynamicContent)).DoesNothing();
            A.CallTo(() => fakeSocMatrixRepository.Publish(dummyDynamicContent, A <string> ._)).DoesNothing();
            A.CallTo(() => fakeSocMatrixRepository.Commit()).DoesNothing();
            A.CallTo(() => fakeSocMatrixRepository.CheckinTemp(dummyDynamicContent)).Returns(dummyDynamicContent);
            A.CallTo(() =>
                     fakeDynamicContentExtensions.SetFieldValue(dummyDynamicContent, A <string> ._, A <string> ._))
            .DoesNothing();
            A.CallTo(() =>
                     fakeDynamicContentExtensions.SetFieldValue(dummyDynamicContent, A <string> ._, A <Lstring> ._))
            .DoesNothing();
            A.CallTo(() =>
                     fakeDynamicContentExtensions.SetFieldValue(dummyDynamicContent, A <string> ._, A <decimal?> ._))
            .DoesNothing();
            A.CallTo(() =>
                     fakeDynamicContentExtensions.DeleteRelatedFieldValues(dummyDynamicContent, A <string> ._)).DoesNothing();
            A.CallTo(() =>
                     fakeDynamicContentExtensions.SetRelatedFieldValue(dummyDynamicContent, dummyDynamicContent, A <string> ._, A <float> ._)).DoesNothing();
            A.CallTo(() =>
                     fakeDynamicContentExtensions.DeleteRelatedFieldValues(dummyDynamicContent, A <string> ._)).DoesNothing();
        }
示例#8
0
        public void GetTemplateNameTest(string templateName, bool validTemplate)
        {
            //Assign
            var fakeEmailTemplateRepository = GetTestEmailTemplateRepository(validTemplate);

            //Act
            fakeEmailTemplateRepository.GetByTemplateName(templateName);

            //Assert
            A.CallTo(() => fakeRepository.Get(A <Expression <Func <DynamicContent, bool> > > ._)).MustHaveHappened();

            if (validTemplate)
            {
                A.CallTo(() => fakeEmailTemplateConverter.ConvertFrom(A <DynamicContent> ._)).MustHaveHappened();
            }
            else
            {
                A.CallTo(() => fakeEmailTemplateConverter.ConvertFrom(A <DynamicContent> ._)).MustNotHaveHappened();
            }
        }
 public IEnumerable <WhatItTakesSkill> GetContextualisedSkillsById(IEnumerable <string> relatedSkills)
 {
     if (relatedSkills != null)
     {
         foreach (var skillUrl in relatedSkills)
         {
             var relatedSkill = converter.ConvertFrom(repository.Get(item => item.UrlName == skillUrl && item.Status == ContentLifecycleStatus.Live && item.Visible == true));
             if (relatedSkill != null)
             {
                 yield return(relatedSkill);
             }
         }
     }
 }
        public void GetByUrlNameForPreviewTest()
        {
            var dummyJobProfile = A.Dummy <JobProfile>();

            A.CallTo(() => fakeJobProfileConverter.ConvertFrom(A <DynamicContent> ._)).Returns(dummyJobProfile);

            var jobProfileRepository = new JobProfileRepository(fakeRepository, fakeJobProfileConverter, fakeDynamicContentExtensions, fakeSocSkillRepo, fakeWitConverter, fakeJobProfileSearchConverter);

            jobProfileRepository.GetByUrlNameForPreview("testURLName");

            A.CallTo(() => fakeRepository.Get(A <Expression <Func <DynamicContent, bool> > > ._)).MustHaveHappened();
        }
        public void GetApprenticeVacanciesBySocCodeTest(bool validSoc)
        {
            //Assign
            var fakeRepo = GetTestJobProfileSocCodeRepository(validSoc);
            var socCode  = nameof(JobProfileSocCodeRepositoryTest);

            //Act
            var result = fakeRepo.GetApprenticeVacanciesBySocCode(socCode);

            //Assert
            if (validSoc)
            {
                result.Should().NotBeEmpty();
            }
            else
            {
                result.Should().BeEmpty();
            }

            A.CallTo(() => fakeDynamicContentExtensions.GetRelatedParentItems(A <DynamicContent> ._, A <string> ._, A <string> ._)).MustHaveHappened();

            A.CallTo(() => fakeRepository.Get(A <Expression <Func <DynamicContent, bool> > > .That.Matches(m => LinqExpressionsTestHelper.IsExpressionEqual(m, item => item.Visible && item.Status == ContentLifecycleStatus.Live && item.GetValue <string>(nameof(SocCode.SOCCode)) == socCode)))).MustHaveHappened();
        }
示例#12
0
        public StructuredDataInjection GetByJobProfileUrlName(string urlName)
        {
            var jobProfile = jobprofileRepository.Get(item => item.UrlName == urlName && item.Status == ContentLifecycleStatus.Live && item.Visible);

            if (jobProfile != null)
            {
                var structuredDataItems = dynamicContentExtensions.GetRelatedParentItems(jobProfile, DynamicTypes.StructuredDataInjectionContentType, structuredDataDynamicModuleRepository.GetProviderName());

                if (structuredDataItems.Any())
                {
                    var structuredDataItem = converter.ConvertFrom(structuredDataItems.First());
                    structuredDataItem.JobProfileLinkName = urlName;
                    return(structuredDataItem);
                }
            }

            return(null);
        }
        public RepoActionResult UpdateSocSkillMatrices(JobProfileOverloadForWhatItTakes jobProfile, IEnumerable <SocSkillMatrix> socSkillMatrices)
        {
            var jobprofile = repository.Get(item =>
                                            item.UrlName == jobProfile.UrlName && item.Status == ContentLifecycleStatus.Live && item.Visible);

            var skillMatrices = socSkillMatrices as IList <SocSkillMatrix> ?? socSkillMatrices.ToList();

            if (jobprofile != null && skillMatrices.Any())
            {
                var master = repository.GetMaster(jobprofile);

                dynamicContentExtensions.DeleteRelatedFieldValues(master, RelatedSkillField);

                float ordinal = 1;
                foreach (var socSkillMatrix in skillMatrices)
                {
                    var relatedSocSkillItem = socSkillRepository.Get(d => d.Status == ContentLifecycleStatus.Master && d.UrlName == socSkillMatrix.SfUrlName);

                    if (relatedSocSkillItem != null)
                    {
                        dynamicContentExtensions.SetRelatedFieldValue(master, relatedSocSkillItem, RelatedSkillField, socSkillMatrix.Rank.HasValue ? (float)socSkillMatrix.Rank.Value : ordinal);
                    }

                    ordinal++;
                }

                dynamicContentExtensions.SetFieldValue(master, nameof(JobProfile.DigitalSkillsLevel), jobProfile.DigitalSkillsLevel);

                repository.Commit();

                repository.Update(master, UpdateComment);

                repository.Commit();
            }

            return(new RepoActionResult {
                Success = true
            });
        }
        public RepoActionResult UpsertFrameworkSkill(FrameworkSkill onetSkill)
        {
            //CodeReview: Worth abstrating this out to a get by url
            var repoSkill = frameworkSkillRepository.Get(item =>
                                                         item.Visible && item.Status == ContentLifecycleStatus.Live && item.UrlName == onetSkill.SfUrlName);

            if (repoSkill != null)
            {
                var master = frameworkSkillRepository.GetMaster(repoSkill);
                var temp   = frameworkSkillRepository.GetTemp(master);

                dynamicContentExtensions.SetFieldValue(temp, nameof(FrameworkSkill.Description), onetSkill.Description);
                dynamicContentExtensions.SetFieldValue(temp, nameof(FrameworkSkill.ONetElementId), onetSkill.ONetElementId);

                var updatedMaster = frameworkSkillRepository.CheckinTemp(temp);
                frameworkSkillRepository.Publish(updatedMaster, UpdateComment);
                frameworkSkillRepository.Commit();
            }
            else
            {
                var newRepoSkill = frameworkSkillRepository.Create();
                newRepoSkill.UrlName = onetSkill.SfUrlName;

                dynamicContentExtensions.SetFieldValue(newRepoSkill, nameof(FrameworkSkill.Title), onetSkill.Title);
                dynamicContentExtensions.SetFieldValue(newRepoSkill, nameof(FrameworkSkill.Description), onetSkill.Description);
                dynamicContentExtensions.SetFieldValue(newRepoSkill, nameof(FrameworkSkill.ONetElementId), onetSkill.ONetElementId);

                frameworkSkillRepository.Add(newRepoSkill);
                frameworkSkillRepository.Commit();
            }

            return(new RepoActionResult
            {
                Success = true
            });
        }
        public IEnumerable <JobProfileRelatedCareer> GetByParentName(string urlName, int maximumItemsToReturn)
        {
            var jobProfile = jobprofileRepository.Get(item => item.UrlName == urlName && item.Status == ContentLifecycleStatus.Live && item.Visible);

            return(GetRelatedCareers(jobProfile, maximumItemsToReturn));
        }
        public void UpsertSocSkillMatrix(SocSkillMatrix socSkillMatrix)
        {
            var repoSocMatrix = socMatrixRepository.Get(item =>
                                                        item.Visible && item.Status == ContentLifecycleStatus.Live && item.UrlName == socSkillMatrix.SfUrlName);

            if (repoSocMatrix != null)
            {
                var master = socMatrixRepository.GetMaster(repoSocMatrix);

                if (!string.IsNullOrWhiteSpace(socSkillMatrix.ONetElementId))
                {
                    dynamicContentExtensions.DeleteRelatedFieldValues(master, RelatedSkillField);
                    var relatedSkillItem = frameworkSkillRepository.Get(d =>
                                                                        d.Status == ContentLifecycleStatus.Master &&
                                                                        d.GetValue <string>(nameof(FrameworkSkill.ONetElementId)) == socSkillMatrix.ONetElementId);
                    if (relatedSkillItem != null)
                    {
                        dynamicContentExtensions.SetRelatedFieldValue(master, relatedSkillItem, RelatedSkillField, 1);
                    }
                }

                if (!string.IsNullOrWhiteSpace(socSkillMatrix.SocCode))
                {
                    dynamicContentExtensions.DeleteRelatedFieldValues(master, RelatedSocField);
                    var relatedSocItem = socCodeRepository.Get(d =>
                                                               d.Status == ContentLifecycleStatus.Master &&
                                                               d.GetValue <string>(nameof(SocCode.SOCCode)) == socSkillMatrix.SocCode);
                    if (relatedSocItem != null)
                    {
                        dynamicContentExtensions.SetRelatedFieldValue(master, relatedSocItem, RelatedSocField, 1);
                    }
                }

                // Save related on live version
                socMatrixRepository.Commit();

                var temp = socMatrixRepository.GetTemp(master);

                dynamicContentExtensions.SetFieldValue(temp, nameof(SocSkillMatrix.Title), socSkillMatrix.Title);
                dynamicContentExtensions.SetFieldValue(temp, nameof(SocSkillMatrix.Contextualised), socSkillMatrix.Contextualised);
                dynamicContentExtensions.SetFieldValue(temp, nameof(SocSkillMatrix.ONetAttributeType), socSkillMatrix.ONetAttributeType);
                dynamicContentExtensions.SetFieldValue(temp, nameof(SocSkillMatrix.ONetRank), socSkillMatrix.ONetRank);
                dynamicContentExtensions.SetFieldValue(temp, nameof(SocSkillMatrix.Rank), socSkillMatrix.Rank);

                var updatedMaster = socMatrixRepository.CheckinTemp(temp);

                socMatrixRepository.Publish(updatedMaster, UpdateComment);
                socMatrixRepository.Commit();
            }
            else
            {
                var newSocMatrix = socMatrixRepository.Create();
                dynamicContentExtensions.SetFieldValue(newSocMatrix, UrlNameField, (Lstring)socSkillMatrix.SfUrlName);
                socMatrixRepository.Add(newSocMatrix);

                socMatrixRepository.Commit();
                var newlyCreated = socMatrixRepository.Get(item =>
                                                           item.Visible && item.Status == ContentLifecycleStatus.Live &&
                                                           item.UrlName == socSkillMatrix.SfUrlName);

                if (newlyCreated != null)
                {
                    UpsertSocSkillMatrix(socSkillMatrix);
                }
            }
        }
示例#17
0
 public EmailTemplate GetByTemplateName(string templateName)
 {
     return(ConvertDynamicContent(emailTemplateRepository.Get(item =>
                                                              item.UrlName == templateName && item.Status == ContentLifecycleStatus.Live && item.Visible)));
 }
        public void UpdateSocSkillMatricesTest(bool jobProfileAvailable)
        {
            // Arrange
            var urlname      = "test-url";
            var digitalSkill = "digiSkill";
            var jobProfile   = new JobProfileOverloadForWhatItTakes {
                UrlName = urlname, DigitalSkillsLevel = digitalSkill
            };
            var dummyDynamicContent = A.Dummy <DynamicContent>();
            var socSkill            = new SocSkillMatrix {
                Title = "test soc"
            };
            var socSkills = new List <SocSkillMatrix> {
                socSkill
            };

            // Fakes Setup
            A.CallTo(() => fakeRepository.Get(A <Expression <Func <DynamicContent, bool> > > ._))
            .Returns(jobProfileAvailable ? dummyDynamicContent : null);
            A.CallTo(() => fakeRepository.GetMaster(dummyDynamicContent)).Returns(dummyDynamicContent);
            A.CallTo(() => fakeRepository.Update(dummyDynamicContent, digitalSkill)).DoesNothing();
            A.CallTo(() => fakeRepository.Commit()).DoesNothing();
            A.CallTo(() =>
                     fakeDynamicContentExtensions.SetRelatedFieldValue(dummyDynamicContent, dummyDynamicContent, A <string> ._, A <float> ._)).DoesNothing();
            A.CallTo(() =>
                     fakeDynamicContentExtensions.DeleteRelatedFieldValues(dummyDynamicContent, A <string> ._)).DoesNothing();
            A.CallTo(() => fakeRepository.Get(A <Expression <Func <DynamicContent, bool> > > ._))
            .Returns(jobProfileAvailable ? dummyDynamicContent : null);
            A.CallTo(() => fakeSocSkillRepo.Get(A <Expression <Func <DynamicContent, bool> > > ._))
            .Returns(dummyDynamicContent);

            var jobProfileRepository = new JobProfileRepository(fakeRepository, fakeJobProfileConverter, fakeDynamicContentExtensions, fakeSocSkillRepo, fakeWitConverter, fakeJobProfileSearchConverter);

            // Act
            jobProfileRepository.UpdateSocSkillMatrices(jobProfile, socSkills);

            // Assert
            A.CallTo(() => fakeRepository.Get(A <Expression <Func <DynamicContent, bool> > > .That.Matches(m =>
                                                                                                           LinqExpressionsTestHelper.IsExpressionEqual(m, item => item.UrlName == jobProfile.UrlName && item.Status == ContentLifecycleStatus.Live &&
                                                                                                                                                       item.Visible))))
            .MustHaveHappened();

            if (jobProfileAvailable)
            {
                A.CallTo(() => fakeRepository.GetMaster(dummyDynamicContent)).MustHaveHappened();
                A.CallTo(() => fakeRepository.Update(dummyDynamicContent, A <string> ._)).MustHaveHappened();
                A.CallTo(() => fakeRepository.Commit()).MustHaveHappened();
                A.CallTo(() =>
                         fakeDynamicContentExtensions.SetRelatedFieldValue(A <DynamicContent> ._, A <DynamicContent> ._, "RelatedSkills", A <float> ._)).MustHaveHappened();
                A.CallTo(() =>
                         fakeDynamicContentExtensions.DeleteRelatedFieldValues(A <DynamicContent> ._, A <string> ._))
                .MustHaveHappened();
                A.CallTo(() => fakeSocSkillRepo.Get(A <Expression <Func <DynamicContent, bool> > > .That.Matches(m =>
                                                                                                                 LinqExpressionsTestHelper.IsExpressionEqual(m, d => d.Status == ContentLifecycleStatus.Master && d.UrlName == socSkill.SfUrlName)))).MustHaveHappened();
            }
            else
            {
                A.CallTo(() => fakeRepository.GetMaster(dummyDynamicContent)).MustNotHaveHappened();
                A.CallTo(() => fakeRepository.Update(dummyDynamicContent, A <string> ._)).MustNotHaveHappened();
                A.CallTo(() => fakeRepository.Commit()).MustNotHaveHappened();
                A.CallTo(() => fakeRepository.CheckinTemp(dummyDynamicContent)).MustNotHaveHappened();
                A.CallTo(() =>
                         fakeDynamicContentExtensions.SetRelatedFieldValue(A <DynamicContent> ._, A <DynamicContent> ._, A <string> ._, A <float> ._)).MustNotHaveHappened();
                A.CallTo(() =>
                         fakeDynamicContentExtensions.DeleteRelatedFieldValues(A <DynamicContent> ._, A <string> ._)).MustNotHaveHappened();
                A.CallTo(() => fakeSocSkillRepo.Get(A <Expression <Func <DynamicContent, bool> > > ._))
                .MustNotHaveHappened();
            }
        }