Beispiel #1
0
        public void TestReadWriteUnsignedLong03()
        {
            //Functionality test on ReadUnsignedLong(ulong expectedSignature, long defaultValue) and WriteUnsignedLong(ulong signature, long value)
            //Initial value expected since matched signature.
            //
            IStorage storage   = new BinaryStorage();
            ulong    signature = Utilities.MakeEightCC('T', 'E', 'S', 'T', 'U', 'L', 'N', 'G');

            storage.WriteUnsignedLong(signature, 9223372036854775808);
            long position = storage.GetPosition();

            Assert.AreEqual(16, position);

            storage.Seek(0, SeekOrigin.Begin);
            ulong returned = storage.ReadUnsignedLong(signature, 9223372036854775809);

            Assert.AreEqual(9223372036854775808, returned);
        }
Beispiel #2
0
        public void TestReadWriteUnsignedLong00()
        {
            //Functionality test on ReadUnsignedLong(ulong expectedSignature) and WriteUnsignedLong(ulong signature, long value)
            //Exception expected due to unmatched signature.
            //
            IStorage storage     = new BinaryStorage();
            ulong    signature00 = Utilities.MakeEightCC('T', 'E', 'S', 'T', 'U', 'L', 'N', 'G');
            ulong    signature01 = Utilities.MakeEightCC('T', 'E', 'S', 'T', '_', '_', '_', '_');

            storage.WriteUnsignedLong(signature00, 9223372036854775808);
            long position = storage.GetPosition();

            Assert.AreEqual(16, position);

            storage.Seek(0, SeekOrigin.Begin);
            Assert.Throws <InvalidDataException>(() =>
            {
                ulong returned = storage.ReadUnsignedLong(signature01);
            });
        }