コード例 #1
0
 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);
 }
コード例 #2
0
 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);
 }