示例#1
0
        public void Remove_RemovesSecondDepthChild()
        {
            var tableEntity = new TableEntity()
            {
                Eid = 0
            };
            var tableEntity2 = new TableEntity()
            {
                Eid = 1
            };
            var tableEntity3 = new TableEntity()
            {
                Eid = 2
            };

            var dictionaryGraphNode3 = new DictionaryGraphNode <TableEntity>(tableEntity3.Eid, tableEntity3);
            var dictionaryGraphNode2 = new DictionaryGraphNode <TableEntity>(tableEntity2.Eid, tableEntity2);
            var dictionaryGraphNode  = new DictionaryGraphNode <TableEntity>(tableEntity.Eid, tableEntity);

            dictionaryGraphNode2.Add(dictionaryGraphNode3);
            dictionaryGraphNode.Add(dictionaryGraphNode2);

            dictionaryGraphNode.Remove(dictionaryGraphNode3);

            dictionaryGraphNode.Contains(dictionaryGraphNode3).Should().BeFalse();
        }
示例#2
0
        public void Remove_SetsChildParentToNull()
        {
            var tableEntity = new TableEntity()
            {
                Eid = 0
            };
            var tableEntity2 = new TableEntity()
            {
                Eid = 1
            };
            var dictionaryGraphNode  = new DictionaryGraphNode <TableEntity>(tableEntity.Eid, tableEntity);
            var dictionaryGraphNode2 = new DictionaryGraphNode <TableEntity>(tableEntity2.Eid, tableEntity2);

            dictionaryGraphNode.Add(dictionaryGraphNode2);

            dictionaryGraphNode.Remove(dictionaryGraphNode2);

            dictionaryGraphNode2.Parent.Should().BeNull();
        }
示例#3
0
        public void Remove_NoEntity_FalseReturned()
        {
            var tableEntity = new TableEntity()
            {
                Eid = 0
            };
            var tableEntity2 = new TableEntity()
            {
                Eid = 1
            };
            var dictionaryGraphNode  = new DictionaryGraphNode <TableEntity>(tableEntity.Eid, tableEntity);
            var dictionaryGraphNode2 = new DictionaryGraphNode <TableEntity>(tableEntity2.Eid, tableEntity2);

            dictionaryGraphNode.Add(dictionaryGraphNode2);

            var response = dictionaryGraphNode.Remove(3);

            response.Should().BeFalse();
        }