当前位置: 首页>>代码示例>>C#>>正文


C# ITestSite类代码示例

本文整理汇总了C#中ITestSite的典型用法代码示例。如果您正苦于以下问题:C# ITestSite类的具体用法?C# ITestSite怎么用?C# ITestSite使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ITestSite类属于命名空间,在下文中一共展示了ITestSite类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Initialize

 /// <summary>
 /// Overrides IAdapter's Initialize method, to set testSite.DefaultProtocolDocShortName.
 /// </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);
     Site.DefaultProtocolDocShortName = "MS-OXCFOLD";
     Common.MergeConfiguration(testSite);
     this.oxcropsClient = new OxcropsClient(MapiContext.GetDefaultRpcContext(this.Site));
 }
开发者ID:ClareMSYanGit,项目名称:Interop-TestSuites,代码行数:11,代码来源:MS-OXCFOLDAdapter.cs

示例2: ValidateUtil

 /// <summary>
 /// Initializes a new instance of the ValidateUtil class with specified parameters.
 /// </summary>
 /// <param name="testSite">Implements Microsoft.Protocols.TestTools.IAdapter.Site.</param>
 /// <param name="throwException">Indicate that whether throw exception when schema validation not success.</param>
 /// <param name="performSchemaValidation">Indicate that whether perform schema validation.</param>
 /// <param name="ignoreSoapFaultSchemaValidationForSoap12">Indicate that whether ignore schema validation for SOAP fault in SOAP1.2.</param>
 public ValidateUtil(ITestSite testSite, bool throwException, bool performSchemaValidation, bool ignoreSoapFaultSchemaValidationForSoap12)
 {
     this.site = testSite;
     this.throwException = throwException;
     this.performSchemaValidation = performSchemaValidation;
     this.ignoreSoapFaultSchemaValidationForSoap12 = ignoreSoapFaultSchemaValidationForSoap12;
 }
开发者ID:ClareMSYanGit,项目名称:Interop-TestSuites,代码行数:14,代码来源:ValidateUtil.cs

示例3: Initialize

 /// <summary>
 /// Initialize the adapter.
 /// </summary>
 /// <param name="testSite"> test site.</param>
 public override void Initialize(ITestSite testSite)
 {
     base.Initialize(ReqConfigurableSite.GetReqConfigurableSite(testSite));
     this.server = new PccrdServer(new Logger(testSite));
     this.server.ReceiveProbeMessage += new ReceiveProbeMessageHandler(this.Server_ReceiveProbeMessage);
     Site.DefaultProtocolDocShortName = "MS-PCCRD";
 }
开发者ID:Microsoft,项目名称:WindowsProtocolTestSuites,代码行数:11,代码来源:PccrdClientAdapter.cs

