private static void MergeAfterTestAssert(int sizeIndex1, int endIndex1, int sizeIndex2, int endIndex2)
        {
            PersistentHeapFreeSpace freeSpace1 = new PersistentHeapFreeSpace(sizeIndex1, endIndex1, 5);
            PersistentHeapFreeSpace freeSpace2 = new PersistentHeapFreeSpace(sizeIndex2, endIndex2, 6);

            freeSpace1.MergeAfter(freeSpace2);

            Assert.AreEqual(endIndex2, freeSpace1.EndIndex);
            Assert.AreEqual(endIndex2 - sizeIndex1 - PersistentHeapSpace.GetUserSizeSize()+1, freeSpace1.UserSize);
        }
 private static void LinkAfter(PersistentHeapFreeSpace freedSpace, PersistentHeapFreeSpace after)
 {
     if (after == null) // there is no free space after the freed space
     {
         freedSpace.NextFreeSpace = FreeLinkedListNullPointer;
     }
     else // there is at least one free space after freed space
     {
         if (freedSpace.IsDirectlyBefore(after)) // the space after is next to freed space
         {
             freedSpace.MergeAfter(after);
         }
         else // the space after is not next to freed space
         {
             freedSpace.NextFreeSpace = after.StartIndex;
         }
     }
 }