Exemplo n.º 1
0
        public static UserHeader Deserialize(byte[] data)
        {
            int size = GetSizeFromData(data);
            byte[] userHeaderData = data.SubArray(GetSizeSize(), data.Length);
            UserHeader uHeader = new UserHeader(size) { Data = userHeaderData };

            return uHeader;
        }
        public static UserHeader Deserialize(byte[] data)
        {
            int size = GetSizeFromData(data);

            byte[]     userHeaderData = data.SubArray(GetSizeSize(), data.Length);
            UserHeader uHeader        = new UserHeader(size)
            {
                Data = userHeaderData
            };

            return(uHeader);
        }
 public static void AssertUserHeadersAreSame(UserHeader expected, UserHeader actual)
 {
     Assert.AreEqual(expected.Size, actual.Size);
     TestHelper.AssertByteArraysAreSame(expected.Data, actual.Data);
 }
 private void UserHeaderConstructorSizeTest(int size)
 {
     UserHeader target = new UserHeader(size);
     Assert.IsNotNull(target);
     Assert.AreEqual(target.Size, size);
 }
 private void DataTestAssert(byte[] data)
 {
     UserHeader target = new UserHeader(9);
     target.Data = data;
     byte[] actual = target.Data;
     TestHelper.AssertByteArraysAreSame(data, actual);
 }
 private static UserHeader WriteToStorageTestHelper(IStorage storage, int size, byte[] data)
 {
     storage.Seek(UserHeader.GetUserHeaderPosition());
     UserHeader target = new UserHeader(size);
     target.Data = data.ExtendTo(size);
     storage.WriteByteArray(target.Serialize());
     return target;
 }