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

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

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

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

            Assert.That(() => KeyRange.FromKey(Slice.Nil), Throws.InstanceOf <ArgumentException>());
        }