Пример #1
0
        public void When_LastCheckedDate_IsOutOfDate_ReturnFalse()
        {
            var date = DateTimeOffset.Now.AddDays(366);

            var result = LmiHelper.IsOutOfDate(date, 365);

            result.Should().BeFalse();
        }
        internal async Task <JobGrowth> CheckCachedLmiData(int socCode)
        {
            if (socCode <= 0)
            {
                return(JobGrowth.Undefined);
            }

            var result = await _cosmosService.ReadItemAsync(id : socCode.ToString(), String.Empty, CosmosCollection.LmiData);

            if (result.IsSuccessStatusCode)
            {
                var lmiData     = JsonConvert.DeserializeObject <CachedLmiData>(await result.Content.ReadAsStringAsync());
                var isOutOfDate = LmiHelper.IsOutOfDate(lmiData.DateWritten, _lmiSettings.Value.CacheLifespan);
                if (!isOutOfDate)
                {
                    return(lmiData.JobGrowth);
                }
            }

            return(JobGrowth.Undefined);
        }