public static Initialize ( ITestSite testSite ) : void | ||
testSite | ITestSite | The instance of ITestSite. |
return | void |
/// <summary> /// Initialize SUT control adapter. /// </summary> /// <param name="testSite">The test site instance associated with the current adapter.</param> public override void Initialize(ITestSite testSite) { base.Initialize(testSite); AdapterHelper.Initialize(testSite); this.listsService = new ListsSoap(); string transportType = Common.GetConfigurationPropertyValue("TransportType", testSite); this.listsService.Url = Common.GetConfigurationPropertyValue("MSLISTSWSServiceUrl", testSite); string domain = Common.GetConfigurationPropertyValue("Domain", testSite); string userName = Common.GetConfigurationPropertyValue("UserName", testSite); string userPassword = Common.GetConfigurationPropertyValue("Password", testSite); this.listsService.Credentials = new NetworkCredential(userName, userPassword, domain); SoapVersion soapVersion = Common.GetConfigurationPropertyValue <SoapVersion>("SoapVersion", this.Site); switch (soapVersion) { case SoapVersion.SOAP11: this.listsService.SoapVersion = SoapProtocolVersion.Soap11; break; default: this.listsService.SoapVersion = SoapProtocolVersion.Soap12; break; } if (string.Compare(transportType, "https", true, System.Globalization.CultureInfo.CurrentCulture) == 0) { Common.AcceptServerCertificate(); } }
/// <summary> /// Initialize the protocol adapter. /// </summary> /// <param name="testSite">Transfer ITestSite into adapter, make adapter can use ITestSite's function.</param> public override void Initialize(ITestSite testSite) { base.Initialize(testSite); testSite.DefaultProtocolDocShortName = "MS-VERSS"; AdapterHelper.Initialize(testSite); if (this.service == null) { string globalConfigFileName = Common.GetConfigurationPropertyValue("CommonConfigurationFileName", testSite); Common.MergeGlobalConfig(globalConfigFileName, testSite); Common.CheckCommonProperties(this.Site, true); Common.MergeSHOULDMAYConfig(testSite); this.service = Proxy.CreateProxy <VersionsSoap>(testSite); this.service.Url = Common.GetConfigurationPropertyValue("MSVERSSServiceUrl", testSite); SoapVersion soapVersion = Common.GetConfigurationPropertyValue <SoapVersion>("SoapVersion", this.Site); switch (soapVersion) { case SoapVersion.SOAP11: this.service.SoapVersion = SoapProtocolVersion.Soap11; break; default: this.service.SoapVersion = SoapProtocolVersion.Soap12; break; } TransportProtocol transportType = Common.GetConfigurationPropertyValue <TransportProtocol>("TransportType", this.Site); switch (transportType) { case TransportProtocol.HTTPS: Common.AcceptServerCertificate(); this.transportProtocol = TransportProtocol.HTTPS; break; default: this.transportProtocol = TransportProtocol.HTTP; break; } } string domain = Common.GetConfigurationPropertyValue("Domain", testSite); string userName = Common.GetConfigurationPropertyValue("UserName", testSite); string userPassword = Common.GetConfigurationPropertyValue("Password", testSite); this.service.Credentials = new NetworkCredential(userName, userPassword, domain); }