public void Test_FindNodePath_FourLevel() { ResourceEntity rootEntity; ResourceEntity firstLevelEntity; ResourceEntity secondLevelEntity; ResourceEntity thirdLevelEntity; Guid rootEntityNodeId = Guid.NewGuid(); Guid firstLevelEntityNodeId = Guid.NewGuid(); Guid secondLevelEntityNodeId = Guid.NewGuid(); Guid thirdLevelEntityNodeId = Guid.NewGuid(); rootEntity = new ResourceEntity { NodeId = rootEntityNodeId }; firstLevelEntity = new RelatedResource { NodeId = firstLevelEntityNodeId }; secondLevelEntity = new RelatedResource { NodeId = secondLevelEntityNodeId }; thirdLevelEntity = new RelatedResource { NodeId = thirdLevelEntityNodeId }; secondLevelEntity.RelatedEntities.Add(thirdLevelEntity); firstLevelEntity.RelatedEntities.Add(secondLevelEntity); rootEntity.RelatedEntities.Add(firstLevelEntity); List <Entity> findNodePath = StructuredQueryHelper.FindNodePath(thirdLevelEntityNodeId, rootEntity); Assert.AreEqual(findNodePath.Count, 3); }
public void Test_FindNodePath_TwoLevel() { ResourceEntity rootEntity; ResourceEntity firstLevelEntity; Guid rootEntityNodeId = Guid.NewGuid(); Guid firstLevelEntityNodeId = Guid.NewGuid(); rootEntity = new ResourceEntity { NodeId = rootEntityNodeId }; firstLevelEntity = new RelatedResource { NodeId = firstLevelEntityNodeId }; rootEntity.RelatedEntities.Add(firstLevelEntity); List <Entity> findNodePath = StructuredQueryHelper.FindNodePath(firstLevelEntityNodeId, rootEntity); Assert.AreEqual(findNodePath.Count, 1); }
public void Test_FindNodePath_NullNode() { List <Entity> findNodePath = StructuredQueryHelper.FindNodePath(Guid.Empty, null); Assert.AreEqual(findNodePath.Count, 0); }