Пример #1
0
        public void TestIsExternalRef()
        {
            DConRefRecord instance = new DConRefRecord(TestcaseRecordInputStream.Create(81, data1));

            Assert.IsTrue(instance.IsExternalRef, "external reference");
            instance = new DConRefRecord(TestcaseRecordInputStream.Create(81, data2));
            Assert.IsFalse(instance.IsExternalRef, "internal reference");
        }
Пример #2
0
        public void TestGetPath()
        {
            DConRefRecord instance = new DConRefRecord(TestcaseRecordInputStream.Create(81, data1));

            byte[] expResult = Arrays.CopyOfRange(data1, 9, data1.Length);
            byte[] result    = instance.GetPath();
            Assert.IsTrue(Arrays.Equals(expResult, result), "get path");
        }
Пример #3
0
        public void TestGetSid()
        {
            DConRefRecord instance  = new DConRefRecord(TestcaseRecordInputStream.Create(81, data1));
            short         expResult = 81;
            short         result    = instance.Sid;

            Assert.AreEqual(expResult, result, "SID");
        }
Пример #4
0
        private void TestReadWrite(byte[] data, string message)
        {
            RecordInputStream        is1 = TestcaseRecordInputStream.Create(81, data);
            DConRefRecord            d   = new DConRefRecord(is1);
            MemoryStream             bos = new MemoryStream(data.Length);
            LittleEndianOutputStream o   = new LittleEndianOutputStream(bos);

            d.Serialize(o);
            o.Flush();

            Assert.IsTrue(Arrays.Equals(data, bos.ToArray()), message);
        }
Пример #5
0
        public void TestGetDataSize()
        {
            DConRefRecord instance  = new DConRefRecord(TestcaseRecordInputStream.Create(81, data1));
            int           expResult = data1.Length;
            int           result    = instance.RecordSize - 4;

            Assert.AreEqual(expResult, result, "single byte external reference, volume type path data size");
            instance = new DConRefRecord(TestcaseRecordInputStream.Create(81, data2));
            Assert.AreEqual(data2.Length, instance.RecordSize - 4, "double byte self reference data size");
            instance = new DConRefRecord(TestcaseRecordInputStream.Create(81, data3));
            Assert.AreEqual(data3.Length, instance.RecordSize - 4, "single byte self reference data size");
            instance = new DConRefRecord(TestcaseRecordInputStream.Create(81, data4));
            Assert.AreEqual(data4.Length, instance.RecordSize - 4, "double byte external reference, UNC volume type path data size");
        }