/// <summary>
 /// Self-hosted сервис для обновления репозиториев
 /// </summary>
 public UpdateRepositoriesHostedService(
     IGitStatisticsService gitStatisticsService,
     IOptionsMonitor <RepositoriesConfig> repositoriesConfig)
 {
     _gitStatisticsService = gitStatisticsService;
     _repositoriesConfig   = repositoriesConfig.CurrentValue;
 }
        public void Setup()
        {
            _loggerMock = new LoggerMock();

            var statisticsConfigMonitorMock = new Mock <IOptionsMonitor <StatisticsConfig> >();

            statisticsConfigMonitorMock.Setup(cfg => cfg.CurrentValue).Returns(new StatisticsConfig {
                PeriodIntervalDays = 1
            });

            var repositoriesConfigMock = new Mock <IOptionsMonitor <RepositoriesConfig> >();

            repositoriesConfigMock.Setup(cfg => cfg.CurrentValue).Returns(new RepositoriesConfig
            {
                ReposFolder    = "C:\\Test.Repos",
                MergeUserName  = "******",
                MergeUserEmail = "*****@*****.**",
                ReposInfo      = new[]
                {
                    //new RepositoryInfoConfig
                    //{
                    //    Name = "AVTOKOD",
                    //    Url = "http://git.it2g.ru/avtokod/siv.avtokod.git",
                    //    LocalPath = "siv.avtokod",
                    //    Username = "",
                    //    Password = ""
                    //},
                    //new RepositoryInfoConfig
                    //{
                    //    Name = "NPA",
                    //    Url = "http://git.it2g.ru/npa/npa.git",
                    //    LocalPath = "npa",
                    //    Username = "",
                    //    Password = ""
                    //},
                    new RepositoryInfoConfig
                    {
                        Name      = "MMCSERV",
                        Url       = "http://git.it2g.ru/mmc/rvp-vnj.git",
                        LocalPath = "rvp-vnj",
                        Username  = "",
                        Password  = ""
                    }
                }
            });

            var workEstimateConfigMock = new Mock <IOptionsMonitor <WorkEstimateConfig> >();

            workEstimateConfigMock.Setup(cfg => cfg.CurrentValue).Returns(new WorkEstimateConfig
            {
                WorkDayHours = 8,
                PaddingHours = 2
            });

            _service = new GitStatisticsService(
                _loggerMock,
                statisticsConfigMonitorMock.Object,
                repositoriesConfigMock.Object,
                workEstimateConfigMock.Object);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Контроллер для раьоты со статистикой GIT репозиториев
 /// </summary>
 public StatisticsController(
     IGitStatisticsService gitStatisticsService,
     IMapper mapper,
     IMemoryCache cache)
 {
     _gitStatisticsService = gitStatisticsService;
     _mapper = mapper;
     _cache  = cache;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Контроллер для раьоты со статистикой GIT репозиториев
 /// </summary>
 public StatisticsController(
     IGitStatisticsService gitStatisticsService,
     GitElasticService gitElasticService,
     IMapper mapper)
 {
     _gitStatisticsService = gitStatisticsService;
     _gitElasticService    = gitElasticService;
     _mapper = mapper;
 }
        public void Setup()
        {
            _loggerMock = new LoggerMock();

            var builder              = GetConfig();
            var repoConfig           = builder.GetService <IOptionsMonitor <RepositoriesConfig> >();
            var statConfig           = builder.GetService <IOptionsMonitor <ElasticConfig> >();
            var estConfig            = builder.GetService <IOptionsMonitor <WorkEstimateConfig> >();
            var _gitlabServiceClient = MockGitlabSrvice();

            _service = new GitStatisticsService(_loggerMock, statConfig, repoConfig, estConfig, _gitlabServiceClient);
        }
Ejemplo n.º 6
0
 public GitElasticService(IOptionsMonitor <ElasticConfig> elasticConfig, IGitStatisticsService gitStatisticsService, ILogger <GitElasticService> logger)
 {
     _elasticConfig        = elasticConfig.CurrentValue;
     _gitStatisticsService = gitStatisticsService;
     _logger = logger;
 }