public virtual void TestDoubleSetToStart() { InsertDefaultEntryByIndex(0); ITimeSeriesEntryCursor cursor = CreateCursor(); cursor.SetToStart(); Assert.IsNull(cursor.Current); Assert.IsTrue(cursor.MoveNext()); ITimeSeriesEntry entry = cursor.Current; cursor.SetToStart(); Assert.IsTrue(cursor.MoveNext()); Assert.IsTrue(TimeSeriesComparisons.CompareTimeSeriesEntry(entry, cursor.Current)); }
public virtual void TestCurrentForIEnumerator() { ITimeSeriesEntryCursor cursor = CreateCursor(); InsertAllDefaultEntries(); // get an IEnumerator over a time series IEnumerator enumerator = cursor; // check that it can move and retrieve an entry Assert.IsTrue(enumerator.MoveNext()); ITimeSeriesEntry timeSeriesEntry1 = (ITimeSeriesEntry)enumerator.Current; Assert.IsNotNull(timeSeriesEntry1); // check that the IEnumerator is a correct Cursor ITimeSeriesEntryCursor timeSeriesEntryCursor = enumerator as ITimeSeriesEntryCursor; Assert.IsNotNull(timeSeriesEntryCursor); Assert.IsNotNull(timeSeriesEntryCursor.Current); // check that the corresponding cursor gets the same entry ITimeSeriesEntry timeSeriesEntry2 = timeSeriesEntryCursor.Current; Assert.IsTrue(TimeSeriesComparisons.CompareTimeSeriesEntry(timeSeriesEntry1, timeSeriesEntry2)); // and that it is the same entry as retrieving it from a native cursor cursor.SetToStart(); cursor.MoveNext(); ITimeSeriesEntry timeSeriesEntry3 = cursor.Current; Assert.IsTrue(TimeSeriesComparisons.CompareTimeSeriesEntry(timeSeriesEntry2, timeSeriesEntry3)); }
public void TestSetToStartAtMinValue() { InsertDefaultEntryByTimeStamp(MinimumTimeStamp); ITimeSeriesEntryCursor cursor = CreateCursor(); cursor.SetToStart(); Assert.IsNull(cursor.Current); Assert.IsTrue(cursor.MoveNext()); CheckEntry(cursor.Current); }
public virtual void TestWalkingMilesBeforeBegin() { ITimeSeriesEntryCursor cursor = CreateCursor(); InsertDefaultEntryByIndex(0); cursor.SetToStart(); Assert.IsNull(cursor.Current); // you cannot reach a valid entry before the beginning for (int i = 1; i < 20; ++i) { Assert.IsFalse(cursor.MovePrevious()); } // one step must be enough to get to the first entry Assert.IsTrue(cursor.MoveNext()); Assert.IsNotNull(cursor.Current); }
public virtual void TestCurrentBeforeStartOrBehindEnd() { ITimeSeriesEntryCursor cursor = CreateCursor(); InsertAllDefaultEntries(); cursor.SetToStart(); Assert.IsNull(cursor.Current); ITimeSeriesEntry timeSeriesEntry = cursor.Current; Assert.IsNull(timeSeriesEntry); cursor.SetToEnd(); Assert.IsNull(cursor.Current); timeSeriesEntry = cursor.Current; Assert.IsNull(timeSeriesEntry); }