示例4: Initialize

        /// <summary>
        /// Initialize the adapter instance.
        /// </summary>
        /// <param name="testSite">A return value represents the ITestSite instance which contains the test context.</param>
        public override void Initialize(ITestSite testSite)
        {
            base.Initialize(testSite);
            TestSuiteManageHelper.Initialize(this.Site);
            TestSuiteManageHelper.AcceptServerCertificate();

            // Initial the listsws proxy without schema validation.
            if (null == this.listswsProxy)
            {
                this.listswsProxy = Proxy.CreateProxy<ListsSoap>(testSite, true, false, false);
            }

            FileUrlHelper.ValidateFileUrl(TestSuiteManageHelper.TargetServiceUrlOfMSCOPYS);

            // Point to listsws service according to the MS-COPYS service URL.
            string targetServiceUrl = Path.GetDirectoryName(TestSuiteManageHelper.TargetServiceUrlOfMSCOPYS);
            targetServiceUrl = Path.Combine(targetServiceUrl, @"lists.asmx");

            // Work around for local path format mapping to URL path format.
            targetServiceUrl = targetServiceUrl.Replace(@"\", @"/");
            targetServiceUrl = targetServiceUrl.Replace(@":/", @"://");

            // Setting the properties of listsws service proxy.
            this.listswsProxy.Url = targetServiceUrl;
            this.listswsProxy.Credentials = TestSuiteManageHelper.DefaultUserCredential;
            this.listswsProxy.SoapVersion = TestSuiteManageHelper.GetSoapProtoclVersionByCurrentSetting();

            // 60000 means the configure SOAP Timeout is in minute.
            this.listswsProxy.Timeout = TestSuiteManageHelper.CurrentSoapTimeOutValue;
        }
开发者ID:OfficeDev,项目名称:Interop-TestSuites,代码行数:34,代码来源:MS-COPYSSUTControlAdapter.cs

示例5: Initialize

        public override void Initialize(ITestSite testSite)
        {
            base.Initialize(testSite);

            // Call TcpAdapterBase.Connect() to verify if it works.
            Connect();
        }
开发者ID:LiuXiaotian,项目名称:ProtocolTestFramework,代码行数:7,代码来源:TestTcpAdapter.cs

示例6: GetDefaultRpcContext

        /// <summary>
        /// Get default RPC CALL Context
        /// </summary>
        /// <param name="site">The instance of ITestSite</param>
        /// <returns>RPC CALL Context</returns>
        public static MapiContext GetDefaultRpcContext(ITestSite site)
        {
            MapiContext mapiContext = new MapiContext
            {
                AuthenLevel = uint.Parse(Common.GetConfigurationPropertyValue("RpcAuthenticationLevel", site)),
                AuthenService = uint.Parse(Common.GetConfigurationPropertyValue("RpcAuthenticationService", site)),
                TransportSequence = Common.GetConfigurationPropertyValue("TransportSeq", site),
                SpnFormat = Common.GetConfigurationPropertyValue("ServiceSpnFormat", site)
            };
            if (mapiContext.TransportSequence.ToLower() == "ncacn_http")
            {
                bool rpchUseSsl;
                if (!bool.TryParse(Common.GetConfigurationPropertyValue("RpchUseSsl", site), out rpchUseSsl))
                {
                    site.Assert.Fail("Value of 'RpchUseSsl' property is invalid.");
                }

                mapiContext.RpchUseSsl = rpchUseSsl;
                mapiContext.RpchAuthScheme = Common.GetConfigurationPropertyValue("RpchAuthScheme", site);
                if (mapiContext.RpchAuthScheme.ToLower() != "basic" && mapiContext.RpchAuthScheme.ToLower() != "ntlm")
                {
                    site.Assert.Fail("Value of 'RpchAuthScheme' property is invalid.");
                }
            }

            mapiContext.SetUuid = bool.Parse(Common.GetConfigurationPropertyValue("SetUuid", site));
            mapiContext.TestSite = site;
            mapiContext.EXServerVersion = new ushort[3] { 0, 0, 0 };
            mapiContext.AutoRedirect = true;
            mapiContext.CodePageId = null;

            return mapiContext;
        }
开发者ID:ClareMSYanGit,项目名称:Interop-TestSuites,代码行数:38,代码来源:MapiContext.cs

示例7: Initialize

        /// <summary>
        /// Overrides the ManagedAdapterBase class' Initialize() method, it is used to initialize the adapter.
        /// </summary>
        /// <param name="testSite">A parameter represents the ITestSite instance, which is used to visit the test context.</param>
        public override void Initialize(ITestSite testSite)
        {
            base.Initialize(testSite);

            // Set the protocol name of current test suite
            Site.DefaultProtocolDocShortName = "MS-COPYS";

            TestSuiteManageHelper.Initialize(this.Site);

            // Merge the SHOULDMAY configuration file.
            Common.MergeSHOULDMAYConfig(this.Site);

            this.currentUser = TestSuiteManageHelper.DefaultUser;
            this.domainOfCurrentUser = TestSuiteManageHelper.DomainOfDefaultUser;
            this.passwordOfCurrentUser = TestSuiteManageHelper.PasswordOfDefaultUser;

            // Initialize the proxy class
            this.copySoapService = Proxy.CreateProxy<CopySoap>(this.Site, true, true, true);
            
            // Set service URL.
            this.copySoapService.Url = this.GetTargetServiceUrl(this.currentServiceLocation);

            // Set credential
            this.copySoapService.Credentials = TestSuiteManageHelper.DefaultUserCredential;

            // Set SOAP version
            this.copySoapService.SoapVersion = TestSuiteManageHelper.GetSoapProtoclVersionByCurrentSetting();

            // Accept Certificate
            TestSuiteManageHelper.AcceptServerCertificate();

            // set the service timeout.
            this.copySoapService.Timeout = TestSuiteManageHelper.CurrentSoapTimeOutValue;
        }
开发者ID:ClareMSYanGit,项目名称:Interop-TestSuites,代码行数:38,代码来源:MS-COPYSAdapter.cs

示例8: Initialize

        /// <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);

            this.listsService = new ListsSoap();

            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;
                    }
            }

            TransportProtocol transport = Common.GetConfigurationPropertyValue<TransportProtocol>("TransportType", this.Site);
            if (transport == TransportProtocol.HTTPS)
            {
                Common.AcceptServerCertificate();
            }
        }
