Ejemplo n.º 1
0
        public void TestReadWriteDouble03()
        {
            //Functionality test on ReadDouble(ulong expectedSignature, double defaultValue) and WriteDouble(ulong signature, double value)
            //Initial value expected since matched signature.
            //
            IStorage storage   = new BinaryStorage();
            ulong    signature = Utilities.MakeEightCC('T', 'E', 'S', 'T', ' ', 'D', 'B', 'L');

            storage.WriteDouble(signature, 1.2);
            long position = storage.GetPosition();

            Assert.AreEqual(16, position);

            storage.Seek(0, SeekOrigin.Begin);
            double returned = storage.ReadDouble(signature, 2.1);

            Assert.AreEqual(1.2, returned);
        }
Ejemplo n.º 2
0
        public void TestReadWriteDouble00()
        {
            //Functionality test on ReadDouble(ulong expectedSignature) and WriteDouble(ulong signature, double value)
            //Exception expected due to unmatched signature.
            //
            IStorage storage     = new BinaryStorage();
            ulong    signature00 = Utilities.MakeEightCC('T', 'E', 'S', 'T', ' ', 'D', 'B', 'L');
            ulong    signature01 = Utilities.MakeEightCC('T', 'E', 'S', 'T', '_', 'D', 'B', 'L');

            storage.WriteDouble(signature00, 1.2);
            long position = storage.GetPosition();

            Assert.AreEqual(16, position);

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