public void TrimmingAnEmptyTimeSeriesData() { var timeSeriesData = new TimeSeriesData <AnnualDecimal>(); timeSeriesData.TrimNullData(); Assert.That(timeSeriesData.Count, Is.EqualTo(0)); }
public void ShouldOnlyTrimFromTheEnd() { var timeSeriesData = new TimeSeriesData <AnnualDecimal>(); timeSeriesData.AddRange(new[] { new AnnualDecimal(10, 10), new AnnualDecimal(11, 11), new AnnualDecimal(12, 12), new AnnualDecimal(13, 13), new AnnualDecimal(14, null), new AnnualDecimal(15, null) }); timeSeriesData.TrimNullData(); Assert.That(timeSeriesData.Count, Is.EqualTo(4)); Assert.That(timeSeriesData.GetYear(timeSeriesData.StartYear()), Is.EqualTo(new AnnualDecimal(10, 10))); Assert.That(timeSeriesData.GetYear(timeSeriesData.EndYear()), Is.EqualTo(new AnnualDecimal(13, 13))); }
public void ShouldNotRemoveNullValuesFromTheMiddle() { var timeSeriesData = new TimeSeriesData <AnnualDecimal>(); timeSeriesData.AddRange(new[] { new AnnualDecimal(10, 10), new AnnualDecimal(11, null), new AnnualDecimal(12, null), new AnnualDecimal(13, null), new AnnualDecimal(14, null), new AnnualDecimal(15, 15) }); timeSeriesData.TrimNullData(); Assert.That(timeSeriesData.Count, Is.EqualTo(6)); Assert.That(timeSeriesData.GetYear(timeSeriesData.StartYear()), Is.EqualTo(new AnnualDecimal(10, 10))); Assert.That(timeSeriesData.GetYear(timeSeriesData.EndYear()), Is.EqualTo(new AnnualDecimal(15, 15))); }
public void TrimmedNonNullDataWillReturnTheSameTimeSeries() { var timeSeriesData = new TimeSeriesData <AnnualDecimal>(); timeSeriesData.AddRange(new[] { new AnnualDecimal(10, 10), new AnnualDecimal(11, 11), new AnnualDecimal(12, 12), new AnnualDecimal(13, 13), new AnnualDecimal(14, 14), new AnnualDecimal(15, 15) }); timeSeriesData.TrimNullData(); Assert.That(timeSeriesData.Count, Is.EqualTo(6)); Assert.That(timeSeriesData.GetYear(timeSeriesData.StartYear()), Is.EqualTo(new AnnualDecimal(10, 10))); Assert.That(timeSeriesData.GetYear(timeSeriesData.EndYear()), Is.EqualTo(new AnnualDecimal(15, 15))); }