Пример #1
0
 /// <summary>
 /// Use TestCleanup to run code after each test has run
 /// </summary>
 protected override void TestCleanup()
 {
     if (apdsServerAdapter != null)
     {
         apdsServerAdapter.Dispose();
         apdsServerAdapter = null;
     }
 }
Пример #2
0
        /// <summary>
        /// Use TestInitialize to run code before running each test
        /// </summary>
        protected override void TestInitialize()
        {
            base.TestInitialize();
            Site.DefaultProtocolDocShortName = "MS-APDS";
            apdsServerAdapter = new ApdsServerAdapter();
            apdsServerAdapter.Initialize(Site);

            ServerVersion serverVersion = (ServerVersion)apdsServerAdapter.PDCOSVersion;

            if (serverVersion == ServerVersion.Win2008)
            {
                currentOS = OSVersion.WINSVR2008;
            }
            else if (serverVersion == ServerVersion.Win2008R2)
            {
                currentOS = OSVersion.WINSVR2008R2;
            }
            else if (serverVersion == ServerVersion.Win2012)
            {
                currentOS = OSVersion.WINSVR2012;
            }
            else if (serverVersion == ServerVersion.Win2012R2)
            {
                currentOS = OSVersion.WINSVR2012R2;
            }
            else if (serverVersion == ServerVersion.NonWin)
            {
                currentOS = OSVersion.NONWINDOWS;
            }
            else
            {
                currentOS = OSVersion.OTHER;
            }
            isServerWindows = currentOS != OSVersion.NONWINDOWS;

            resourceDCName      = apdsServerAdapter.PDCNetbiosName + "." + apdsServerAdapter.PrimaryDomainDnsName;
            resourceDCIPAddress = apdsServerAdapter.PDCIPAddress;
            accountDCName       = apdsServerAdapter.TDCNetbiosName + "." + apdsServerAdapter.TrustDomainDnsName;
            accountDCIPAddress  = apdsServerAdapter.TDCIPAddress;
            // The value for registry key to block DC.
            blockDCkey = 7;
            // The value for registry key to set exception server for block DC.
            blockCDException = apdsServerAdapter.ENDPOINTNetbiosName;

            testUser = apdsServerAdapter.TrustDomainDnsName + "\\" + apdsServerAdapter.DomainAdministratorName;
            testManagedServiceAccount = apdsServerAdapter.ManagedServiceAccountName;


            // Get default registry key for DC blocker.
            if (currentOS >= OSVersion.WINSVR2008R2)
            {
                defaultResourceDCKey       = serverControlAdapter.GetDCBlockValue(resourceDCIPAddress);
                defaultAccountDCKey        = serverControlAdapter.GetDCBlockValue(accountDCIPAddress);
                defaultResourceDCException = serverControlAdapter.GetDCException(resourceDCIPAddress);
            }
        }