public void GapFillTest() { TimeStampSeries target = new TimeStampSeries(); // TODO: Initialize to an appropriate value for (int i = 1; i < 5; i++) { target.Items.Add(new TimeStampValue(new DateTime(2000, i, 1), i)); } target.Items.Add(new TimeStampValue(new DateTime(2000, 9, 1), 9)); Assert.AreEqual(5, target.Items.Count); target.GapFill(InterpolationMethods.DeleteValue); Assert.AreEqual(9, target.Items.Count); target.Items.Add(new TimeStampValue(new DateTime(2002, 9, 1), 9)); target.GapFill(InterpolationMethods.DeleteValue); for (int i = 1; i < target.Items.Count; i++) { Assert.IsTrue(TSTools.GetTimeStep(target.Items[i - 1].Time, target.Items[i].Time) == TimeStepUnit.Month); } Assert.AreEqual(33, target.Items.Count); }
public void GetTimeStepTest() { DateTime Start = new DateTime(2000, 1, 1); Assert.IsTrue(TimeStepUnit.Second == TSTools.GetTimeStep(Start, new DateTime(2000, 1, 1, 0, 0, 1))); Assert.IsTrue(TimeStepUnit.Minute == TSTools.GetTimeStep(Start, new DateTime(2000, 1, 1, 0, 1, 0))); Assert.IsTrue(TimeStepUnit.Hour == TSTools.GetTimeStep(Start, new DateTime(2000, 1, 1, 1, 0, 0))); Assert.IsTrue(TimeStepUnit.Day == TSTools.GetTimeStep(Start, new DateTime(2000, 1, 2, 0, 0, 0))); Assert.IsTrue(TimeStepUnit.Month == TSTools.GetTimeStep(Start, new DateTime(2000, 2, 1, 0, 0, 0))); Assert.IsTrue(TimeStepUnit.Year == TSTools.GetTimeStep(Start, new DateTime(2001, 1, 1, 0, 0, 0))); }