开发者ID:OfficeDev,项目名称:Interop-TestSuites,代码行数:37,代码来源:MS-DWSSSUTControlAdapter.cs

示例9: KerberosFunctionalClient

        /// <summary>
        /// Construct a Kerberos test client for FAST
        /// </summary>
        /// <param name="domain">The realm part of the client's principal identifier.
        /// This argument cannot be null.</param>
        /// <param name="cName">The account to logon the remote machine. Either user account or computer account
        /// This argument cannot be null.</param>
        /// <param name="password">The password of the user. This argument cannot be null.</param>
        /// <param name="accountType">The type of the logon account. User or Computer</param>
        public KerberosFunctionalClient(string domain, string cName, string password, KerberosAccountType accountType, KerberosTicket armorTicket, EncryptionKey armorSessionKey, string kdcAddress, int kdcPort, TransportType transportType, KerberosConstValue.OidPkt omiPkt, ITestSite baseTestSite)
            : base(domain, cName, password, accountType, armorTicket, armorSessionKey, kdcAddress, kdcPort, transportType, omiPkt)
        {
            testSite = baseTestSite;
            if (accountType == KerberosAccountType.Device)
            {
                testSite.Log.Add(LogEntryKind.Debug, "Construct Kerberos client using computer account: {0}@{1}.",
                                    cName, domain);
            }
            else
            {
                testSite.Log.Add(LogEntryKind.Debug, "Construct Kerberos client using user account: {0}@{1}.",
                                    cName, domain);
            }
            EncryptionType[] encryptionTypes = new EncryptionType[]
            {
                EncryptionType.AES256_CTS_HMAC_SHA1_96,
                EncryptionType.AES128_CTS_HMAC_SHA1_96,
                EncryptionType.RC4_HMAC,
                EncryptionType.RC4_HMAC_EXP,
                EncryptionType.DES_CBC_CRC,
                EncryptionType.DES_CBC_MD5
            };

            KerbInt32[] etypes = new KerbInt32[encryptionTypes.Length];
            for (int i = 0; i < encryptionTypes.Length; i++)
            {
                etypes[i] = new KerbInt32((int)encryptionTypes[i]);
            }
            Asn1SequenceOf<KerbInt32> etype = new Asn1SequenceOf<KerbInt32>(etypes);

            Context.SupportedEType = etype;

            Context.Pvno = KerberosConstValue.KERBEROSV5;
        }
开发者ID:gitter-badger,项目名称:WindowsProtocolTestSuites,代码行数:44,代码来源:KerberosFunctionalClient.cs

示例10: CheckSyncChangeCommands

        /// <summary>
        /// This method is used to check the Sync Change commands.
        /// </summary>
        /// <param name="result">The sync result which is returned from server</param>
        /// <param name="subject">The expected note's subject</param>
        /// <param name="site">An instance of interface ITestSite which provides logging, assertions, and adapters for test code onto its execution context.</param>
        /// <returns>The boolean value which represents whether the note with expected subject is found or not in sync result</returns>
        internal static bool CheckSyncChangeCommands(SyncStore result, string subject, ITestSite site)
        {
            site.Assert.AreEqual<byte>(
                1,
                result.CollectionStatus,
                "The server should return a Status 1 in the Sync command response indicate sync command succeed.");

            bool isNoteFound = false;
            foreach (Sync sync in result.ChangeElements)
            {
                site.Assert.IsNotNull(
                    sync,
                    @"The Change element in response should not be null.");

                site.Assert.IsNotNull(
                    sync.Note,
                    @"The note class in response should not be null.");

                if (sync.Note.Subject.Equals(subject))
                {
                    isNoteFound = true;
                }
            }

            return isNoteFound;
        }
开发者ID:ClareMSYanGit,项目名称:Interop-TestSuites,代码行数:33,代码来源:TestSuiteHelper.cs

