Exemplo n.º 1
0
        public void ToStringKeySetFromRanges()
        {
            var ranges = KeySet.FromRanges(
                KeyRange.ClosedOpen(new Key("beginKeyPart1", "beginKeyPart2"), new Key("endKeyPart1", "endKeyPart2")), KeyRange.ClosedClosed(new Key(1L), new Key(2L)));

            Assert.Equal("KeySet {Ranges = [[[ \"beginKeyPart1\", \"beginKeyPart2\" ], [ \"endKeyPart1\", \"endKeyPart2\" ]), [[ \"1\" ], [ \"2\" ]]]}", ranges.ToString());
        }
Exemplo n.º 2
0
        public void CreateEmptyKeyRange()
        {
            var empty = KeyRange.ClosedOpen(new Key(), new Key());

            Assert.Empty(empty.BeginAt.KeyParts.Values);
            Assert.Empty(empty.End.KeyParts.Values);
        }
Exemplo n.º 3
0
        public void CreateKeySetFromRanges()
        {
            var ranges = KeySet.FromRanges(
                KeyRange.ClosedOpen(new Key("begin"), new Key("end")), KeyRange.ClosedClosed(new Key(1L), new Key(2L)));

            Assert.Collection(ranges.Ranges,
                              range => Assert.Equal(KeyRange.ClosedOpen(new Key("begin"), new Key("end")), range),
                              range => Assert.Equal(KeyRange.ClosedClosed(new Key(1L), new Key(2L)), range)
                              );
        }
Exemplo n.º 4
0
        public void CreateKeyRangeClosedOpen()
        {
            var closedOpen = KeyRange.ClosedOpen(new Key(1L), new Key(100L));

            Assert.True(closedOpen.BeginInclusive);
            Assert.False(closedOpen.EndInclusive);
            Assert.Equal(new Key(1L), closedOpen.BeginAt);
            Assert.Equal(new Key(100L), closedOpen.End);
            Assert.Equal(
                new V1.KeyRange
            {
                StartClosed = new ListValue {
                    Values = { new[] { new Value {
                                           StringValue = "1"
                                       } } }
                },
                EndOpen = new ListValue {
                    Values = { new[] { new Value {
                                           StringValue = "100"
                                       } } }
                }
            }, closedOpen.Protobuf);
        }