public void UnsafeObjectStream_RawSeekForward_SeeksToNextObject_WhenNotAtEndOfStream() { var stream = new UnsafeObjectStream(); stream.AcquirePointers(); try { unsafe { stream.ReserveMultiple(2, 2 * sizeof(UnsafeObjectTypeOne)); *(UnsafeObjectTypeOne *)stream.Data = new UnsafeObjectTypeOne() { ObjectType = UnsafeObjectType.TypeOne, Value1 = 123 }; stream.FinalizeObject(sizeof(UnsafeObjectTypeOne)); *(UnsafeObjectTypeOne *)stream.Data = new UnsafeObjectTypeOne() { ObjectType = UnsafeObjectType.TypeOne, Value1 = 234 }; stream.FinalizeObject(sizeof(UnsafeObjectTypeOne)); stream.RawSeekObject(0); TheResultingValue(stream.PositionInBytes).ShouldBe(0); TheResultingValue(stream.PositionInObjects).ShouldBe(0); stream.SeekForward(); TheResultingValue(stream.PositionInBytes).ShouldBe(sizeof(UnsafeObjectTypeOne)); TheResultingValue(stream.PositionInObjects).ShouldBe(1); stream.SeekForward(); TheResultingValue(stream.PositionInBytes).ShouldBe(sizeof(UnsafeObjectTypeOne) + sizeof(UnsafeObjectTypeOne)); TheResultingValue(stream.PositionInObjects).ShouldBe(2); } } finally { stream.ReleasePointers(); } }