示例11: LogTestCaseDescription

        /// <summary>
        /// Add test case description to log
        /// </summary>
        /// <param name="testSite">TestSite interface which provides logging, assertions, and SUT adapters for test.</param>
        public static void LogTestCaseDescription(ITestSite testSite)
        {
            var testcase = (string)testSite.TestProperties["CurrentTestCaseName"];
            int lastDotIndex = testcase.LastIndexOf('.');
            string typeName = testcase.Substring(0, lastDotIndex);
            string methodName = testcase.Substring(lastDotIndex + 1);

            Assembly testcaseAssembly = Assembly.GetExecutingAssembly();
            var type = testcaseAssembly.GetType(typeName);
            if (type == null)
            {
                testSite.Assert.Fail(String.Format("Test case type name {0} does not exist in test case assembly {1}.", typeName, testcaseAssembly.FullName));
            }
            else
            {
                var method = type.GetMethod(methodName);
                var attributes = method.GetCustomAttributes(typeof(DescriptionAttribute), false);
                if (attributes == null)
                {
                    testSite.Assert.Fail("No description is provided for this case.");
                }
                else
                {
                    foreach (DescriptionAttribute attribute in attributes)
                    {
                        testSite.Log.Add(LogEntryKind.Comment, "[TestPurpose]" + attribute.Description);
                    }
                }
            }
        }
开发者ID:Microsoft,项目名称:WindowsProtocolTestSuites,代码行数:34,代码来源:SmbdUtilities.cs

示例12: IsRequirementVerificationDisabled

        /// <summary>
        /// This method checks if a requirement verification needs to be disabled.
        /// </summary>
        /// <param name="site">The related ITestSite instance.</param>
        /// <param name="requirementId">The requirement ID to be checked.</param>
        /// <returns>True indicates the requirement is disabled.</returns>
        public static bool IsRequirementVerificationDisabled(ITestSite site, int requirementId)
        {
            if (disabledRequirements == null)
            {
                // Parse disable requirement IDs.
                disabledRequirements = new List<int>();

                // Check if there is a ReqSwitch in the config.
                string strReqIds = site.Properties[ConfigPropNames.ReqSwitch];
                if (String.IsNullOrEmpty(strReqIds.Trim()))
                {
                    return false;
                }
                string[] ids = strReqIds.Split(new char[] { ',' });
                foreach (string id in ids)
                {
                    string sid = id.Trim();
                    int nid;
                    if (!int.TryParse(sid, out nid))
                    {
                        site.Assume.Fail("The value's format of disabled requirements property '{0}' is incorrect. For example, '1000, 1002'", ConfigPropNames.ReqSwitch);
                    }
                    disabledRequirements.Add(nid);
                }
            }

            return disabledRequirements.Contains(requirementId);
        }
开发者ID:gitter-badger,项目名称:WindowsProtocolTestSuites,代码行数:34,代码来源:CommonUtility.cs

示例13: GetConfigurationPropertyValue

        /// <summary>
        /// Get a specified property value from ptfconfig file.
        /// </summary>
        /// <param name="propertyName">The name of property.</param>
        /// <param name="site">An instance of interface ITestSite which provides logging, assertions,
        /// and adapters for test code onto its execution context.</param>
        /// <returns>The value of the specified property.</returns>
        public static string GetConfigurationPropertyValue(string propertyName, ITestSite site)
        {
            string propertyValue = site.Properties[propertyName];
            if (propertyValue != null)
            {
                string propertyRegex = @"\[(?<property>[^\[]+?)\]";

                if (Regex.IsMatch(propertyValue, propertyRegex, RegexOptions.IgnoreCase))
                {
                    propertyValue = Regex.Replace(
                        propertyValue,
                        propertyRegex,
                        (m) =>
                        {
                            string matchedPropertyName = m.Groups["property"].Value;
                            if (site.Properties[matchedPropertyName] != null)
                            {
                                return GetConfigurationPropertyValue(matchedPropertyName, site);
                            }
                            else
                            {
                                return m.Value;
                            }
                        },
                        RegexOptions.IgnoreCase);
                }
            }
            else if (string.Compare(propertyName, "CommonConfigurationFileName", StringComparison.CurrentCultureIgnoreCase) != 0)
            {
                // 'CommonConfigurationFileName' property can be set to null when the common properties were moved from the common ptfconfig file to the local ptfconfig file.
                site.Assert.Fail("Property '{0}' was not found in the ptfconfig file. Note: When processing property values, string in square brackets ([...]) will be replaced with the property value whose name is the same string.", propertyName);
            }

            return propertyValue;
        }
开发者ID:ClareMSYanGit,项目名称:Interop-TestSuites,代码行数:42,代码来源:Common.cs

