public void GetSocSkillMatricesTest(bool skillsAvailable)
        {
            //Arrange
            var dummySkill          = A.Dummy <SocSkillMatrix>();
            var dummyDynamicContent = A.Dummy <DynamicContent>();

            // Dummies and fakes
            A.CallTo(() => fakeSocSkillConverter.ConvertFrom(dummyDynamicContent)).Returns(dummySkill);
            A.CallTo(() => fakeSocMatrixRepository.GetMany(A <Expression <Func <DynamicContent, bool> > > ._)).Returns(new EnumerableQuery <DynamicContent>(new List <DynamicContent> {
                skillsAvailable?dummyDynamicContent: null
            }));

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

            // Act
            socSkillMatrixRepository.GetSocSkillMatrices();

            // Assert

            // Needs investigation as fake convertor not registering call made to it when there is a soc skill available.
            //if (skillsAvailable)
            //{
            //    A.CallTo(() => fakeFrameworkSkillConverter.ConvertFrom(A<DynamicContent>._)).MustHaveHappened();
            //}
            //else
            //{
            //    A.CallTo(() => fakeFrameworkSkillConverter.ConvertFrom(A<DynamicContent>._)).MustNotHaveHappened();
            //}
            A.CallTo(() => fakeSocMatrixRepository.GetMany(A <Expression <Func <DynamicContent, bool> > > .That.Matches(m => LinqExpressionsTestHelper.IsExpressionEqual(m, item => item.Visible && item.Status == ContentLifecycleStatus.Live)))).MustHaveHappened();
        }
        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();
            }
        }