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 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);
        }
Exemplo n.º 3
0
 public void GetSelectedNavigationPropertiesShouldAlwaysReturnEmptyEnumerationWhenEntityTypeIsNull()
 {
     EntireSubtreeNode.GetSelectedNavigationProperties(null).Should().BeEmpty();
     EmptyNode.GetSelectedNavigationProperties(null).Should().BeEmpty();
     SelectedPropertiesNode.Create("bar").GetSelectedNavigationProperties(null).Should().BeEmpty();
 }
 internal static SelectedPropertiesNode HaveNavigations(this SelectedPropertiesNode node, IEdmEntityType entityType, params string[] navigationNames)
 {
     Assert.Equal(navigationNames, node.GetSelectedNavigationProperties(entityType).Select(p => p.Name));
     return(node);
 }
 public void GetSelectedNavigationPropertiesShouldAlwaysReturnEmptyEnumerationWhenEntityTypeIsNull()
 {
     Assert.Empty(EntireSubtreeNode.GetSelectedNavigationProperties(null));
     Assert.Empty(EmptyNode.GetSelectedNavigationProperties(null));
     Assert.Empty(SelectedPropertiesNode.Create("bar").GetSelectedNavigationProperties(null));
 }