public TreeViewModel_ISOHierarchie_Test()
        {
            rootMock = new Mock<ISerializableObject>();
            childMock = new Mock<ISerializableObject>();
            var childGUID = Guid.NewGuid();
            childMock.Setup(c => c.Rowguid).Returns(childGUID);

            gc1Mock = new Mock<ISerializableObject>();
            gc2Mock = new Mock<ISerializableObject>();

            rootVMMock = new Mock<IISOViewModel>();
            rootVMMock.Setup(v => v.Parent).Returns(() => null);
            rootVMMock.Setup(v => v.ISO).Returns(rootMock.Object);
            rootVMMock.Setup(v => v.Name).Returns(rootName);
            rootVMMock.Setup(v => v.Rowguid).Returns(Guid.NewGuid());

            childVMMock = new Mock<IISOViewModel>();
            childVMMock.Setup(v => v.Parent).Returns(rootMock.Object);
            childVMMock.Setup(v => v.Children).Returns(enumerableChildren());
            childVMMock.Setup(v => v.ISO).Returns(childMock.Object);
            childVMMock.Setup(v => v.Name).Returns(childName);
            childVMMock.Setup(v => v.Rowguid).Returns(childGUID);

            gc1VMMock = new Mock<IISOViewModel>();
            gc1VMMock.Setup(v => v.Parent).Returns(childMock.Object);
            gc1VMMock.Setup(v => v.Children).Returns(Enumerable.Empty<ISerializableObject>());
            gc1VMMock.Setup(v => v.Name).Returns(gcName);
            gc1VMMock.Setup(v => v.ISO).Returns(gc1Mock.Object);
            gc1VMMock.Setup(v => v.Rowguid).Returns(Guid.NewGuid());

            gc2VMMock = new Mock<IISOViewModel>();
            gc2VMMock.Setup(v => v.Parent).Returns(childMock.Object);
            gc2VMMock.Setup(v => v.Children).Returns(Enumerable.Empty<ISerializableObject>());
            gc2VMMock.Setup(v => v.ISO).Returns(gc2Mock.Object);
            gc2VMMock.Setup(v => v.Name).Returns(gcName);
            gc2VMMock.Setup(v => v.Rowguid).Returns(Guid.NewGuid());

            storeMock = new Mock<IISOViewModelStore>();
            storeMock.Setup(s => s.addOrRetrieveVMForISO(rootMock.Object)).Returns(rootVMMock.Object);
            storeMock.Setup(s => s.addOrRetrieveVMForISO(childMock.Object)).Returns(childVMMock.Object);
            storeMock.Setup(s => s.addOrRetrieveVMForISO(gc1Mock.Object)).Returns(gc1VMMock.Object);
            storeMock.Setup(s => s.addOrRetrieveVMForISO(gc2Mock.Object)).Returns(gc2VMMock.Object);

            tree = new TreeViewModel(storeMock.Object);
            tree.addGenerator(childVMMock.Object);
            root = tree.Roots.First();
            child = root.Children.First();
        }
            public NodeViewModel(IISOViewModel vm, TreeViewModel owner)
            {
                _vm = vm;
                _owner = owner;
                if(_vm != null && _vm.Properties != null)
                    foreach (var property in _vm.Properties)
                    {
                        _propertyVMs.Add(_owner.addOrRetrieveISOVM(property));
                    }

                _childNodes = new List<NodeViewModel>();
                var firstChilld = _vm.Children.FirstOrDefault();
                if (firstChilld != null)
                {
                    var childVM = _owner.addOrRetrieveISOVM(firstChilld);
                    var node = _owner.addOrRetrieveNode(childVM);
                    _childNodes.Add(node);
                }
            }
        public TreeViewModelTest()
        {
            //Mock ISO
            rootISOMock = new Mock<ISerializableObject>();
            rootISOMock.Setup(o=>o.Rowguid).Returns(Guid.NewGuid());
            _rootISO = rootISOMock.Object;

            //VM returned for the above ISO
            rootVMMock = new Mock<IISOViewModel>();
            rootVMMock.Setup(o => o.Parent).Returns(()=>null);
            rootVMMock.Setup(o => o.Name).Returns(_rootISOName).Verifiable();
            rootVMMock.Setup(o => o.Icon).Returns(ISOIcon.Agent).Verifiable();
            rootVMMock.Setup(o => o.Rowguid).Returns(_rootISO.Rowguid);

            storeMock = new Mock<IISOViewModelStore>();
            storeMock.Setup(s => s.addOrRetrieveVMForISO(_rootISO)).Returns(rootVMMock.Object).Verifiable();
            _store = storeMock.Object;

             _tree = new TreeViewModel(_store);
        }
            public NodeViewModel(IISOViewModel vm, TreeViewModel owner)
            {
                _vm    = vm;
                _owner = owner;
                if (_vm != null && _vm.Properties != null)
                {
                    foreach (var property in _vm.Properties)
                    {
                        _propertyVMs.Add(_owner.addOrRetrieveISOVM(property));
                    }
                }

                _childNodes = new List <NodeViewModel>();
                var firstChilld = _vm.Children.FirstOrDefault();

                if (firstChilld != null)
                {
                    var childVM = _owner.addOrRetrieveISOVM(firstChilld);
                    var node    = _owner.addOrRetrieveNode(childVM);
                    _childNodes.Add(node);
                }
            }