internal static SelectedPropertiesNode IncludeEntireSubtree(this SelectedPropertiesNode node, IEdmEntityType entityType)
        {
            var expected = entityType.StructuralProperties().Where(p => p.Type.IsStream());
            var edmStructuralProperties = node.GetSelectedStreamProperties(entityType).Values;

            Assert.Equal(expected.Count(), edmStructuralProperties.Count);
            foreach (var prop in edmStructuralProperties)
            {
                Assert.Contains(prop, expected);
            }

            var navExpected      = entityType.NavigationProperties();
            var edmNavProperties = node.GetSelectedNavigationProperties(entityType);

            Assert.Equal(navExpected.Count(), edmNavProperties.Count());
            foreach (var prop in edmNavProperties)
            {
                Assert.Contains(prop, navExpected);
            }

            foreach (var navigation in entityType.NavigationProperties())
            {
                node.GetSelectedPropertiesForNavigationProperty(entityType, navigation.Name).HaveEntireSubtree();
            }

            return(node);
        }
        internal static SelectedPropertiesNode HaveChild(this SelectedPropertiesNode node, IEdmEntityType entityType, string propertyName, Action <SelectedPropertiesNode> validateChild)
        {
            var child = node.GetSelectedPropertiesForNavigationProperty(entityType, propertyName);

            Assert.NotNull(child);
            validateChild(child);
            return(node);
        }
        internal static SelectedPropertiesNode NotHaveNavigations(this SelectedPropertiesNode node, IEdmEntityType entityType)
        {
            Assert.Empty(node.GetSelectedNavigationProperties(entityType));

            foreach (var navigation in entityType.NavigationProperties())
            {
                node.GetSelectedPropertiesForNavigationProperty(entityType, navigation.Name).BeSameAsEmpty();
            }

            return(node);
        }
Example #4
0
 public void GetSelectedPropertiesForNavigationPropertyForNonEmptyNodeShouldAlwaysReturnEntireSubtreeWhenEntityTypeIsNull()
 {
     EntireSubtreeNode.GetSelectedPropertiesForNavigationProperty(structuredType: null, navigationPropertyName: "foo").Should().HaveEntireSubtree();
     SelectedPropertiesNode.Create("bar").GetSelectedPropertiesForNavigationProperty(structuredType: null, navigationPropertyName: "foo").Should().HaveEntireSubtree();
 }
Example #5
0
 public void GetSelectedPropertiesForNavigationPropertyForEmptyNodeShouldReturnEmptyNodeWhenEntityTypeIsNull()
 {
     EmptyNode.GetSelectedPropertiesForNavigationProperty(structuredType: null, navigationPropertyName: "foo").Should().BeSameAs(EmptyNode);
 }
 public void GetSelectedPropertiesForNavigationPropertyForEmptyNodeShouldReturnEmptyNodeWhenEntityTypeIsNull()
 {
     Assert.Same(EmptyNode, EmptyNode.GetSelectedPropertiesForNavigationProperty(structuredType: null, navigationPropertyName: "foo"));
 }