public unsafe void HitCountCanReadPersistedData() { const ulong anyHitCount = 42; var hitCount = new InternalHitCount(); var hitCountBytes = BitConverter.GetBytes(anyHitCount); fixed (byte* buf = hitCountBytes) { hitCount.ReadFromPersistedData(buf, sizeof(long), false); } Assert.AreEqual(anyHitCount, hitCount.HitCount); }
public unsafe void HitCountReadAddsToCurrentValue() { const ulong anyHitCount = 42; var hitCount = new InternalHitCount(); hitCount.AddValue(37); var hitCountBytes = BitConverter.GetBytes(anyHitCount); fixed (byte* buf = hitCountBytes) { hitCount.ReadFromPersistedData(buf, sizeof(ulong), false); } Assert.AreEqual(anyHitCount + 37, hitCount.HitCount); }