public void StartAndEndYearShouldFailWhenTimeSeriesEmpty() { var timeSeriesData = new TimeSeriesData <AnnualDecimal>(); Assert.That(timeSeriesData.IsNotEmpty(), Is.False); Assert.Throws <InvalidOperationException>(() => timeSeriesData.StartYear()); Assert.Throws <InvalidOperationException>(() => timeSeriesData.EndYear()); Assert.Throws <InvalidOperationException>(() => timeSeriesData.StartYearOfNonZeroValue()); Assert.Throws <InvalidOperationException>(() => timeSeriesData.EndYearOfNonZeroValue()); }
public void StartAndEndYearShouldFailWhenTimeSeriesIsAllZero() { var timeSeriesData = new TimeSeriesData <AnnualDecimal>(); timeSeriesData.Add(new AnnualDecimal(10, 0)); timeSeriesData.Add(new AnnualDecimal(20, 0)); Assert.That(timeSeriesData.IsNotEmpty(), Is.True); Assert.That(timeSeriesData.StartYear(), Is.EqualTo(10)); Assert.That(timeSeriesData.EndYear(), Is.EqualTo(20)); Assert.Throws <InvalidOperationException>(() => timeSeriesData.StartYearOfNonZeroValue()); Assert.Throws <InvalidOperationException>(() => timeSeriesData.EndYearOfNonZeroValue()); }