Ejemplo n.º 1
0
        public void ResolveHierarchy_DbEntityWithAsymetric4LevelTreeWithOneToNDependencyAndMultipleOccurances_3PropertyInfoLevelsInHierarchy()
        {
            var resolver = new DbEntityHierarchyResolver();

            var hierarchy = resolver.ResolveHierarchy(typeof(Level0AsymetricMultiple));

            AssertHierarchy(hierarchy,
                            new[]
            {
                GetPropertyInfo(typeof(Level1AsymetricMultipleA), "Level0"),
                GetPropertyInfo(typeof(Level1AsymetricMultipleB), "Level0"),
                GetPropertyInfo(typeof(Level2AsymetricMultipleA), "Level0"),
            },
                            new[]
            {
                GetPropertyInfo(typeof(Level2AsymetricMultipleA), "Level1A"),
                GetPropertyInfo(typeof(Level2AsymetricMultipleB), "Level1A"),
                GetPropertyInfo(typeof(Level1AsymetricMultipleB), "Level1A")
            },
                            new[]
            {
                GetPropertyInfo(typeof(Level3AsymetricMultiple), "Level2B"),
                GetPropertyInfo(typeof(Level0AsymetricMultiple), "Level2B"),
            });
        }
Ejemplo n.º 2
0
        public void ResolveHierarchy_DbEntityWithTwoLevelsOfLinearDependencyFromLevel1_TwoLevelHierarchy()
        {
            var resolver = new DbEntityHierarchyResolver();

            var hierarchy = resolver.ResolveHierarchy(typeof(Level1LinearDependency));

            AssertHierarchy(hierarchy, new[] { GetPropertyInfo(typeof(Level2LinearDependency), "Level1") });
        }
Ejemplo n.º 3
0
        public void ResolveHierarchy_DbEntityWithOneDependencyInOppositeDirection_EmptyHierarchy()
        {
            var resolver = new DbEntityHierarchyResolver();

            var hierarchy = resolver.ResolveHierarchy(typeof(EntityBLinearDependency));

            Assert.AreEqual(0, hierarchy.Count);
        }
Ejemplo n.º 4
0
        public void ResolveHierarchy_DbEntityWithOneDependency_OnePropertyInfoInHierarchy()
        {
            var resolver = new DbEntityHierarchyResolver();

            var hierarchy = resolver.ResolveHierarchy(typeof(EntityALinearDepencency));

            AssertHierarchy(hierarchy, new[] { GetPropertyInfo(typeof(EntityBLinearDependency), "EntityA") });
        }
Ejemplo n.º 5
0
        public void ResolveHierarchy_DbEntityWithSimpleOneToNDependency_OnePropertyInfoInHierarchy()
        {
            var resolver = new DbEntityHierarchyResolver();

            var hierarchy = resolver.ResolveHierarchy(typeof(Level0SimpleMultiple));

            AssertHierarchy(hierarchy, new[] { GetPropertyInfo(typeof(Level1SimpleMultiple), "Level0") });
        }
Ejemplo n.º 6
0
        public void ResolveHierarchy_DbEntityWithoutDependencies_HierarchyEmpty()
        {
            var resolver = new DbEntityHierarchyResolver();

            var hierarchy = resolver.ResolveHierarchy(typeof(EntityWithoutDependencies));

            Assert.AreEqual(0, hierarchy.Count);
        }
Ejemplo n.º 7
0
        public void ResolveHierarchy_DbEntityWithTwoLevelSymetricTreeHierarchy_TwoLevelHierarchyFirstLevelHasToPropertiesWithSameType()
        {
            var resolver = new DbEntityHierarchyResolver();

            var hierarchy = resolver.ResolveHierarchy(typeof(Level0SymetricTreeDependency));

            AssertHierarchy(hierarchy,
                            new[]
            {
                GetPropertyInfo(typeof(Level1SymetricTreeDependency), "Level0A"),
                GetPropertyInfo(typeof(Level1SymetricTreeDependency), "Level0B")
            },
                            new[] { GetPropertyInfo(typeof(Level2SymetricTreeDependency), "Level1") });
        }
Ejemplo n.º 8
0
        public void ResolveHierarchy_DbEntityWithTwoLevelTreeHierarchy_TwoLevelHierarchyFirstLevelMerged()
        {
            var resolver = new DbEntityHierarchyResolver();

            var hierarchy = resolver.ResolveHierarchy(typeof(Level0TreeDependency));

            AssertHierarchy(hierarchy,
                            new[]
            {
                GetPropertyInfo(typeof(Level1TreeDependencyA), "Level0"),
                GetPropertyInfo(typeof(Level1TreeDependencyB), "Level0")
            },
                            new[] { GetPropertyInfo(typeof(Level2TreeDependency), "Level1A") });
        }