Пример #1
0
        // This method is reused by the actual test methods that follow
        public Boolean ComputeTestChecksums(
            TSDateCalculator.TimeStepUnitCode u1, short q1,
            DateTime sDate1, List <ITimeSeriesTrace> traceList1,
            TSDateCalculator.TimeStepUnitCode u2, short q2,
            DateTime sDate2, List <ITimeSeriesTrace> traceList2)
        {
            TSLibrary tsLib = new TSLibrary();

            byte[] b1 = tsLib.ComputeChecksum(u1, q1, sDate1, traceList1);
            byte[] b2 = tsLib.ComputeChecksum(u2, q2, sDate2, traceList2);

            Assert.IsTrue(b1.Length == 16);
            Assert.IsTrue(b2.Length == 16);

            for (int i = 0; i < b2.Length; i++)
            {
                if (b1[i] != b2[i])
                {
                    return(false);
                }
            }

            return(true);
        }
Пример #2
0
        public void ComputeChecksum_Err1()
        {
            TSLibrary tsLib       = new TSLibrary();
            TSTrace   traceObject = new TSTrace {
                TraceNumber = 1
            };

            try
            {
                byte[] blobData = tsLib.ComputeChecksum(
                    TSDateCalculator.TimeStepUnitCode.Irregular, 3,
                    IrregList1.First().Date, new List <ITimeSeriesTrace>());
                Assert.Fail("Should have thrown exception");
            }
            catch (TSLibraryException e)
            {
                Assert.AreEqual(ErrCode.Enum.Checksum_Quantity_Nonzero, e.ErrCode);
            }
        }