Exemplo n.º 1
0
        public IEnumerable GetChildren(object parent)
        {
            ObservableCollection <ServerTreeItem> observableCollection = new ObservableCollection <ServerTreeItem>();

            if (parent == null)
            {
                if (string.IsNullOrWhiteSpace(this._currentFilter))
                {
                    return(this._treeData);
                }
                foreach (ServerTreeItem current in this._treeData)
                {
                    if (!IsNullOrEmptyExtension.IsNullOrEmpty(this.GetChildren(current)))
                    {
                        observableCollection.Add(current);
                    }
                }
                return(observableCollection);
            }
            else
            {
                ServerTreeItem serverTreeItem = parent as ServerTreeItem;
                if (serverTreeItem == null)
                {
                    return(observableCollection);
                }
                if (string.IsNullOrEmpty(this._currentFilter))
                {
                    this.SortList(serverTreeItem.ServerTreeItems);
                    return(serverTreeItem.ServerTreeItems);
                }
                foreach (ServerTreeItem current2 in serverTreeItem.ServerTreeItems)
                {
                    if (current2.Name.IndexOf(this._currentFilter, StringComparison.InvariantCultureIgnoreCase) >= 0)
                    {
                        observableCollection.Add(current2);
                    }
                }
                this.SortList(observableCollection);
                return(observableCollection);
            }
        }
 public void IsNullOrEmpty()
 {
     Assert.IsTrue(IsNullOrEmptyExtension.IsNullOrEmpty(null));
     Assert.IsTrue(string.Empty.IsNullOrEmpty());
     Assert.IsFalse("lorem".IsNullOrEmpty());
 }