/// <summary>
        /// Clean up Test Environment
        /// </summary>
        /// <returns></returns>
        protected bool InitEnvironment()
        {
            bool cleanupSuccess = false;
            //use methodName to create logs.
            string methodName = System.Reflection.MethodInfo.GetCurrentMethod().Name;

            System.Environment.SetEnvironmentVariable("MS_ADOD_TESTCASENAME", methodName);

            //unjoin domain if the client is still domain joined
            this.TestSite.Log.Add(LogEntryKind.Debug, "Check if domain unjoined.");
            cleanupSuccess = this.ClientControlAdapter.IsUnjoinDomainSuccess();
            if (!cleanupSuccess)
            {
                this.TestSite.Log.Add(LogEntryKind.Comment, "Unjoining domain...");
                this.ClientControlAdapter.UnjoinDomain();
                cleanupSuccess = DoUntilSucceed(() => this.ClientControlAdapter.IsUnjoinDomainSuccess(),
                                                this.TestConfig.Timeout,
                                                TimeSpan.FromSeconds(5));
            }
            this.TestSite.Assert.IsTrue(cleanupSuccess, "Unjoin domain should succeed.");
            this.TestSite.Log.Add(LogEntryKind.Debug, "Clean up Computer Accounts from Active Directory.");
            if (ActiveDirectoryHelper.IsComputerExist(this.TestConfig.ClientComputerName))
            {
                ActiveDirectoryHelper.DeleteComputer(this.TestConfig.ClientComputerName);
            }

            //clean up information on dc
            this.TestSite.Log.Add(LogEntryKind.Debug, "Clean up Group Accounts from Active Directory.");
            if (ActiveDirectoryHelper.IsGroupExist(this.TestConfig.DomainNewGroup))
            {
                ActiveDirectoryHelper.DeleteGroup(this.TestConfig.DomainNewGroup);
            }
            this.TestSite.Log.Add(LogEntryKind.Debug, "Clean up User Accounts from Active Directory.");
            if (ActiveDirectoryHelper.IsUserExist(this.TestConfig.DomainNewUserUsername))
            {
                ActiveDirectoryHelper.DeleteUser(this.TestConfig.DomainNewUserUsername);
            }

            System.Environment.SetEnvironmentVariable("MS_ADOD_TESTCASENAME", string.Empty);
            return(cleanupSuccess);
        }