public virtual void TestGetInt64()
        {
            sbyte[] buffer            = new sbyte[] { unchecked ((int)(0x00)), unchecked ((int)(0x01)), unchecked ((int)(0x02)), unchecked ((int)(0x03)), unchecked ((int)(0x04)), unchecked ((int)(0x05)), unchecked ((int)(0x06)), unchecked (
                                                          (int)(0x07)), unchecked ((sbyte)unchecked ((int)(0xFF))) };
            RandomAccessReader reader = CreateReader(buffer);

            Sharpen.Tests.AreEqual(unchecked ((long)(0x0001020304050607L)), reader.GetInt64(0));
            Sharpen.Tests.AreEqual(unchecked ((long)(0x01020304050607FFL)), reader.GetInt64(1));
            reader.SetMotorolaByteOrder(false);
            Sharpen.Tests.AreEqual(unchecked ((long)(0x0706050403020100L)), reader.GetInt64(0));
            Sharpen.Tests.AreEqual(unchecked ((long)(0xFF07060504030201L)), reader.GetInt64(1));
        }
 public virtual void TestGetInt64_OutOfBounds()
 {
     try
     {
         RandomAccessReader reader = CreateReader(new sbyte[7]);
         reader.GetInt64(0);
         NUnit.Framework.Assert.Fail("Exception expected");
     }
     catch (IOException ex)
     {
         Sharpen.Tests.AreEqual("Attempt to read from beyond end of underlying data source (requested index: 0, requested count: 8, max index: 6)", ex.Message);
     }
     try
     {
         RandomAccessReader reader = CreateReader(new sbyte[7]);
         reader.GetInt64(-1);
         NUnit.Framework.Assert.Fail("Exception expected");
     }
     catch (IOException ex)
     {
         Sharpen.Tests.AreEqual("Attempt to read from buffer using a negative index (-1)", ex.Message);
     }
 }
Пример #3
0
		/// <exception cref="System.IO.IOException"/>
		private void SetInt64(Com.Drew.Metadata.Directory directory, int tagType, RandomAccessReader reader)
		{
			long l = reader.GetInt64(tagType);
			if (l != 0)
			{
				directory.SetLong(tagType, l);
			}
		}