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)); }
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); }
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); }
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); })); }