예제 #1
0
        public void TryBindKeySegmentForCompositeKeyValueWorks()
        {
            IList <PathSegment> path = new List <PathSegment>
            {
                new EntitySetSegment(_customers)
            };

            bool result = PathParser.TryBindKeySegment("(FirstName={a},LastName={b})", path);

            Assert.True(result);
            Assert.Equal(2, path.Count);
            var keySegment = Assert.IsType <KeySegment>(path[1]);

            Assert.Equal("FirstName={a},LastName={b}", keySegment.Identifier);
            Assert.Equal(new[] { "FirstName", "LastName" }, keySegment.Values.Keys);
            Assert.Equal(new[] { "{a}", "{b}" }, keySegment.Values.Values);
        }
예제 #2
0
        public void TryBindKeySegmentForSingleKeyValueWorks(string keyString)
        {
            IList <PathSegment> path = new List <PathSegment>
            {
                new EntitySetSegment(_users)
            };

            bool result = PathParser.TryBindKeySegment(keyString, path);

            Assert.True(result);
            Assert.Equal(2, path.Count);
            var keySegment = Assert.IsType <KeySegment>(path[1]);

            Assert.Equal(keyString, "(" + keySegment.Identifier + ")");
            var value = Assert.Single(keySegment.Values);

            Assert.Equal("{id}", value.Value);
        }