Example #1
0
        public void TestReadWriteUnsignedInteger03()
        {
            //Functionality test on ReadUnsignedInteger(ulong expectedSignature, uint defaultValue) and WriteUnsignedInteger(ulong signature, uint value)
            //Initial value expected since matched signature.
            //
            IStorage storage   = new BinaryStorage();
            ulong    signature = Utilities.MakeEightCC('T', 'E', 'S', 'T', ' ', 'I', 'N', 'T');

            storage.WriteUnsignedInteger(signature, 2147483648);
            long position = storage.GetPosition();

            Assert.AreEqual(12, position);

            storage.Seek(0, SeekOrigin.Begin);
            uint returned = storage.ReadUnsignedInteger(signature, 2147483649);

            Assert.AreEqual(2147483648, returned);
        }
Example #2
0
        public void TestReadWriteUnsignedInteger00()
        {
            //Functionality test on ReadUnsignedInteger(ulong expectedSignature) and WriteUnsignedInteger(ulong signature, uint value)
            //Exception expected due to unmatched signature.
            //
            IStorage storage     = new BinaryStorage();
            ulong    signature00 = Utilities.MakeEightCC('T', 'E', 'S', 'T', 'U', 'I', 'N', 'T');
            ulong    signature01 = Utilities.MakeEightCC('T', 'E', 'S', 'T', '_', 'I', 'N', 'T');

            storage.WriteUnsignedInteger(signature00, 2147483648);
            long position = storage.GetPosition();

            Assert.AreEqual(12, position);

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