public void WhenGettingDataFromAfterMaxDay_DefaultReturned() { var container = new DayData <int>(int.MinValue); container.GetData(nameof(this.WhenGettingDataFromAfterMaxDay_DefaultReturned), DateTime.MaxValue).Should().Be(int.MinValue); }
public void CanAddAndReceiveData() { var data = _randomizer.Next(); var date = DateTime.Now.AddDays(-1 * _randomizer.Next(1, 30)); var container = new DayData <int>(int.MinValue); container.AddDay(DATA_TYPE, date, data); container.GetData(DATA_TYPE, date).Should().Be(data); container.GetData(nameof(this.CanAddAndReceiveData), date).Should().Be(int.MinValue); var missingDate = DateTime.Now.AddDays(-1 * _randomizer.Next(31, 60)); container.GetData(DATA_TYPE, missingDate).Should().Be(int.MinValue); }
public void WhenGettingDataFromBeyondLastDay_DefaultReturned() { var container = new DayData <int>(int.MinValue); container.AddDay(nameof(this.WhenGettingDataFromBeyondLastDay_DefaultReturned), DateTime.Today.AddDays(-5), 1); container.GetData(nameof(this.WhenGettingDataFromBeyondLastDay_DefaultReturned), DateTime.Today) .Should() .Be(int.MinValue); }
public int GetData(string dataType, DateTime date) { if (_shortData.ContainsDataForDate(dataType, date)) { return(_shortData.GetData(dataType, date)); } if (_intData.ContainsDataForDate(dataType, date)) { return(_intData.GetData(dataType, date)); } return(int.MinValue); }