private CampaignsController CreateCampaignController(
            Mock <IDataChangeValidator> mockDataChangeValidator,
            Mock <IRecommendationRepository> mockRecommendationRepository,
            Mock <IDemographicRepository> mockDemographicRepository,
            Mock <ICampaignRepository> mockCampaignRepository,
            Mock <IProgrammeCategoryHierarchyRepository> mockProgrammeCategoryRepository,
            Mock <ISalesAreaRepository> mockSalesAreaRepository,
            Mock <IProductRepository> mockProductRepository,
            Mock <ICampaignExcelReportGenerator> mockCampaignExportReportGenerator,
            Mock <IReportColumnFormatter> mockReportColumnFormatter,
            Mock <IFeatureManager> mockFeatureManager,
            Mock <ICampaignCleaner> mockCampaignCleaner,
            Mock <ICampaignPassPrioritiesService> mockCampaignPassPrioritiesService)
        {
            var flattener = new CampaignFlattener(mockProductRepository.Object, mockDemographicRepository.Object,
                                                  null, _mapper);

            return(new CampaignsController(mockCampaignRepository.Object,
                                           mockRecommendationRepository.Object, mockDataChangeValidator.Object,
                                           _mapper, mockDemographicRepository.Object,
                                           mockSalesAreaRepository.Object, mockProductRepository.Object,
                                           mockCampaignExportReportGenerator.Object, mockReportColumnFormatter.Object,
                                           null, null, mockProgrammeCategoryRepository.Object, mockFeatureManager.Object,
                                           flattener, mockCampaignCleaner.Object, mockCampaignPassPrioritiesService.Object));
        }
        public async Task OnInit()
        {
            AssumeDependenciesAreMocked();
            AssumeDependenciesAreSupplied();

            _mapper            = AutoMapperInitializer.Initialize(expression => expression.AddProfile <CampaignProfile>());
            _campaignFlattener = new CampaignFlattener(_mockProductRepository.Object, _mockDemographicRepository.Object,
                                                       _mockClashRepository.Object, _mapper);
            _controller = new CampaignsController(_mockCampaignRepository.Object, null, null, _mapper,
                                                  _mockDemographicRepository.Object, null, _mockProductRepository.Object,
                                                  null, null, null, _mockClashRepository.Object, null, null,
                                                  _campaignFlattener, _mockCampaignCleaner.Object, null);
        }
예제 #3
0
        private void AssumeTargetIsInitialised()
        {
            var flattener = new CampaignFlattener(ProductRepository.Object, DemographicRepository.Object,
                                                  null, Mapper);
            var campaignPassPrioritiesService = new CampaignPassPrioritiesService(
                CampaignRepository.Object,
                Mapper,
                PassRepository.Object,
                ScenarioRepository.Object);

            Target = new CampaignsController(CampaignRepository.Object, null, null,
                                             Mapper, DemographicRepository.Object,
                                             SalesAreaRepository.Object, ProductRepository.Object,
                                             CampaignExcelReportGenerator.Object, ReportColumnFormatter.Object,
                                             null, null, ProgrammeCategoryRepository.Object, FeatureManager.Object,
                                             flattener, CampaignCleaner.Object, campaignPassPrioritiesService);
        }
예제 #4
0
        public void Init()
        {
            _campaigns = CreateValidCampaignObjectList();

            _mapper = new Mapper(new MapperConfiguration(expression => expression.AddProfile <CampaignProfile>()));

            _mockCampaignRepository          = new Mock <ICampaignRepository>();
            _mockDemographicRepository       = new Mock <IDemographicRepository>();
            _mockRecommendationRepository    = new Mock <IRecommendationRepository>();
            _mockMetadataRepository          = new Mock <IMetadataRepository>();
            _mockProgrammeCategoryRepository = new Mock <IProgrammeCategoryHierarchyRepository>();
            _mockSalesAreaRepository         = new Mock <ISalesAreaRepository>();
            _mockProductRepository           = new Mock <IProductRepository>();
            _mockDataChangeValidator         = new Mock <IDataChangeValidator>();
            _mockCampaignExcelGenerator      = new Mock <ICampaignExcelReportGenerator>();
            _mockReportColumnFormatter       = new Mock <IReportColumnFormatter>();
            _mockFeatureManager  = new Mock <IFeatureManager>();
            _mockCampaignCleaner = new Mock <ICampaignCleaner>();

            _ = _mockFeatureManager
                .Setup(p => p.IsEnabled(It.Is <string>(e => e == nameof(ProductFeature.IncludeChannelGroupFileForOptimiser))))
                .Returns(true);

            var flattener = new CampaignFlattener(
                _mockProductRepository.Object,
                _mockDemographicRepository.Object,
                null,
                _mapper);

            _controller = new CampaignsController(
                null,
                null,
                null,
                null,
                _mockDemographicRepository.Object,
                _mockSalesAreaRepository.Object,
                _mockProductRepository.Object,
                _mockCampaignExcelGenerator.Object,
                _mockReportColumnFormatter.Object,
                null,
                null,
                _mockProgrammeCategoryRepository.Object,
                _mockFeatureManager.Object,
                flattener,
                _mockCampaignCleaner.Object,
                null);

            _controllerToValidatePut = new CampaignsController(
                _mockCampaignRepository.Object,
                _mockRecommendationRepository.Object,
                _mockDataChangeValidator.Object,
                _mapper,
                _mockDemographicRepository.Object,
                _mockSalesAreaRepository.Object,
                _mockProductRepository.Object,
                _mockCampaignExcelGenerator.Object,
                _mockReportColumnFormatter.Object,
                null,
                null,
                _mockProgrammeCategoryRepository.Object,
                _mockFeatureManager.Object,
                flattener,
                _mockCampaignCleaner.Object,
                null);

            _fixture = new SafeFixture();
        }