Exemplo n.º 1
0
        public void Test_FdbKeyRange_FromKey()
        {
            FdbKeyRange range;

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

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

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

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