Пример #1
0
        public void Init()
        {
            _fixture = new Fixture();

            _mapper = AutoMapperInitializer.Initialize(AutoMapperConfig.SetupAutoMapper);

            _mockAuditEventRepository        = new Mock <IAuditEventRepository>();
            _mockAutopilotRuleRepository     = new Mock <IAutopilotRuleRepository>();
            _mockAutopilotSettingsRepository = new Mock <IAutopilotSettingsRepository>();

            _ = _mockAutopilotRuleRepository.Setup(r => r.GetByFlexibilityLevelId(1)).Returns(CreateValidAutopilotRules());
            _ = _mockAutopilotSettingsRepository.Setup(r => r.GetDefault()).Returns(BuildAutopilotSettings());

            _autopilotManager =
                new AutopilotManager(_mockAuditEventRepository.Object, _mockAutopilotSettingsRepository.Object, _mockAutopilotRuleRepository.Object, _mapper);
        }
Пример #2
0
        public void Init()
        {
            _fixture = new Fixture();

            _mapper = AutoMapperInitializer.Initialize(AutoMapperConfig.SetupAutoMapper);

            _runId       = Guid.NewGuid();
            _scenarioId1 = Guid.NewGuid();
            _scenarioId2 = Guid.NewGuid();
            _scenario1   = new Mock <RunScenario>();
            _scenario2   = new Mock <RunScenario>();

            _fakeConfiguration                     = new Mock <IConfiguration>();
            _fakeScenarioResultRepository          = new Mock <IScenarioResultRepository>();
            _fakeRunRepository                     = new Mock <IRunRepository>();
            _fakeTenantSettingsRepository          = new Mock <ITenantSettingsRepository>();
            _fakeSalesAreaRepository               = new Mock <ISalesAreaRepository>();
            _fakeCampaignRepository                = new Mock <ICampaignRepository>();
            _fakeISRSettingsRepository             = new Mock <IISRSettingsRepository>();
            _fakeRSSettingsRepository              = new Mock <IRSSettingsRepository>();
            _fakeISRGlobalSettingsRepository       = new Mock <IISRGlobalSettingsRepository>();
            _fakeRSGlobalSettingsRepository        = new Mock <IRSGlobalSettingsRepository>();
            _fakeRepositoryFactory                 = new Mock <IRepositoryFactory>();
            _fakeSmoothFailureRepository           = new Mock <ISmoothFailureRepository>();
            _fakeSmoothFailureMessageRepository    = new Mock <ISmoothFailureMessageRepository>();
            _fakeDemographicRepository             = new Mock <IDemographicRepository>();
            _fakeAuditEventRepository              = new Mock <AuditEvents.IAuditEventRepository>();
            _fakeServicesIdentityGeneratorResolver = new Mock <IIdentityGeneratorResolver>();
            _fakeRunManager = new Mock <RunManagement.IRunManager>();
            _fakeKPIComparisonConfigRepository = new Mock <IKPIComparisonConfigRepository>();
            _fakeScenarioRepository            = new Mock <IScenarioRepository>();
            _fakePassRepository = new Mock <IPassRepository>();
            _fakeEfficiencySettingsRepository = new Mock <IEfficiencySettingsRepository>();
            _fakeFunctionalAreaRepository     = new Mock <IFunctionalAreaRepository>();
            _fakeFlexibilityLevelRepository   = new Mock <IFlexibilityLevelRepository>();
            _fakeAutopilotRuleRepository      = new Mock <IAutopilotRuleRepository>();
            _fakeAutopilotSettingsRepository  = new Mock <IAutopilotSettingsRepository>();
            _fakeExcelReportGenerator         = new Mock <IExcelReportGenerator>();
            _fakeRunReportDataAdapter         = new Mock <IRunExcelReportDataAdapter>();
            _fakeBackgroundJobManager         = new Mock <IBackgroundJobManager>();
            _fakeTenantIdentifier             = new Mock <TenantIdentifier>(new object[] { 0, "" });
            _fakeSynchronizationService       = new Mock <ISynchronizationService>();
            _fakeLandmarkRunService           = new Mock <ILandmarkRunService>();
            _scenarioCampaignMetricRepository = new Mock <IScenarioCampaignMetricRepository>();
            _fakeFeatureManager          = new Mock <IFeatureManager>();
            _fakeRunsValidator           = new Mock <IRunsValidator>();
            _fakeAnalysisGroupRepository = new Mock <IAnalysisGroupRepository>();
            _fakeRunTypeRepository       = new Mock <IRunTypeRepository>();
            _fakeUsersRepository         = new Mock <IUsersRepository>();
            _fakePassInspectorService    = new Mock <IPassInspectorService>();
            _fakeFacilityRepository      = new Mock <IFacilityRepository>();

            _ = _scenario1.Setup(x => x.Id).Returns(_scenarioId1);
            _ = _scenario1.Setup(x => x.Status).Returns(ScenarioStatuses.CompletedSuccess);
            _ = _scenario2.Setup(x => x.Id).Returns(_scenarioId2);
            _ = _scenario2.Setup(x => x.Status).Returns(ScenarioStatuses.CompletedSuccess);

            _kpiName  = "KPI1";
            _kpi2Name = "KPI2";
            _fakeRun  = new Mock <Run>();

            _autopilotManager =
                new AutopilotManager(_fakeAuditEventRepository.Object, _fakeAutopilotSettingsRepository.Object, _fakeAutopilotRuleRepository.Object, _mapper);
            _autopilotEngageModelValidator =
                new AutopilotEngageModelValidator(new AutopilotEngageModelValidation(_fakeFlexibilityLevelRepository.Object));
            _landmarkRunTriggerModelValidator   = new LandmarkRunTriggerModelValidator(new LandmarkRunTriggerModelValidation(_fakeRunRepository.Object));
            _scheduledRunSettingsModelValidator = new ScheduledRunSettingsModelValidator(new ScheduledRunSettingsModelValidation());

            _controller = new RunsController(
                _fakeConfiguration.Object,
                _fakeRunRepository.Object,
                _fakeTenantSettingsRepository.Object,
                _fakeSalesAreaRepository.Object,
                _fakeCampaignRepository.Object,
                _fakeISRSettingsRepository.Object,
                _fakeRSSettingsRepository.Object,
                _fakeRepositoryFactory.Object,
                _fakeEfficiencySettingsRepository.Object,
                _fakeSmoothFailureRepository.Object,
                _fakeDemographicRepository.Object,
                _fakeAuditEventRepository.Object,
                _autopilotManager,
                _fakeServicesIdentityGeneratorResolver.Object,
                _fakeRunManager.Object,
                _mapper,
                _autopilotEngageModelValidator,
                _fakeKPIComparisonConfigRepository.Object,
                _fakeScenarioResultRepository.Object,
                _fakeScenarioRepository.Object,
                _fakePassRepository.Object,
                _fakeFunctionalAreaRepository.Object,
                _fakeExcelReportGenerator.Object,
                _fakeRunReportDataAdapter.Object,
                _fakeISRGlobalSettingsRepository.Object,
                _fakeRSGlobalSettingsRepository.Object,
                _fakeSmoothFailureMessageRepository.Object,
                _fakeBackgroundJobManager.Object,
                _fakeTenantIdentifier.Object,
                _fakeSynchronizationService.Object,
                _fakeLandmarkRunService.Object,
                _landmarkRunTriggerModelValidator,
                _scheduledRunSettingsModelValidator,
                _scenarioCampaignMetricRepository.Object,
                _fakeFeatureManager.Object,
                _fakeRunsValidator.Object,
                _fakeAnalysisGroupRepository.Object,
                _fakeRunTypeRepository.Object,
                _fakeUsersRepository.Object,
                _fakePassInspectorService.Object,
                _fakeFacilityRepository.Object
                );
        }