// the maximum number of time steps to put into the series
// The series of tests below is for ConvertBlobToListLimited and ConvertListToBlob.
// The tests take advantage of the fact that the methods are designed so that
// the series that is put into the BLOB must be identical to the series that
// comes out of the BLOB.
// This method is re-used by the actual test methods that follow.
public void ConvertBlobLimited(List<TimeSeriesValue> inList,
TSDateCalculator.TimeStepUnitCode timeStepUnit, short timeStepQuantity,
DateTime blobStartDate,
int nCutStart, // the number of time steps that the test will truncate from the start of the series
int nCutEnd, // the number of time steps that the test will truncate from the end of the series
int nMax)
{
TSLibrary tsLib = new TSLibrary();
List<TimeSeriesValue> outList = new List<TimeSeriesValue>();
int compressionCode;
byte[] blobData = tsLib.ConvertListToBlobWithChecksum(timeStepUnit, timeStepQuantity,
inList.Count, inList.First().Date, inList.Last().Date, inList,
new TSTrace { TraceNumber = 1 }, out compressionCode);
int ret = tsLib.ConvertBlobToListLimited(timeStepUnit, timeStepQuantity,
inList.Count, blobStartDate,
nMax, inList[nCutStart].Date, inList[inList.Count - nCutEnd - 1].Date,
blobData, ref outList, compressionCode);
// The return value of the function must match the number of items in the original list
Assert.AreEqual(ret, Math.Min(nMax, inList.Count - nCutStart - nCutEnd));
// the count in both lists must match
Assert.AreEqual(outList.Count, Math.Min(nMax, inList.Count - nCutStart - nCutEnd));
// now check each item in the two lists
Boolean AreEqual = true;
for (int i = 0; i < ret; i++)
{
if (outList[i].ValueEquals(inList[i + nCutStart]) == false)
AreEqual = false;
}
Assert.IsTrue(AreEqual);
}