コード例 #1
0
        public async Task <IActionResult> GetRepositoriesWorkEstimate(DateTimeOffset startDate, DateTimeOffset endDate)
        {
            var estimates = await _gitStatisticsService.GetWorkSessionsEstimate(startDate, endDate);

            var result = _mapper.Map <IEnumerable <RepositoryWorkEstimateContract> >(estimates);

            return(Ok(result));
        }
コード例 #2
0
        public async Task GetWorkSessionsEstimate_Test()
        {
            //Arrange
            //var startDate = DateTime.Now.AddYears(-10);
            //var startDate = new DateTime(2000, 1, 28);
            var startDate = DateTime.Now.AddMonths(-1);
            var endDate   = DateTime.Now;

            //Act
            var result = await _service.GetWorkSessionsEstimate(startDate, endDate);
        }
コード例 #3
0
        public async Task GetWorkSessionsEstimate_Test()
        {
            // Arrange
            var startDate = DateTime.Now.AddMonths(-1);
            var endDate   = DateTime.Now;

            // Act
            var result = await _service.GetWorkSessionsEstimate(startDate, endDate);

            // Assert
            Assert.IsTrue(result.Count() > 0);
        }
コード例 #4
0
        public async Task <IActionResult> GetRepositoriesWorkEstimate(DateTimeOffset startDate, DateTimeOffset endDate)
        {
            return(await _cache.GetOrCreateAsync("estimates" + startDate.DateTime.ToShortDateString() + "/" + endDate.DateTime.ToShortDateString(),
                                                 async cacheEntry =>
            {
                cacheEntry.SlidingExpiration = TimeSpan.FromSeconds(TIMEOUT_SECONDS);

                var estimates = await _gitStatisticsService.GetWorkSessionsEstimate(startDate, endDate);
                var result = _mapper.Map <IEnumerable <RepositoryWorkEstimateContract> >(estimates);

                return Ok(result);
            }));
        }