コード例 #1
0
        public void ElasticityTest(TimeScale scale)
        {
            int      count = 1000;
            DateTime date  = scale.GetPrevDate(DateTime.Now);

            DateTime[] borders = new DateTime[count];
            for (int i = 0; i < count; i++)
            {
                borders[i] = date;
                date       = scale.GetNextDate(date);
            }
            for (int i = count - 1; i >= 0; i--)
            {
                DateTime prevDate = date;
                date = scale.GetPrevDate(prevDate);
                System.Diagnostics.Debug.Assert(date == borders[i], String.Format("step {0}: {1} = scale.GetPrevDate({2}). Expected {3}", i, date, prevDate, borders[i]));
            }
        }