private static FundingTemplateService CreateFundingTemplateService(
            ILogger logger = null,
            IFundingTemplateRepository fundingTemplateRepository = null,
            IFundingTemplateValidationService fundingTemplateValidationService = null,
            ICacheProvider cacheProvider = null,
            ITemplateMetadataResolver templateMetadataResolver = null,
            ITemplateBuilderService templateBuilderService     = null,
            IMapper mapper = null)
        {
            if (mapper == null)
            {
                MapperConfiguration fundingConfMappingConfig = new MapperConfiguration(c =>
                {
                    c.AddProfile <FundingConfigurationMappingProfile>();
                });

                mapper = fundingConfMappingConfig.CreateMapper();
            }

            return(new FundingTemplateService(
                       logger ?? CreateLogger(),
                       fundingTemplateRepository ?? CreateFundingTemplateRepository(),
                       PolicyResiliencePoliciesTestHelper.GenerateTestPolicies(),
                       fundingTemplateValidationService ?? CreateFundingTemplateValidationService(),
                       cacheProvider ?? CreateCacheProvider(),
                       templateMetadataResolver ?? CreateMetadataResolver(),
                       templateBuilderService ?? CreateTemplateBuilderService(),
                       mapper
                       ));
        }
 private static FundingDateService CreateFundingDateService(
     IPolicyRepository policyRepository = null,
     ILogger logger = null,
     IValidator <FundingDate> validator = null,
     IMapper mapper = null)
 {
     return(new FundingDateService(
                policyRepository ?? CreatePolicyRepository(),
                PolicyResiliencePoliciesTestHelper.GenerateTestPolicies(),
                logger ?? CreateLogger(),
                validator ?? CreateValidator(),
                mapper ?? CreateMapper()));
 }