public void TestReadWriteLong03() { //Functionality test on ReadLong(ulong expectedSignature, long defaultValue) and WriteLong(ulong signature, long value) //Initial value expected since matched signature. // IStorage storage = new BinaryStorage(); ulong signature = Utilities.MakeEightCC('T', 'E', 'S', 'T', ' ', 'L', 'N', 'G'); storage.WriteLong(signature, 3000000000); long position = storage.GetPosition(); Assert.AreEqual(16, position); storage.Seek(0, SeekOrigin.Begin); long returned = storage.ReadLong(signature, 3000000001); Assert.AreEqual(3000000000, returned); }
public void TestReadWriteLong00() { //Functionality test on ReadLong(ulong expectedSignature) and WriteLong(ulong signature, long value) //Exception expected due to unmatched signature. // IStorage storage = new BinaryStorage(); ulong signature00 = Utilities.MakeEightCC('T', 'E', 'S', 'T', ' ', 'L', 'N', 'G'); ulong signature01 = Utilities.MakeEightCC('T', 'E', 'S', 'T', '_', 'L', 'N', 'G'); storage.WriteLong(signature00, 3000000000); long position = storage.GetPosition(); Assert.AreEqual(16, position); storage.Seek(0, SeekOrigin.Begin); Assert.Throws <InvalidDataException>(() => { long returned = storage.ReadLong(signature01); }); }