public void Handle_WhenHandlingCommand_ThenShouldPublishEvents(ApprenticeshipEmployerType apprenticeshipEmployerType, bool isFundedByTransfer)
        {
            var f = new ProcessFullyApprovedCohortCommandFixture();

            f.SetApprenticeshipEmployerType(apprenticeshipEmployerType)
            .SetApprovedApprenticeships(isFundedByTransfer)
            .Handle();

            f.Apprenticeships.ForEach(
                a => f.EventPublisher.Verify(
                    p => p.Publish(It.Is <ApprenticeshipCreatedEvent>(
                                       e => f.IsValid(apprenticeshipEmployerType, a, e))),
                    Times.Once));
        }
        public void Handle_WhenHandlingCommand_ThenShouldProcessFullyApprovedCohort(ApprenticeshipEmployerType apprenticeshipEmployerType)
        {
            var f = new ProcessFullyApprovedCohortCommandFixture();

            f.SetApprenticeshipEmployerType(apprenticeshipEmployerType)
            .Handle();

            f.Db.Verify(d => d.ExecuteSqlCommandAsync(
                            "EXEC ProcessFullyApprovedCohort @cohortId, @accountId, @apprenticeshipEmployerType",
                            It.Is <SqlParameter>(p => p.ParameterName == "cohortId" && p.Value.Equals(f.Command.CohortId)),
                            It.Is <SqlParameter>(p => p.ParameterName == "accountId" && p.Value.Equals(f.Command.AccountId)),
                            It.Is <SqlParameter>(p => p.ParameterName == "apprenticeshipEmployerType" && p.Value.Equals(apprenticeshipEmployerType))),
                        Times.Once);
        }
        public void Handle_WhenHandlingCommand_WithChangeOfParty_ThenShouldPublishApprenticeshipWithChangeOfPartyCreatedEvents()
        {
            var f = new ProcessFullyApprovedCohortCommandFixture();

            f.SetChangeOfPartyRequest(true)
            .SetApprenticeshipEmployerType(ApprenticeshipEmployerType.NonLevy)
            .SetApprovedApprenticeships(false)
            .Handle();

            f.Apprenticeships.ForEach(
                a => f.EventPublisher.Verify(
                    p => p.Publish(It.Is <ApprenticeshipWithChangeOfPartyCreatedEvent>(
                                       e => f.IsValidChangeOfPartyEvent(a, e))),
                    Times.Once));
        }