Пример #1
0
        public void ListWithNoGapWillRemainTheSame()
        {
            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.FillInGapsWith(year => new AnnualDecimal(year, 55));

            var enumerator = timeSeriesData.GetEnumerator();

            enumerator.Reset();
            enumerator.MoveNext();
            Assert.That(enumerator.Current, Is.EqualTo(new AnnualDecimal(10, 10)));
            enumerator.MoveNext();
            Assert.That(enumerator.Current, Is.EqualTo(new AnnualDecimal(11, 11)));
            enumerator.MoveNext();
            Assert.That(enumerator.Current, Is.EqualTo(new AnnualDecimal(12, 12)));
            enumerator.MoveNext();
            Assert.That(enumerator.Current, Is.EqualTo(new AnnualDecimal(13, 13)));
            enumerator.MoveNext();
            Assert.That(enumerator.Current, Is.EqualTo(new AnnualDecimal(14, 14)));
            enumerator.MoveNext();
            Assert.That(enumerator.Current, Is.EqualTo(new AnnualDecimal(15, 15)));
        }
Пример #2
0
        public void EmptyListHasNoGap()
        {
            var timeSeriesData = new TimeSeriesData <AnnualDecimal>();

            timeSeriesData.FillInGapsWith(year => new AnnualDecimal(year, 55));
            Assert.That(timeSeriesData.Count, Is.EqualTo(0));
        }
Пример #3
0
        public void GapsAreFilledInAndListSorted()
        {
            var timeSeriesData = new TimeSeriesData <AnnualDecimal>();

            timeSeriesData.AddRange(new[]
            {
                new AnnualDecimal(10, 99),
                new AnnualDecimal(13, 99),
                new AnnualDecimal(15, 99)
            });
            timeSeriesData.FillInGapsWith(year => new AnnualDecimal(year, 55));

            var enumerator = timeSeriesData.GetEnumerator();

            enumerator.Reset();
            enumerator.MoveNext();
            Assert.That(enumerator.Current, Is.EqualTo(new AnnualDecimal(10, 99)));
            enumerator.MoveNext();
            Assert.That(enumerator.Current, Is.EqualTo(new AnnualDecimal(11, 55)));
            enumerator.MoveNext();
            Assert.That(enumerator.Current, Is.EqualTo(new AnnualDecimal(12, 55)));
            enumerator.MoveNext();
            Assert.That(enumerator.Current, Is.EqualTo(new AnnualDecimal(13, 99)));
            enumerator.MoveNext();
            Assert.That(enumerator.Current, Is.EqualTo(new AnnualDecimal(14, 55)));
            enumerator.MoveNext();
            Assert.That(enumerator.Current, Is.EqualTo(new AnnualDecimal(15, 99)));
        }