public void should_be_copy_from_array_of_bytes() { var redisBuffer = new RedisBuffer(_64Bytes); var arr = new byte[_64Bytes]; for (byte i = 0; i < _64Bytes; i++) arr[i] = i; redisBuffer.CopyFrom(arr, 0, 0, _64Bytes); byte[] raw = redisBuffer.GetRaw(); raw.Should().BeEquivalentTo(arr); }
public void should_raise_ArgumentNullException() { var redisBuffer = new RedisBuffer(_64Bytes); this.Invoking(x => redisBuffer.CopyFrom(null, 0, 0, _64Bytes)).ShouldThrow<ArgumentNullException>(); }
public void should_raise_ArgumentOutOfRangeException() { const int lessthanZero = -1; var redisBuffer = new RedisBuffer(_64Bytes); var arr = new byte[_8Bytes]; this.Invoking(x => redisBuffer.CopyFrom(arr, arr.GetLowerBound(0) - 1, 0, _8Bytes)).ShouldThrow<ArgumentOutOfRangeException>(); this.Invoking(x => redisBuffer.CopyFrom(arr, 0, lessthanZero, _8Bytes)).ShouldThrow<ArgumentOutOfRangeException>(); this.Invoking(x => redisBuffer.CopyFrom(arr, 0, 0, lessthanZero)).ShouldThrow<ArgumentOutOfRangeException>(); }