Пример #1
0
        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());
        }
Пример #2
0
        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());
        }