public void PropertyFilter_finds_declared_properties_on_derived_type()
        {
            var propertyNames = new[]
                {
                    "PublicDerived"
                };

            var properties = new PropertyFilter().GetProperties(
                typeof(PropertyFilterTests_Derived), true, Enumerable.Empty<PropertyInfo>());

            Assert.Equal(propertyNames.Length, properties.Count());
            Assert.True(properties.All(x => propertyNames.Contains(x.Name)));
        }
예제 #2
0
        public void PropertyFilter_finds_declared_properties_on_derived_type()
        {
            var propertyNames = new[]
            {
                "PublicDerived"
            };

            var properties = new PropertyFilter().GetProperties(
                typeof(PropertyFilterTests_Derived), true, Enumerable.Empty <PropertyInfo>());

            Assert.Equal(propertyNames.Length, properties.Count());
            Assert.True(properties.All(x => propertyNames.Contains(x.Name)));
        }
        public void PropertyFilter_finds_all_properties_on_derived_type()
        {
            var propertyNames = new[]
                {
                    "PublicBase",
                    "PublicBaseForNew",
                    "PublicVirtualBase",
                    "PublicVirtualBase2",
                    "InterfaceImplicit",
                    "PublicDerived"
                };

            var properties = new PropertyFilter().GetProperties(
                typeof(PropertyFilterTests_Derived), false, Enumerable.Empty<PropertyInfo>());

            Assert.Equal(propertyNames.Length, properties.Count());
            Assert.True(properties.All(x => propertyNames.Contains(x.Name)));
        }
예제 #4
0
        public void PropertyFilter_finds_all_properties_on_derived_type()
        {
            var propertyNames = new[]
            {
                "PublicBase",
                "PublicBaseForNew",
                "PublicVirtualBase",
                "PublicVirtualBase2",
                "InterfaceImplicit",
                "PublicDerived"
            };

            var properties = new PropertyFilter().GetProperties(
                typeof(PropertyFilterTests_Derived), false, Enumerable.Empty <PropertyInfo>());

            Assert.Equal(propertyNames.Length, properties.Count());
            Assert.True(properties.All(x => propertyNames.Contains(x.Name)));
        }
예제 #5
0
        public void PropertyFilter_excludes_enum_and_spatial_properties_if_V3_features_are_not_supported()
        {
            var mockType = new MockType();

            mockType.Setup(m => m.IsEnum).Returns(true);

            var properties = new PropertyInfo[]
            {
                new MockPropertyInfo(typeof(DbGeography), "Geography"),
                new MockPropertyInfo(typeof(DbGeometry), "Geometry"),
                new MockPropertyInfo(mockType, "EnumProp")
            };

            mockType.Setup(m => m.GetProperties(It.IsAny <BindingFlags>())).Returns(properties);

            var filteredProperties = new PropertyFilter(XmlConstants.EdmVersionForV2).GetProperties(mockType, declaredOnly: false);

            Assert.Equal(0, filteredProperties.Count());
        }
        public void PropertyFilter_excludes_enum_and_spatial_properties_if_V3_features_are_not_supported()
        {
            var mockType = new MockType();
            mockType.Setup(m => m.IsEnum).Returns(true);

            var properties = new PropertyInfo[]
            { 
                new MockPropertyInfo(typeof(DbGeography), "Geography"), 
                new MockPropertyInfo(typeof(DbGeometry), "Geometry"),
                new MockPropertyInfo(mockType, "EnumProp") 
            };

            mockType.Setup(m => m.GetProperties(It.IsAny<BindingFlags>())).Returns(properties);

            var filteredProperties = new PropertyFilter(DataModelVersions.Version2).GetProperties(mockType, declaredOnly: false);

            Assert.Equal(0, filteredProperties.Count());
        }