Esempio n. 1
0
 public void Build(StartAndEndPair[] startsAndEnds)
 {
     using (var builder = new TimeSeriesBuilder(FixedStep))
     {
         builder.Build(startsAndEnds, out _timestamps, out _values, out _highwater);
     }
 }
        public void TimeSeriesBuilder_BuildsVariableStepTimeSeries_FromSortedStartsAndEnds()
        {
            var starts = new DateTime[] { DateTime.Parse("22-08-2011 17:05:34.222"), DateTime.Parse("22-08-2011 17:07:34.222"), DateTime.Parse("22-08-2011 17:09:34.222") };
            var ends = new DateTime[] { DateTime.Parse("22-08-2011 17:06:34.222"), DateTime.Parse("22-08-2011 17:08:34.222"), DateTime.Parse("22-08-2011 17:15:34.222") };

            var t = new TimeSeriesBuilder(new TimeSpan(0, 5, 0));

            t.BuildVariableStepTimeSeries(starts, ends);

            Assert.AreEqual(6, t.VariableStepTimestamp.Count);

        }
        public void TimeSeriesBuilder_BuildsStartAndEndLists()
        {
            var startsAndEnds = new StartAndEndPair[]
                                    {
                                       new StartAndEndPair(
                                           DateTime.Parse("22-08-2011 17:05:34.222"), 
                                           DateTime.Parse("22-08-2011 17:06:34.222")),
                                       new StartAndEndPair(
                                           DateTime.Parse("22-08-2011 17:07:34.222"), 
                                           DateTime.Parse("22-08-2011 17:08:34.222"))
                                    };

            var t = new TimeSeriesBuilder(new TimeSpan(0, 5, 0));

            DateTime[] starts;
            DateTime[] ends;

            t.BuildSortedStartsAndEnds(startsAndEnds, out starts, out ends);

            Assert.AreEqual(2, starts.Length);
            Assert.AreEqual(DateTime.Parse("22-08-2011 17:05:34.222"), starts[0]);
            Assert.AreEqual(2, ends.Length);
            Assert.AreEqual(DateTime.Parse("22-08-2011 17:06:34.222"), ends[0]);
        }