Exemplo n.º 1
0
        public void Test_KeyRange_PrefixedBy()
        {
            KeyRange range;

            // "abc" => [ "abc\x00", "abd" )
            range = KeyRange.PrefixedBy(Slice.FromByteString("abc"));
            Assert.That(range.Begin, Is.EqualTo(Slice.FromByteString("abc\x00")));
            Assert.That(range.End, Is.EqualTo(Slice.FromByteString("abd")));

            // "" => ArgumentException
            Assert.That(() => KeyRange.PrefixedBy(Slice.Empty), Throws.InstanceOf <ArgumentException>());

            // "\xFF" => ArgumentException
            Assert.That(() => KeyRange.PrefixedBy(Slice.FromByteString("\xFF")), Throws.InstanceOf <ArgumentException>());

            // null => ArgumentException
            Assert.That(() => KeyRange.PrefixedBy(Slice.Nil), Throws.InstanceOf <ArgumentException>());
        }
 public static KeyRange EncodeRange <T1>(this ITypedKeySubspace <T1> self, [AllowNull] T1 item1)
 {
     //TODO: add concept of "range" on IKeyEncoder ?
     return(KeyRange.PrefixedBy(self.Encode(item1)));
 }
 public static KeyRange PackRange <T1>(this ITypedKeySubspace <T1> self, ValueTuple <T1> tuple)
 {
     return(KeyRange.PrefixedBy(self.Encode(tuple.Item1)));
 }