示例14: Initialize

        /// <summary>
        /// Overrides IAdapter's Initialize(), to set testSite.DefaultProtocolDocShortName.
        /// </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-OFFICIALFILE";

            // Get the name of common configuration file.
            string commonConfigFileName = Common.Common.GetConfigurationPropertyValue("CommonConfigurationFileName", this.Site);

            // Merge the common configuration.
            Common.Common.MergeGlobalConfig(commonConfigFileName, this.Site);

            // Merge the Should/May configuration.
            Common.Common.MergeSHOULDMAYConfig(this.Site);

            // Initialize the OfficialFileSoap.
            this.officialfileService = Common.Proxy.CreateProxy<OfficialFileSoap>(testSite, true, true);

            AdapterHelper.Initialize(testSite);

            // Set the transportType.
            TransportType transportType = Common.Common.GetConfigurationPropertyValue<TransportType>("TransportType", this.Site);

            // Case request URl include HTTPS prefix, use this function to avoid closing base connection.
            // Local client will accept all certificate after execute this function. 
            if (transportType == TransportType.HTTPS)
            {
                AdapterHelper.AcceptAllCertificate();
            }

            // Set the version of the SOAP protocol used to make the SOAP request to the web service
            this.officialfileService.SoapVersion = Common.Common.GetConfigurationPropertyValue<SoapProtocolVersion>("SoapVersion", this.Site);
        }
开发者ID:OfficeDev,项目名称:Interop-TestSuites,代码行数:36,代码来源:MS-OFFICIALFILEAdapter.cs

示例15: GetEditorsTableFromResponse

        /// <summary>
        /// Get EditorsTable from server response.
        /// </summary>
        /// <param name="subResponse">The sub response from server.</param>
        /// <param name="site">Transfer ITestSite into this operation, for this operation to use ITestSite's function.</param>
        /// <returns>The instance of EditorsTable.</returns>
        public static EditorsTable GetEditorsTableFromResponse(FsshttpbResponse subResponse, ITestSite site)
        {
            if (subResponse == null || subResponse.DataElementPackage == null || subResponse.DataElementPackage.DataElements == null)
            {
                site.Assert.Fail("The parameter CellResponse is not valid, check whether the CellResponse::DataElementPackage or CellResponse::DataElementPackage::DataElements is null.");
            }

            foreach (DataElement de in subResponse.DataElementPackage.DataElements)
            {
                if (de.Data.GetType() == typeof(ObjectGroupDataElementData))
                {
                    ObjectGroupDataElementData ogde = de.Data as ObjectGroupDataElementData;

                    if (ogde.ObjectGroupData == null || ogde.ObjectGroupData.ObjectGroupObjectDataList.Count == 0)
                    {
                        continue;
                    }

                    for (int i = 0; i < ogde.ObjectGroupData.ObjectGroupObjectDataList.Count; i++)
                    {
                        if (IsEditorsTableHeader(ogde.ObjectGroupData.ObjectGroupObjectDataList[i].Data.Content.ToArray()))
                        {
                            string editorsTableXml = null;

                            // If the current object group object data is the header byte array 0x1a, 0x5a, 0x3a, 0x30, 0, 0, 0, 0, then the immediate following object group object data will contain the Editor table xml. 
                            byte[] buffer = ogde.ObjectGroupData.ObjectGroupObjectDataList[i + 1].Data.Content.ToArray();
                            System.IO.MemoryStream ms = null;
                            try
                            {
                                ms = new System.IO.MemoryStream();
                                ms.Write(buffer, 0, buffer.Length);
                                ms.Position = 0;
                                using (DeflateStream stream = new DeflateStream(ms, CompressionMode.Decompress))
                                {
                                    stream.Flush();
                                    byte[] decompressBuffer = new byte[buffer.Length * 3];
                                    stream.Read(decompressBuffer, 0, buffer.Length * 3);
                                    stream.Close();
                                    editorsTableXml = System.Text.Encoding.UTF8.GetString(decompressBuffer);
                                }

                                ms.Close();
                            }
                            finally
                            {
                                if (ms != null)
                                {
                                    ms.Dispose();
                                }
                            }

                            return GetEditorsTable(editorsTableXml);
                        }
                    }
                }
            }

            throw new InvalidOperationException("Cannot find any data group object data contain editor tables information.");
        }
开发者ID:OfficeDev,项目名称:Interop-TestSuites,代码行数:65,代码来源:EditorsTableUtils.cs


注:本文中的ITestSite类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。