Esempio n. 1
0
        public void TestContinuedUnknownRecord()
        {
            byte[] data =
            {
                0,    unchecked ((byte)-1), 0, 0,          // an unknown record with 0 Length
                0x3C,                    0, 3, 0, 1, 2, 3, // a continuation record with 3 bytes of data
                0x3C,                    0, 1, 0, 4        // one more continuation record with 1 byte of data
            };

            int[]       recCnt   = { 0 };
            int[]       offset   = { 0 };
            ERFListener listener = new ERFListener2(ref data, ref recCnt, ref offset);
            ArrayList   sids     = new ArrayList(2);

            sids.Add((short)-256);
            sids.Add((short)0x3C);

            EventRecordFactory factory = new EventRecordFactory(listener, sids);

            factory.ProcessRecords(new MemoryStream(data));
            Assert.AreEqual(3, recCnt[0], "nr. of Processed records");
            Assert.AreEqual(data.Length, offset[0], "nr. of Processed bytes");
        }
        public void TestContinuedUnknownRecord()
        {
            byte[] data = {
            0, unchecked((byte)-1), 0, 0, // an unknown record with 0 Length
            0x3C , 0, 3, 0, 1, 2, 3, // a continuation record with 3 bytes of data
            0x3C , 0, 1, 0, 4 // one more continuation record with 1 byte of data
        };

            int[] recCnt =  {0} ;
            int[] offset =  {0} ;
            IERFListener listener = new ERFListener2(ref data, ref recCnt,ref offset);
            ArrayList sids = new ArrayList(2);
            sids.Add((short)-256);
            sids.Add((short)0x3C);

            EventRecordFactory factory = new EventRecordFactory(listener, sids);

            factory.ProcessRecords(new MemoryStream(data));
            Assert.AreEqual(3, recCnt[0], "nr. of Processed records");
            Assert.AreEqual(data.Length, offset[0], "nr. of Processed bytes");
        }