예제 #1
0
        public void TestReadWriteBoolean03()
        {
            //Functionality test on ReadBoolean(ulong expectedSignature, bool defaultValue) and WriteBoolean(ulong signature, bool value)
            //Initial value expected since matched signature.
            //
            IStorage storage   = new BinaryStorage();
            ulong    signature = Utilities.MakeEightCC('T', 'E', 'S', 'T', 'B', 'O', 'O', 'L');

            storage.WriteBoolean(signature, true);
            long position = storage.GetPosition();

            Assert.AreEqual(9, position);

            storage.Seek(0, SeekOrigin.Begin);
            bool returned = storage.ReadBoolean(signature, false);

            Assert.AreEqual(true, returned);
        }
예제 #2
0
        public void TestReadWriteBoolean00()
        {
            //Functionality test on ReadBoolean(ulong expectedSignature) and WriteBoolean(ulong signature, bool value)
            //Exception expected due to unmatched signature.
            //
            IStorage storage     = new BinaryStorage();
            ulong    signature00 = Utilities.MakeEightCC('T', 'E', 'S', 'T', 'B', 'O', 'O', 'L');
            ulong    signature01 = Utilities.MakeEightCC('T', 'E', 'S', 'T', '_', '_', '_', '_');

            storage.WriteBoolean(signature00, true);
            long position = storage.GetPosition();

            Assert.AreEqual(9, position);

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