/// <summary>
 /// Initializes the current adapter instance associated with a test site.
 /// </summary>
 /// <param name="testSite">The test site instance associated with the current adapter.</param>
 public override void Initialize(ITestSite testSite)
 {
     base.Initialize(testSite);
     testSite.DefaultProtocolDocShortName = "MS-OXNSPI";
     Common.MergeConfiguration(testSite);
     AdapterHelper.Site = testSite;
     if (bool.Parse(Common.GetConfigurationPropertyValue("MS-OXNSPI_Supported", this.Site)))
     {
         this.nspiRpcAdapter      = null;
         this.nspiMapiHttpAdapter = null;
         this.originalServerName  = Common.GetConfigurationPropertyValue("SutComputerName", this.Site);
         this.userName            = Common.GetConfigurationPropertyValue("User1Name", this.Site);
         this.Site.Assume.IsNotNull(this.userName, "The User1Name field in the ptfconfig file should not be null.");
         this.Site.Assume.IsNotNull(Common.GetConfigurationPropertyValue("User2Name", this.Site), "The User2Name field in the ptfconfig file should not be null.");
         this.Site.Assume.IsNotNull(Common.GetConfigurationPropertyValue("User3Name", this.Site), "The User3Name field in the ptfconfig file should not be null.");
         this.domainName = Common.GetConfigurationPropertyValue("Domain", this.Site);
         this.password   = Common.GetConfigurationPropertyValue("User1Password", this.Site);
         string publicFolderMailbox = Common.GetConfigurationPropertyValue("PublicFolderMailbox", this.Site);
         string requestURL          = Common.GetConfigurationPropertyValue("AutoDiscoverUrlFormat", this.Site);
         requestURL     = Regex.Replace(requestURL, @"\[ServerName\]", this.originalServerName, RegexOptions.IgnoreCase);
         this.transport = Common.GetConfigurationPropertyValue("TransportSeq", this.Site).ToLower(System.Globalization.CultureInfo.CurrentCulture);
         this.Site.Assert.IsTrue(this.transport == "mapi_http" || this.transport == "ncacn_http" || this.transport == "ncacn_ip_tcp", @"The TransportSeq field in the ptfconfig file must be set to one of the following three values: mapi_http, ncacn_http and ncacn_ip_tcp.");
         this.waitTime           = Convert.ToInt32(Common.GetConfigurationPropertyValue("WaitTime", testSite));
         this.maxRetryCount      = Convert.ToUInt32(Common.GetConfigurationPropertyValue("RetryCount", testSite));
         AdapterHelper.Transport = this.transport;
         if (this.transport == "ncacn_http" || this.transport == "ncacn_ip_tcp")
         {
             this.InitializeRPC();
             this.nspiRpcAdapter = new NspiRpcAdapter(this.Site, this.rpcBinding, this.contextHandle, this.waitTime, this.maxRetryCount);
         }
         else
         {
             AdapterHelper.SessionContextCookies = new CookieCollection();
             this.autoDiscoverProperties         = AutoDiscover.GetAutoDiscoverProperties(this.Site, this.originalServerName, this.userName, this.domainName, requestURL, this.transport, publicFolderMailbox);
             this.Site.Assert.IsNotNull(this.autoDiscoverProperties.AddressBookUrl, @"The auto discover process should return the URL to be used to connect with a NSPI server through MAPI over HTTP successfully.");
             this.nspiMapiHttpAdapter = new NspiMapiHttpAdapter(this.Site, this.userName, this.password, this.domainName, this.autoDiscoverProperties.AddressBookUrl);
         }
     }
 }
 /// <summary>
 /// Initializes the current adapter instance associated with a test site.
 /// </summary>
 /// <param name="testSite">The test site instance associated with the current adapter.</param>
 public override void Initialize(ITestSite testSite)
 {
     base.Initialize(testSite);
     testSite.DefaultProtocolDocShortName = "MS-OXNSPI";
     Common.MergeConfiguration(testSite);
     AdapterHelper.Site = testSite;
     if (bool.Parse(Common.GetConfigurationPropertyValue("MS-OXNSPI_Supported", this.Site)))
     {
         this.nspiRpcAdapter = null;
         this.nspiMapiHttpAdapter = null;
         this.originalServerName = Common.GetConfigurationPropertyValue("SutComputerName", this.Site);
         this.userName = Common.GetConfigurationPropertyValue("User1Name", this.Site);
         this.Site.Assume.IsNotNull(this.userName, "The User1Name field in the ptfconfig file should not be null.");
         this.Site.Assume.IsNotNull(Common.GetConfigurationPropertyValue("User2Name", this.Site), "The User2Name field in the ptfconfig file should not be null.");
         this.Site.Assume.IsNotNull(Common.GetConfigurationPropertyValue("User3Name", this.Site), "The User3Name field in the ptfconfig file should not be null.");
         this.domainName = Common.GetConfigurationPropertyValue("Domain", this.Site);
         this.password = Common.GetConfigurationPropertyValue("User1Password", this.Site);
         string requestURL = Common.GetConfigurationPropertyValue("AutoDiscoverUrlFormat", this.Site);
         requestURL = Regex.Replace(requestURL, @"\[ServerName\]", this.originalServerName, RegexOptions.IgnoreCase);
         this.transport = Common.GetConfigurationPropertyValue("TransportSeq", this.Site).ToLower(System.Globalization.CultureInfo.CurrentCulture);
         this.Site.Assert.IsTrue(this.transport == "mapi_http" || this.transport == "ncacn_http" || this.transport == "ncacn_ip_tcp", @"The TransportSeq field in the ptfconfig file must be set to one of the following three values: mapi_http, ncacn_http and ncacn_ip_tcp.");
         this.waitTime = Convert.ToInt32(Common.GetConfigurationPropertyValue("WaitTime", testSite));
         this.maxRetryCount = Convert.ToUInt32(Common.GetConfigurationPropertyValue("RetryCount", testSite));
         AdapterHelper.Transport = this.transport;
         if (this.transport == "ncacn_http" || this.transport == "ncacn_ip_tcp")
         {
             this.InitializeRPC();
             this.nspiRpcAdapter = new NspiRpcAdapter(this.Site, this.rpcBinding, this.contextHandle, this.waitTime, this.maxRetryCount);
         }
         else
         {
             AdapterHelper.SessionContextCookies = new CookieCollection();
             this.autoDiscoverProperties = AutoDiscover.GetAutoDiscoverProperties(this.Site, this.originalServerName, this.userName, this.domainName, requestURL, this.transport);
             this.Site.Assert.IsNotNull(this.autoDiscoverProperties.AddressBookUrl, @"The auto discover process should return the URL to be used to connect with a NSPI server through MAPI over HTTP successfully.");
             this.nspiMapiHttpAdapter = new NspiMapiHttpAdapter(this.Site, this.userName, this.password, this.domainName, this.autoDiscoverProperties.AddressBookUrl);
         }
     }
 }