Пример #1
0
        public void LoadingDefaultInheritanceUpdatesAllProperties()
        {
            var inheritanceSource = new ConnectionInfoInheritance(new object(), true);

            inheritanceSource.TurnOnInheritanceCompletely();
            DefaultConnectionInheritance.Instance.LoadFrom(inheritanceSource);
            Assert.That(DefaultConnectionInheritance.Instance.EverythingInherited, Is.True);
        }
Пример #2
0
        private static void ImportComputers(string ldapPath, TreeNode parentTreeNode)
        {
            try
            {
                const string ldapFilter = "(objectClass=computer)";

                var ldapSearcher = new DirectorySearcher();
                var ldapResults  = default(SearchResultCollection);
                var ldapResult   = default(SearchResult);

                ldapSearcher.SearchRoot = new DirectoryEntry(ldapPath);
                ldapSearcher.PropertiesToLoad.AddRange(new[] { "securityEquals", "cn" });
                ldapSearcher.Filter      = ldapFilter;
                ldapSearcher.SearchScope = SearchScope.OneLevel;

                ldapResults = ldapSearcher.FindAll();

                foreach (SearchResult tempLoopVar_ldapResult in ldapResults)
                {
                    ldapResult = tempLoopVar_ldapResult;
                    var with_2      = ldapResult.GetDirectoryEntry();
                    var displayName = Convert.ToString(with_2.Properties["cn"].Value);
                    var description = Convert.ToString(with_2.Properties["Description"].Value);
                    var hostName    = Convert.ToString(with_2.Properties["dNSHostName"].Value);

                    var treeNode = ConnectionTreeNode.AddNode(TreeNodeType.Connection, displayName);

                    var connectionInfo  = new ConnectionInfo();
                    var inheritanceInfo = new ConnectionInfoInheritance(connectionInfo);
                    inheritanceInfo.TurnOnInheritanceCompletely();
                    inheritanceInfo.Description = false;
                    if (parentTreeNode.Tag is ContainerInfo)
                    {
                        connectionInfo.Parent = (ContainerInfo)parentTreeNode.Tag;
                    }
                    connectionInfo.Inheritance = inheritanceInfo;
                    connectionInfo.Name        = displayName;
                    connectionInfo.Hostname    = hostName;
                    connectionInfo.Description = description;
                    connectionInfo.TreeNode    = treeNode;
                    treeNode.Name = displayName;
                    treeNode.Tag  = connectionInfo;                    //set the nodes tag to the conI
                    //add connection to connections
                    Runtime.ConnectionList.Add(connectionInfo);

                    parentTreeNode.Nodes.Add(treeNode);
                }
            }
            catch (Exception ex)
            {
                Runtime.MessageCollector.AddExceptionMessage("Config.Import.ActiveDirectory.ImportComputers() failed.", ex, logOnly: true);
            }
        }
        public void LoadingDefaultInheritanceUpdatesAllProperties(PropertyInfo property)
        {
            var inheritanceSource = new ConnectionInfoInheritance(new ConnectionInfo(), true);

            inheritanceSource.TurnOnInheritanceCompletely();
            DefaultConnectionInheritance.Instance.TurnOffInheritanceCompletely();

            DefaultConnectionInheritance.Instance.LoadFrom(inheritanceSource);

            var valueInDestination = property.GetValue(DefaultConnectionInheritance.Instance);
            var valueInSource      = property.GetValue(inheritanceSource);

            Assert.That(valueInDestination, Is.EqualTo(valueInSource));
        }
Пример #4
0
 public void TurnOnInheritanceCompletely()
 {
     _inheritance.TurnOnInheritanceCompletely();
     Assert.That(AllInheritancePropertiesAreTrue(), Is.True);
 }