Beispiel #1
0
        public void ReadDatesValuesRegular()
        {
            DateTime startDate     = DateTime.Parse("1/10/1996");
            DateTime endDate       = DateTime.Parse("2/10/2002");
            int      timeStepCount = 70;

            TSDateCalculator.TimeStepUnitCode timeStepUnit = TSDateCalculator.TimeStepUnitCode.Hour;
            short timeStepQuantity = 6;
            int   id, traceNumber = 13;

            String extraParamNames  = "TimeSeriesType, Unit_Id, RunGUID, VariableType, VariableName, RunElementGUID";
            String extraParamValues = "0, 1, 'A0101010-AAAA-BBBB-2222-3E3E3E3E3E3E', 0, 'eraseme', '00000000-0000-0000-0000-000000000000'";

            id = _lib.WriteParametersRegular(_connxNumber, GetSbyte(_paramTableName), GetSbyte(_traceTableName),
                                             (short)timeStepUnit, timeStepQuantity, timeStepCount, startDate,
                                             GetSbyte(extraParamNames), GetSbyte(extraParamValues));

            double[]            valArray     = new double[timeStepCount];
            TSDateValueStruct[] dateValArray = new TSDateValueStruct[timeStepCount],
            testDateValArray = new TSDateValueStruct[timeStepCount];
            double   x       = 5.25;
            DateTime curDate = startDate;

            for (int i = 0; i < timeStepCount; i++)
            {
                valArray[i]           = x;
                dateValArray[i].Value = x;
                dateValArray[i].Date  = curDate;
                x      += 1.75;
                curDate = TSDateCalculator.IncrementDate(curDate, timeStepUnit, timeStepQuantity, 1);
            }
            _lib.WriteTraceRegular(_connxNumber, GetSbyte(_paramTableName), GetSbyte(_traceTableName),
                                   id, traceNumber, valArray);
            _lib.CommitTraceWrites(_connxNumber, GetSbyte(_paramTableName), GetSbyte(_traceTableName));

            // The method being tested
            _lib.ReadDatesValues(_connxNumber, GetSbyte(_paramTableName), GetSbyte(_traceTableName),
                                 id, traceNumber, timeStepCount, ref testDateValArray, startDate, endDate);

            //
            for (int i = 0; i < timeStepCount; i++)
            {
                Assert.AreEqual(dateValArray[i], testDateValArray[i]);
            }
        }
Beispiel #2
0
        public void ReadValuesRegular()
        {
            DateTime startDate = DateTime.Parse("2/10/2000");
            int      timeStepCount = 40;
            short    timeStepUnit = (short)TSDateCalculator.TimeStepUnitCode.Day;
            short    timeStepQuantity = 2;
            int      id, traceNumber = 27;

            String extraParamNames  = "TimeSeriesType, Unit_Id, RunGUID, VariableType, VariableName, RunElementGUID";
            String extraParamValues = "0, 1, 'A0101010-AAAA-BBBB-2222-3E3E3E3E3E3E', 0, 'eraseme', '00000000-0000-0000-0000-000000000000'";

            id = _lib.WriteParametersRegular(_connxNumber, GetSbyte(_paramTableName), GetSbyte(_traceTableName),
                                             timeStepUnit, timeStepQuantity, timeStepCount, startDate, GetSbyte(extraParamNames), GetSbyte(extraParamValues));

            double[] valArray = new double[timeStepCount], testValArray = new double[timeStepCount];
            double   x        = 10.0;

            for (int i = 0; i < timeStepCount; i++)
            {
                valArray[i] = x;
                x          *= 1.2;
            }
            DateTime endDate = TSDateCalculator.IncrementDate(startDate, (TSDateCalculator.TimeStepUnitCode)timeStepUnit,
                                                              timeStepQuantity, timeStepCount - 1);

            _lib.WriteTraceRegular(_connxNumber, GetSbyte(_paramTableName), GetSbyte(_traceTableName),
                                   id, traceNumber, valArray);
            _lib.CommitTraceWrites(_connxNumber, GetSbyte(_paramTableName), GetSbyte(_traceTableName));

            // The method being tested
            _lib.ReadValuesRegular(_connxNumber, GetSbyte(_paramTableName), GetSbyte(_traceTableName),
                                   id, traceNumber, timeStepCount, testValArray, startDate, endDate);

            //
            for (int i = 0; i < timeStepCount; i++)
            {
                Assert.AreEqual(valArray[i], testValArray[i]);
            }
        }