public void Check_hash_roundtrips()
        {
            var buffer = new byte[Rand.Next(2, 64)];
            var prov   = new RNGCryptoServiceProvider();

            prov.GetBytes(buffer);

            var hash = BufferUtil.CalculateSimpleHashCode(buffer);

            Enforce.That(() => buffer, BufferIs.WithValidHash(hash));

            unchecked
            {
                buffer[Rand.Next(buffer.Length)] += 1;
            }

            Assert.IsFalse(Scope.IsValid(buffer, BufferIs.WithValidHash(hash)));
        }
 public void Limited()
 {
     RuleAssert.For(BufferIs.Limited(10))
     .ExpectNone(new byte[10], new byte[9])
     .ExpectError(null, new byte[11], new byte[12]);
 }