public void GetUserHeaderTest() { int uHeaderSize = 8; IPersistentCollectionSpaceManager pafs = InitPAFS("GetPCSMUserHeader", 16, uHeaderSize); try { byte[] uHeader = pafs.GetUserHeader(); Assert.AreEqual(uHeaderSize, uHeader.Length); TestHelper.AssertByteArraysAreSame(new byte[0], uHeader); byte[] newUserHeader = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }; pafs.PutUserHeader(newUserHeader); byte[] actual = pafs.GetUserHeader(); TestHelper.AssertByteArraysAreSame(newUserHeader, actual); } finally { pafs.Close(); } }
public void GetHeaderTest() { IPersistentCollectionSpaceManager pafs = InitPAFS("GetPCSMHeader", 16, 20); try { byte[] userheader = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 100, 110, 120, 130, 140, 150, 210, 220, 230, 240, 255 }; pafs.PutUserHeader(userheader); TestHelper.AssertByteArraysAreSame(userheader, pafs.GetUserHeader()); try { pafs.PutUserHeader(new byte[21]); Assert.Fail("Should throw an exception"); } catch (InvalidUserHeaderException) {} } finally { pafs.Close(); } }
public byte[] GetUserHeader() { byte[] fullUserHeader = _persistentSimpleCollection.GetUserHeader(); byte[] userHeaderBytes = fullUserHeader.SubArray(GetSizeSize(), fullUserHeader.Length); return(userHeaderBytes); }