public void GetOptimalWith_WhenOnlyHavingOneNodeAndResourceId_ShouldGetResourceId()
        {
            var node  = new Node(new XElement("node", new XAttribute("resource-id", "test")), null);
            var withs = _uniqueWithFinderService.GetUniqueWiths(node, new List <Node>()
            {
                node
            }, false);

            Assert.AreEqual(1, withs.Withs.Count);
            Assert.AreEqual(AttributeTags.ResourceId, withs.Withs.First());
        }
        private void Save()
        {
            UiObjectInfo.FindWith.Clear();
            foreach (var with in UsedWiths)
            {
                UiObjectInfo.FindWith.Add(with);
            }

            if (UseUniqueWiths)
            {
                UiObjectInfo.AutoSelectedWith = _uniqueWithFinderService.GetUniqueWiths(UiObjectInfo.Node, _allNodes, false);
            }
            else
            {
                UiObjectInfo.AutoSelectedWith = null;
            }

            UiObjectInfo.UpdateDisplayName();
            Close();
        }
        public bool AddNode(Node node)
        {
            var name = _dialogService.ShowNameDialog();

            if (!string.IsNullOrEmpty(name))
            {
                var uiNodeInfo = new UiObjectInfo
                {
                    Name             = name,
                    Node             = node,
                    FindWith         = new List <AttributeTags>(),
                    AutoSelectedWith = _uniqueWithFinderService.GetUniqueWiths(node, _topNode.AllNodes(), false),
                    DisplayName      = "Automatic"
                };
                MessengerInstance.Send(new AddUiObjectInfoMessage {
                    UiNodeInfo = uiNodeInfo
                });
                return(true);
            }

            return(false);
        }