Beispiel #1
0
 public void TestInitPath_1Level_Guid() {
     var id = Guid.NewGuid();
     var treeObject = new GuidTreeObject( id );
     treeObject.InitPath();
     Assert.AreEqual( 1, treeObject.Level );
     Assert.AreEqual( id + ",", treeObject.Path );
 }
Beispiel #2
0
        public void TestGetParentIdsFromPath_1Level()
        {
            Guid oneLevelId = Guid.NewGuid();
            var  entity     = new GuidTreeObject(oneLevelId);

            entity.InitPath();
            Assert.AreEqual(0, entity.GetParentIdsFromPath().Count);
        }
Beispiel #3
0
        public void TestInitPath_1Level_Guid()
        {
            var id         = Guid.NewGuid();
            var treeObject = new GuidTreeObject(id);

            treeObject.InitPath();
            Assert.AreEqual(1, treeObject.Level);
            Assert.AreEqual(id + ",", treeObject.Path);
        }
Beispiel #4
0
 public void TestInitPath_2Level_Guid() {
     var parentId = Guid.NewGuid();
     var id = Guid.NewGuid();
     var parent = new GuidTreeObject( parentId );
     parent.InitPath();
     var treeObject = new GuidTreeObject( id ) { Parent = parent };
     treeObject.InitPath();
     Assert.AreEqual( 2, treeObject.Level );
     Assert.AreEqual( string.Format( "{0},{1},",parentId,id ), treeObject.Path );
 }
Beispiel #5
0
 public void TestInitPath_3Level_Guid() {
     Guid oneLevelId = Guid.NewGuid();
     Guid twoLevelId = Guid.NewGuid();
     Guid threeLevelId = Guid.NewGuid();
     var oneLevel = new GuidTreeObject( oneLevelId );
     oneLevel.InitPath();
     var twoLevel = new GuidTreeObject( twoLevelId ) { Parent = oneLevel };
     twoLevel.InitPath();
     var treeObject = new GuidTreeObject( threeLevelId ) { Parent = twoLevel };
     treeObject.InitPath();
     Assert.AreEqual( 3, treeObject.Level );
     Assert.AreEqual( string.Format( "{0},{1},{2},", oneLevelId, twoLevelId, threeLevelId ), treeObject.Path );
 }
Beispiel #6
0
        public void TestInitPath_2Level_Guid()
        {
            var parentId = Guid.NewGuid();
            var id       = Guid.NewGuid();
            var parent   = new GuidTreeObject(parentId);

            parent.InitPath();
            var treeObject = new GuidTreeObject(id)
            {
                Parent = parent
            };

            treeObject.InitPath();
            Assert.AreEqual(2, treeObject.Level);
            Assert.AreEqual(string.Format("{0},{1},", parentId, id), treeObject.Path);
        }
Beispiel #7
0
        public void TestGetParentIdsFromPath_2Level()
        {
            var parentId = Guid.NewGuid();
            var id       = Guid.NewGuid();
            var parent   = new GuidTreeObject(parentId);

            parent.InitPath();
            var entity = new GuidTreeObject(id)
            {
                Parent = parent
            };

            entity.InitPath();
            Assert.AreEqual(1, entity.GetParentIdsFromPath().Count);
            Assert.AreEqual(parentId, entity.GetParentIdsFromPath()[0]);
        }
Beispiel #8
0
        public void TestInitPath_3Level_Guid()
        {
            Guid oneLevelId   = Guid.NewGuid();
            Guid twoLevelId   = Guid.NewGuid();
            Guid threeLevelId = Guid.NewGuid();
            var  oneLevel     = new GuidTreeObject(oneLevelId);

            oneLevel.InitPath();
            var twoLevel = new GuidTreeObject(twoLevelId)
            {
                Parent = oneLevel
            };

            twoLevel.InitPath();
            var treeObject = new GuidTreeObject(threeLevelId)
            {
                Parent = twoLevel
            };

            treeObject.InitPath();
            Assert.AreEqual(3, treeObject.Level);
            Assert.AreEqual(string.Format("{0},{1},{2},", oneLevelId, twoLevelId, threeLevelId), treeObject.Path);
        }
Beispiel #9
0
 public void TestGetParentIdsFromPath_2Level() {
     var parentId = Guid.NewGuid();
     var id = Guid.NewGuid();
     var parent = new GuidTreeObject( parentId );
     parent.InitPath();
     var entity = new GuidTreeObject( id ) { Parent = parent };
     entity.InitPath();
     Assert.AreEqual( 1, entity.GetParentIdsFromPath().Count );
     Assert.AreEqual( parentId, entity.GetParentIdsFromPath()[0] );
 }
Beispiel #10
0
 public void TestGetParentIdsFromPath_1Level() {
     Guid oneLevelId = Guid.NewGuid();
     var entity = new GuidTreeObject( oneLevelId );
     entity.InitPath();
     Assert.AreEqual( 0, entity.GetParentIdsFromPath().Count );
 }
Beispiel #11
0
 public void TestGetParentIdsFromPath_ContainsSelf() {
     Guid oneLevelId = Guid.NewGuid();
     var entity = new GuidTreeObject( oneLevelId );
     entity.InitPath();
     Assert.AreEqual( 1, entity.GetParentIdsFromPath(false).Count );
 }