/// <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;
 }
        /// <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);
        }
 /// <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));
 }
        public override void Initialize(ITestSite testSite)
        {
            base.Initialize(testSite);

            // Call TcpAdapterBase.Connect() to verify if it works.
            Connect();
        }
        /// <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;
        }
        /// <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;
        }
        /// <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);
                    }
                }
            }
        }
        /// <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;
        }
        /// <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();
            }
        }
        /// <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);
        }
        /// <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;
        }
        /// <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;
        }
 /// <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";
 }
        /// <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;
        }
        /// <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.");
        }
 /// <summary>
 /// Initializes adapter
 /// </summary>
 /// <param name="testSite">The instance of the ITestSite.</param>
 public override void Initialize(ITestSite testSite)
 {
     base.Initialize(testSite);
     Site.DefaultProtocolDocShortName = "MS-OXCRPC";
     AdapterHelper.Initialize(testSite);
     Common.MergeConfiguration(testSite);
     this.RegisterROPDeserializer();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="NspiMapiHttpAdapter" /> class.
 /// </summary>
 /// <param name="site">The Site instance.</param>
 /// <param name="userName">The Mailbox userName which can be used by client to connect to the SUT.</param>
 /// <param name="password">The user password which can be used by client to access to the SUT.</param>
 /// <param name="domainName">Define the name of domain where the server belongs to.</param>
 /// <param name="addressBookUrl">The URL that a client can use to connect with a NSPI server through MAPI over HTTP.</param>
 public NspiMapiHttpAdapter(ITestSite site, string userName, string password, string domainName, string addressBookUrl)
 {
     this.site = site;
     this.userName = userName;
     this.password = password;
     this.domainName = domainName;
     this.addressBookUrl = addressBookUrl;
 }
        public override void Initialize(ITestSite testSite)
        {
            base.Initialize(testSite);

            info[LogInformationName.ClientName] = Dns.GetHostName();

            info[LogInformationName.ClientOSInfo] = Environment.OSVersion;
        }
 public override void Initialize(ITestSite testSite)
 {
     this.site = testSite;
     this.rdprfxAdapter = (IRdprfxAdapter)Site.GetAdapter(typeof(IRdprfxAdapter));
     this.rdprfxAdapter.Initialize(testSite);
     this.rdpbcgrAdapter = (IRdpbcgrAdapter)Site.GetAdapter(typeof(IRdpbcgrAdapter));
     RdpeiUtility.Initialized(this.site);
 }
 public override void Initialize(ITestSite testSite)
 {
     base.Initialize(testSite);
     foreach (string key in testSite.Properties.AllKeys)
     {
         info.Add(key, testSite.Properties[key]);
     }
 }
 /// <summary>
 /// Initializes a new instance of the DefaultDurableHandleV2ResponseChecker class with specified TestSite, Flag and Timeout.
 /// Timeout checking can be skipped, because it could be an implementation-specific value.
 /// </summary>
 /// <param name="TestSite">The TestSite used to provide logging, assertions, and SUT adapters.</param>
 /// <param name="flag">The expected CREATE_DURABLE_HANDLE_RESPONSE_V2_Flags in the response.</param>
 /// <param name="timeout">The expected Timeout in the response. 0xFFFFFFFF indicates not checking this field.</param>
 public DefaultDurableHandleV2ResponseChecker(ITestSite TestSite,
     CREATE_DURABLE_HANDLE_RESPONSE_V2_Flags flag,
     uint timeout)
     : base(TestSite, typeof(Smb2CreateDurableHandleResponseV2))
 {
     this.flag = flag;
     this.timeout = timeout;
 }
 /// <summary>
 /// Initializes a new instance of the NspiRpcAdapter class.
 /// </summary>
 /// <param name="site">The site instance.</param>
 /// <param name="rpcBinding">The RPC binding.</param>
 /// <param name="contextHandle">The RPC context handle.</param>
 /// <param name="waitTime">The time internal that is used to wait to retry when the returned error code is GeneralFailure.</param>
 /// <param name="maxRetryCount">The retry count that is used to retry when the returned error code is GeneralFailure.</param>
 public NspiRpcAdapter(ITestSite site, IntPtr rpcBinding, IntPtr contextHandle, int waitTime, uint maxRetryCount)
 {
     this.site = site;
     this.rpcBinding = rpcBinding;
     this.contextHandle = contextHandle;
     this.waitTime = waitTime;
     this.maxRetryCount = maxRetryCount;
 }
        /// <summary>
        /// The method to send MAPIHTTP request to the server.
        /// </summary>
        /// <param name="site">An instance of interface ITestSite which provides logging, assertions,
        /// and adapters for test code onto its execution context.</param>
        /// <param name="mailStoreUrl">Mail store url.</param>
        /// <param name="userName">The user which connects the server.</param>
        /// <param name="domain">The domain of the user.</param>
        /// <param name="password">The password for the user.</param>
        /// <param name="requestBody">The MAPIHTTP request body.</param>
        /// <param name="requestType">The MAPIHTTP request type.</param>
        /// <param name="cookies">Cookie container for client.</param>
        /// <returns>Return the MAPIHTTP response from the server.</returns>
        public static HttpWebResponse SendMAPIHttpRequest(ITestSite site, string mailStoreUrl, string userName, string domain, string password, IRequestBody requestBody, string requestType, CookieCollection cookies)
        {
            HttpWebResponse response = null;

            System.Net.ServicePointManager.ServerCertificateValidationCallback =
            new System.Net.Security.RemoteCertificateValidationCallback(Common.ValidateServerCertificate);
            HttpWebRequest request = WebRequest.Create(mailStoreUrl) as HttpWebRequest;
            request.KeepAlive = true;
            request.CookieContainer = new CookieContainer();
            request.Method = "POST";
            request.ProtocolVersion = HttpVersion.Version11;
            request.Credentials = new System.Net.NetworkCredential(userName, password, domain);
            request.ContentType = "application/mapi-http";
            request.Accept = "application/mapi-http";
            request.Connection = string.Empty;

            byte[] buffer = null;
            if (requestBody != null)
            {
                buffer = requestBody.Serialize();
                request.ContentLength = buffer.Length;
            }
            else
            {
                request.ContentLength = 0;
            }

            request.Headers.Add("X-ClientInfo", "{A7A47AAD-233C-412B-9D10-DDE9108FEBD7}-5");
            request.Headers.Add("X-RequestId", "{16AC2587-EED8-48EB-8A7B-D48558B68BD7}:1");
            request.Headers.Add("X-ClientApplication", "Outlook/15.00.0856.000");
            request.Headers.Add("X-RequestType", requestType);
            if (cookies != null && cookies.Count > 0)
            {
                foreach (Cookie cookie in cookies)
                {
                    request.CookieContainer.Add(cookie);
                }
            }

            if (requestBody != null)
            {
                using (Stream stream = request.GetRequestStream())
                {
                    stream.Write(buffer, 0, buffer.Length);
                }
            }

            try
            {
                response = request.GetResponse() as HttpWebResponse;
            }
            catch (WebException ex)
            {
                site.Assert.Fail("A WebException happened when connecting the server, The exception is {0}.", ex.Message);
            }

            return response;
        }
 public SmbdAdapter(
     ITestSite testSite,
     SmbdLogEvent logNotifyCompletion = null)
 {
     this.Initialize(testSite);
     this.client = new Smb2OverSmbdTestClient(
         testConfig.Smb2ConnectionTimeout,
         testConfig.RdmaLayerLoggingEnabled ? logNotifyCompletion : null);
 }
        /// <summary>
        /// Initializes a new instance of the Logger class.
        /// </summary>
        /// <param name="site">An instance of ITestSite.</param>
        public Logger(ITestSite site)
        {
            if (null == site)
            {
                throw new ArgumentNullException("site", "The input parameter (site) is null.");
            }

            this.site = site;
        }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="site">The test site which is used to log error message.</param>
 public PtfOptionParser(ITestSite site)
 {
     if (site == null)
     {
         throw new InvalidOperationException(
             "Test site cannot be null.");
     }
     this.site = site;
 }
 /// <summary>
 /// Initializes the RdpeiUtility class.
 /// </summary>
 /// <param name="tSite">Instance of ITestSite.</param>
 public static void Initialized(ITestSite tSite)
 {
     if (Site == null)
     {
         Site = tSite;
         rdpbcgrAdapter = Site.GetAdapter<IRdpbcgrAdapter>();
         rdprfxAdapter = Site.GetAdapter<IRdprfxAdapter>();
     }
 }
        /// <summary>
        /// This method is used to get the sub request type using the specified sub request token.
        /// </summary>
        /// <param name="subRequestID">Specify the sub request token.</param>
        /// <param name="site">An object provides logging, assertions, and SUT adapters for test code onto its execution context.</param>
        /// <returns>Return the sub request type.</returns>
        public static RequestTypes GetSubRequestType(int subRequestID, ITestSite site)
        {
            if (!msfsshttpbSubRequestIDTypeMapping.ContainsKey(subRequestID))
            {
                site.Assert.Fail("Not record the sub-request id, possible reason: Not using CellRequest::AddSubRequest method to add sub Request.");
            }

            return msfsshttpbSubRequestIDTypeMapping[subRequestID];
        }
        /// <summary>
        /// Initialize the adapter.
        /// </summary>
        /// <param name="testSite"> test site.</param>
        public override void Initialize(ITestSite testSite)
        {
            base.Initialize(ReqConfigurableSite.GetReqConfigurableSite(testSite));

            this.client = new PccrdClient(new Logger(testSite));
            this.client.ReceivePccrdMessage += new ReceivePccrdMessageHandler(this.Client_ReceivePccrdMessage);
            this.startReceiving = true;
            Site.DefaultProtocolDocShortName = "MS-PCCRD";
        }
 /// <summary>
 /// Initialize the adapter.
 /// </summary>
 /// <param name="testSite">Test site.</param>
 public override void Initialize(ITestSite testSite)
 {
     base.Initialize(testSite);
     string url = Common.GetConfigurationPropertyValue("EwsUrl", this.Site);
     this.availability.Url = url;
     if (url.StartsWith("https", StringComparison.OrdinalIgnoreCase))
     {
         this.AcceptServerCertificate();
     }
 }
Beispiel #31
0
 public static void Initialize(ITestSite site)
 {
     TestSite = site;
 }
Beispiel #32
0
        /// <summary>
        /// Capture requirements related to GetDocMetaInfo sub response.
        /// </summary>
        /// <param name="getDocMetaInfoSubResponse">Containing the GetDocMetaInfoSubResponse information.</param>
        /// <param name="site">An object provides logging, assertions, and SUT adapters for test code onto its execution context.</param>
        public static void ValidateGetDocMetaInfoSubResponse(GetDocMetaInfoSubResponseType getDocMetaInfoSubResponse, ITestSite site)
        {
            ValidateSubResponseType(getDocMetaInfoSubResponse as SubResponseType, site);

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1797
            // if can launch this method, the schema matches.
            site.CaptureRequirement(
                "MS-FSSHTTP",
                1797,
                @"[In GetDocMetaInfoSubResponseType][The schema of GetDocMetaInfoSubResponseType is] <xs:complexType name=""GetDocMetaInfoSubResponseType"">
                       <xs:complexContent>
                         <xs:extension base=""tns:SubResponseType"">
                           <xs:sequence minOccurs=""0"" maxOccurs=""1"">
                     <xs:element name=""SubResponseData"" type=""tns:GetDocMetaInfoSubResponseDataType""/>
                     </xs:sequence>
                         </xs:extension>
                       </xs:complexContent>
                     </xs:complexType>");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2003
            // if can launch this method, the schema matches.
            site.CaptureRequirement(
                "MS-FSSHTTP",
                2003,
                @"[In GetDocMetaInfo Subrequest][The protocol client sends a GetDocMetaInfo SubRequest message, which is of type GetDocMetaInfoSubRequestType] The protocol server responds with a GetDocMetaInfo SubResponse message, which is of type GetDocMetaInfoSubResponseType as specified in section 2.3.1.30.");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R4694
            // if can launch this method, the schema matches.
            site.CaptureRequirementIfAreEqual <Type>(
                typeof(GetDocMetaInfoSubResponseType),
                getDocMetaInfoSubResponse.GetType(),
                "MS-FSSHTTP",
                4694,
                @"[In SubResponseElementGenericType] Depending on the Type attribute specified in the SubRequest element, the SubResponseElementGenericType MUST take one of the forms: GetDocMetaInfoSubResponseType.");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R5748
            // if can launch this method, the schema matches.
            site.CaptureRequirementIfAreEqual <Type>(
                typeof(GetDocMetaInfoSubResponseType),
                getDocMetaInfoSubResponse.GetType(),
                "MS-FSSHTTP",
                5748,
                @"[In SubResponseType] The SubResponseElementGenericType takes one of the following forms: GetDocMetaInfoSubResponseType.");

            if (getDocMetaInfoSubResponse.SubResponseData != null)
            {
                ValidateGetDocMetaInfoSubResponseData(site);
            }

            if (string.Compare("Success", getDocMetaInfoSubResponse.ErrorCode, StringComparison.OrdinalIgnoreCase) == 0)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1693
                bool isVerifyR1693 = getDocMetaInfoSubResponse.SubResponseData != null;

                // If popup the assert, the case run fail.
                site.Assert.IsTrue(
                    isVerifyR1693,
                    "For requirement MS-FSSHTTPB_R1693, the SubResponseData should not be NULL.");

                // If the above logic is right, MS-FSSHTTP_R1693 can be captured.
                site.CaptureRequirement(
                    "MS-FSSHTTP",
                    1693,
                    @"[In SubResponseElementGenericType][The SubResponseData element MUST be sent as part of the SubResponse element in a cell storage service response message if the ErrorCode attribute that is part of the SubResponse element is set to a value of ""Success"" and one of the following conditions is true:] The Type attribute that is specified in the SubRequest element is set to a value of ""GetDocMetaInfo"".");

                // If the value of element "SubResponseData" in the sub-response is not null, then capture MS-FSSHTTP_R1800.
                site.CaptureRequirementIfIsNotNull(
                    getDocMetaInfoSubResponse.SubResponseData,
                    "MS-FSSHTTP",
                    1800,
                    @"[In GetDocMetaInfoSubResponseType] [In GetDocMetaInfoSubResponseType] As part of processing the GetDocMetaInfo subrequest, the SubResponseData element MUST be sent as part of the SubResponse element in a cell storage service response message if the following condition is true:
                         The ErrorCode attribute that is part of the SubResponse element is set to a value of ""Success"".");
            }

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2013
            // if can launch this method, the schema matches.
            site.CaptureRequirement(
                "MS-FSSHTTP",
                2013,
                @"[In GetDocMetaInfo Subrequest] The GetDocMetaInfoPropertySetType elements have one Property element per metadata item of type GetDocMetaInfoPropertyType as defined in section 2.3.1.29.");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1685
            // if can launch this method, the schema matches.
            site.CaptureRequirement(
                "MS-FSSHTTP",
                1685,
                @"[In SubResponseDataGenericType][SubResponseDataGenericType MUST take one of the forms described in the following table] GetDocMetaInfoSubResponseDataType: Type definition for Get Doc Meta Info subresponse data.");
        }
Beispiel #33
0
 /// <summary>
 /// Set parameters for the proxy.
 /// </summary>
 /// <param name="site">The ITestSite instance.</param>
 private void SetParameters(ITestSite site)
 {
     this.site = site;
 }
Beispiel #34
0
        /// <summary>
        /// Merge the properties from the specified ptfconfig file.
        /// </summary>
        /// <param name="configFileName">ptfconfig filename.</param>
        /// <param name="site">An instance of interface ITestSite which provides logging, assertions,
        /// and adapters for test code onto its execution context.</param>
        public static void MergeConfigurationFile(string configFileName, ITestSite site)
        {
            if (!File.Exists(configFileName))
            {
                throw new FileNotFoundException(string.Format("The ptfconfig file '{0}' could not be found.", configFileName));
            }

            XmlNodeList properties = null;

            try
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(configFileName);
                XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
                nsmgr.AddNamespace("tc", "http://schemas.microsoft.com/windows/ProtocolsTest/2007/07/TestConfig");
                properties = doc.DocumentElement.SelectNodes("//tc:Property", nsmgr);
                if (properties == null)
                {
                    return;
                }
            }
            catch (XmlException exception)
            {
                throw new PtfConfigLoadException(
                          string.Format("Merging the ptfconfig file '{0}' failed. It is an invalid XML file. " + exception.Message, configFileName),
                          exception);
            }

            foreach (XmlNode property in properties)
            {
                string propertyName;
                string propertyValue;

                if (property.Attributes["name"] == null || string.IsNullOrEmpty(property.Attributes["name"].Value))
                {
                    throw new PtfConfigLoadException(
                              string.Format(
                                  "A property defined in the ptfconfig file '{0}' has a missing or a empty 'name' attribute.",
                                  configFileName));
                }
                else
                {
                    propertyName = property.Attributes["name"].Value;
                }

                if (property.Attributes["value"] == null)
                {
                    throw new PtfConfigLoadException(
                              string.Format(
                                  "Property '{0}' defined in the ptfconfig file '{1}' has a missing 'value' attribute.",
                                  propertyName,
                                  configFileName));
                }
                else
                {
                    propertyValue = property.Attributes["value"].Value;
                }

                if (site.Properties[propertyName] == null)
                {
                    site.Properties.Add(propertyName, propertyValue);
                }
                else if (configFileName.Contains("SHOULDMAY"))
                {
                    // Same property should not exist in both the test suite specific ptfconfig file and the SHOULD/MAY ptfconfig file.
                    throw new PtfConfigLoadException(string.Format("Same property '{0}' was found in both the local ptfconfig file and the SHOULD/MAY ptfconfig file '{1}'. It cannot exist in the local ptfconfig file.", propertyName, configFileName));
                }
                else
                {
                    // Since the test suite specific ptfconfig file should take precedence over the global ptfconfig file, when the same property exists in both, the global ptfconfig property is ignored.
                    site.Log.Add(LogEntryKind.Warning, string.Format("Same property '{0}' exists in both the local ptfconfig file and the global ptfconfig file '{1}'. Test suite is using the one from the local ptfconfig file.", propertyName, configFileName));

                    continue;
                }
            }
        }
Beispiel #35
0
 /// <summary>
 /// Constructs a new instance of DefaultAssumeChecker.
 /// </summary>
 /// <param name="testSite">The test site which the checker is hosted on.</param>
 /// <param name="checkerConfig">The configuration to checker.</param>
 public DefaultAssumeChecker(ITestSite testSite, ICheckerConfig checkerConfig)
     : base(testSite, "Assume", LogEntryKind.CheckFailed, LogEntryKind.CheckSucceeded, LogEntryKind.CheckInconclusive, checkerConfig)
 {
 }
 public override void Initialize(ITestSite testSite)
 {
     base.Initialize(testSite);
 }
Beispiel #37
0
        /// <summary>
        /// Capture requirements related with Properties Sub-request.
        /// </summary>
        /// <param name="propertiesSubResponse">Containing the PropertiesSubResponse information</param>
        /// <param name="site">Instance of ITestSite</param>
        public static void ValidatePropertiesSubResponse(PropertiesSubResponseType propertiesSubResponse, ITestSite site)
        {
            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2305011
            site.CaptureRequirement(
                "MS-FSSHTTP",
                2305011,
                @"[PropertiesSubResponseType]
	<xs:complexType name=""PropertiesSubResponseType"">
	  <xs:complexContent>
	    <xs:extension base=""tns:SubResponseType"">
	      <xs:sequence minOccurs=""0"" maxOccurs=""1"">
	         <xs:element name=""SubResponseData"" type=""tns:PropertiesSubResponseDataType"" />
	      </xs:sequence>
	    </xs:extension>
	  </xs:complexContent>
	</xs:complexType>"    );

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2406
            site.CaptureRequirement(
                "MS-FSSHTTP",
                2406,
                @"[PropertiesSubResponseType]SubResponseData: A PropertiesSubResponseDataType that specifies the information about the properties for the resource that was requested as part of the Properties subrequest. ");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2393
            site.CaptureRequirementIfAreEqual <Type>(
                typeof(PropertiesSubResponseType),
                propertiesSubResponse.GetType(),
                "MS-FSSHTTP",
                2393,
                @"[Properties Subrequest]The protocol server responds with a Properties SubResponse message, which is of type PropertiesSubResponseType as specified in section 2.3.1.55. ");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2148
            site.CaptureRequirementIfAreEqual <Type>(
                typeof(PropertiesSubResponseType),
                propertiesSubResponse.GetType(),
                "MS-FSSHTTP",
                2148,
                @"[In SubResponseElementGenericType] Depending on the Type attribute specified in the SubRequest element, the SubResponseElementGenericType MUST take one of the forms: PropertiesSubResponseType");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2166
            site.CaptureRequirementIfAreEqual <Type>(
                typeof(PropertiesSubResponseType),
                propertiesSubResponse.GetType(),
                "MS-FSSHTTP",
                2166,
                @"[In SubResponseType] The SubResponseElementGenericType takes one of the following forms: PropertiesSubResponseType.");

            ErrorCodeType errorCode;

            site.Assert.IsTrue(Enum.TryParse <ErrorCodeType>(propertiesSubResponse.ErrorCode, true, out errorCode), "Fail to convert the error code string {0} to the Enum type ErrorCodeType", propertiesSubResponse.ErrorCode);
            if (errorCode == ErrorCodeType.Success)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2160
                site.CaptureRequirementIfIsNotNull(
                    propertiesSubResponse.SubResponseData,
                    "MS-FSSHTTP",
                    2160,
                    @"[In SubResponseElementGenericType][The SubResponseData element MUST be sent as part of the SubResponse element in a cell storage service response message if the ErrorCode attribute that is part of the SubResponse element is set to a value of ""Success"" and one of the following conditions is true:] The Type attribute that is specified in the SubRequest element is set to a value of ""Properties"".");
            }

            // Verify requirements related with its base type: SubResponseType
            ValidateSubResponseType(propertiesSubResponse as SubResponseType, site);

            // Verify requirements related with SubResponseDataType
            if (propertiesSubResponse.SubResponseData != null)
            {
                ValidatePropertiesSubResponseDataType(propertiesSubResponse.SubResponseData, site);
            }
        }
Beispiel #38
0
        /// <summary>
        /// Capture requirements related with AmIAloneSubResponseDataType
        /// </summary>
        /// <param name="amIAloneSubResponseData">The AmIAloneSubResponseData information</param>
        /// <param name="site">Instance of ITestSite</param>
        private static void ValidatePropertiesSubResponseDataType(PropertiesSubResponseDataType propertiesSubResponseData, ITestSite site)
        {
            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2399
            // if can launch this method, the schema matches.
            site.CaptureRequirement(
                "MS-FSSHTTP",
                2399,
                @"[Properties Subrequest][This is done as follows:]The PropertiesSubResponseDataType defines the type of the SubResponseData element inside the Properties SubResponse element. ");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2295
            site.CaptureRequirement(
                "MS-FSSHTTP",
                2295,
                @"[PropertiesSubResponseDataType]
	<xs:complexType name=""PropertiesSubResponseDataType"">
	  <xs:sequence>
	    <xs:element name=""PropertyIds"" minOccurs=""0"" maxOccurs=""1"" type=""tns:PropertyIdsType""/>
	    <xs:element name=""PropertyValues"" minOccurs=""0"" maxOccurs=""1"" type=""tns:PropertyValuesType""/>
	  </xs:sequence>
	</xs:complexType>"    );

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2136
            // The SubResponseData of PropertiesSubResponse is of type PropertiesSubResponseDataType, so if propertiesSubResponse.SubResponseData is not null, then MS-FSSHTTP_R2136 can be captured.
            site.CaptureRequirementIfAreEqual <Type>(
                typeof(PropertiesSubResponseDataType),
                propertiesSubResponseData.GetType(),
                "MS-FSSHTTP",
                2136,
                @"[In SubResponseDataGenericType][SubResponseDataGenericType MUST take one of the forms described in the following table]PropertiesSubResponseDataType:Type definition for Properties subresponse data.");

            if (propertiesSubResponseData.PropertyValues != null)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2298
                site.CaptureRequirement(
                    "MS-FSSHTTP",
                    2298,
                    @"[PropertiesSubResponseDataType]PropertyValues: An element of type PropertyValuesType (section 2.3.1.58) that specifies the property values.");
            }
        }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="testSite">Site of the test suite, used to save logs</param>
 /// <param name="IQAAlgorithm">IQA algorithm</param>
 /// <param name="assessValueThreshold">Assess Value Threshold</param>
 public SimulatedScreen(ITestSite testSite, IQA_Algorithm IQAAlgorithm, double assessValueThreshold)
     : this(testSite, DefaultScreenWidth, DefaultScreenHeight, IQAAlgorithm, assessValueThreshold)
 {
 }
Beispiel #40
0
 /// <summary>
 /// initialize storage
 /// </summary>
 /// <param name="site">ptf test iste</param>
 public void Initialize(ITestSite site)
 {
     testSite = site;
     //clear existing changes to revert environment
     Clear();
 }
Beispiel #41
0
        /// <summary>
        /// A method used to get a field definition from response of GetList operation which is described in [MS-LISTSWS] by specified field name.
        /// </summary>
        /// <param name="getListResponse">A parameter represents the response instance of GetList operation which includes fields definition.</param>
        /// <param name="expectedFieldName">A parameter represents the field name which is expected.</param>
        /// <param name="currentTestSite">An instance of interface ITestSite which provides logging, assertions, and adapters for test code onto its execution context.</param>
        /// <returns>A return value represents the field definition which name is equal to specified field name.</returns>
        public static FieldDefinition GetFieldItemByName(GetListResponseGetListResult getListResponse, string expectedFieldName, ITestSite currentTestSite)
        {
            if (null == getListResponse)
            {
                throw new ArgumentNullException("getListResponse");
            }

            if (string.IsNullOrEmpty(expectedFieldName))
            {
                throw new ArgumentNullException("expectedFieldName");
            }

            if (null == getListResponse.List || null == getListResponse.List.Fields || null == getListResponse.List.Fields.Field ||
                0 == getListResponse.List.Fields.Field.Length)
            {
                currentTestSite.Assert.Fail("The response of GetList operation should contain the fields data of a list.");
            }

            var expectedField = from FieldDefinition fieldItem in getListResponse.List.Fields.Field
                                where fieldItem.Name.Equals(expectedFieldName, StringComparison.OrdinalIgnoreCase)
                                select fieldItem;

            int             matchFieldCount = expectedField.Count();
            FieldDefinition fiedDefinition  = null;

            if (0 == matchFieldCount)
            {
                currentTestSite.Assert.Fail("The response of GetList operation should contain expected field definition[{0}].", expectedFieldName);
            }
            else if (matchFieldCount > 1)
            {
                currentTestSite.Assert.Fail("The response of GetList operation contain fields which have duplicate name[{0}].", expectedFieldName);
            }
            else
            {
                fiedDefinition = expectedField.ElementAt(0);
            }

            return(fiedDefinition);
        }
Beispiel #42
0
 /// <summary>
 /// Constructs a new instance of DefaultDebugChecker.
 /// </summary>
 /// <param name="testSite">The test site which the checker is hosted on.</param>
 /// <param name="checkerConfig">The configuration to checker.</param>
 public DefaultDebugChecker(ITestSite testSite, ICheckerConfig checkerConfig)
     : base(testSite, "Debug", LogEntryKind.Debug, LogEntryKind.Debug, LogEntryKind.Debug, checkerConfig)
 {
 }
Beispiel #43
0
        /// <summary>
        /// A method used to generate a unique name with protocol short name(without dash "-"), resource name and time stamp.
        /// </summary>
        /// <param name="site">An instance of interface ITestSite which provides logging, assertions, and adapters for test code onto its execution context.</param>
        /// <param name="resourceName">A parameter that represents the resource name which is used to combine the unique name</param>
        /// <returns>A return value that represents the unique name combined with protocol short name, resource name and time stamp </returns>
        public static string GenerateResourceName(ITestSite site, string resourceName)
        {
            string newPrefixOfResourceName = GeneratePrefixOfResourceName(site);

            return(string.Format(@"{0}_{1}_{2}", newPrefixOfResourceName, resourceName, FormatCurrentDateTime()));
        }
Beispiel #44
0
 /// <summary>
 /// Initializes a new instance of the ExchangeServiceBinding class with the specified parameter.
 /// </summary>
 /// <param name="url">The base URL of the XML Web service the client is requesting.</param>
 /// <param name="userName">The user name associated with the credentials.</param>
 /// <param name="password">The password for the user name associated with the credentials.</param>
 /// <param name="domain">The domain associated with these credentials.</param>
 /// <param name="testSite">The test site instance.</param>
 public ExchangeServiceBinding(string url, string userName, string password, string domain, ITestSite testSite)
 {
     this.Url         = url;
     this.Credentials = new NetworkCredential(userName, password, domain);
     this.itemStackValidationEventHandler = this.ValidationCallBack;
     this.InitialXmlReaderSettings();
     if (this.site == null)
     {
         this.site = testSite;
     }
 }
Beispiel #45
0
        /// <summary>
        /// A method used to verify a field definition which is described in [MS-LISTSWS] whether has expected field type.
        /// </summary>
        /// <param name="fieldDefinition">A parameter represents the field definition which is used to verify.</param>
        /// <param name="fieldType">A parameter represents the expected field type value which is used to check the field definition.</param>
        /// <param name="currentTestSite">An instance of interface ITestSite which provides logging, assertions, and adapters for test code onto its execution context.</param>
        /// <returns>Returns True indicating the verification of specified fieldDefinition is successful.</returns>
        public static bool VerifyFieldType(FieldDefinition fieldDefinition, string fieldType, ITestSite currentTestSite)
        {
            if (string.IsNullOrEmpty(fieldType))
            {
                throw new ArgumentNullException("fieldType");
            }

            currentTestSite.Log.Add(
                LogEntryKind.Debug,
                @"The fieldDefinition ""[{0}]"" current type:[{1}], expected type:[{2}].",
                fieldDefinition.Name,
                fieldDefinition.Type,
                fieldType);

            return(fieldType.Equals(fieldDefinition.Type, StringComparison.OrdinalIgnoreCase));
        }
Beispiel #46
0
 public DFSCTestConfig(ITestSite site) : base(site)
 {
     //Client Information
     ClientComputerName = System.Environment.MachineName;
 }
Beispiel #47
0
        /// <summary>
        /// A method used to verify a field definition which is described in [MS-LISTSWS] whether has expected field ID.
        /// </summary>
        /// <param name="fieldDefinition">A parameter represents the field definition which is used to verify.</param>
        /// <param name="fieldId">>A parameter represents the expected field ID value which is used to check the field definition.</param>
        /// <param name="currentTestSite">An instance of interface ITestSite which provides logging, assertions, and adapters for test code onto its execution context.</param>
        /// <returns>Returns True indicating the verification of specified fieldDefinition was successful.</returns>
        public static bool VerifyFieldId(FieldDefinition fieldDefinition, string fieldId, ITestSite currentTestSite)
        {
            if (string.IsNullOrEmpty(fieldId))
            {
                throw new ArgumentNullException("fieldId");
            }

            Guid expectedValue;

            if (!Guid.TryParse(fieldId, out expectedValue))
            {
                throw new ArgumentException("The fieldId must be a valid GUID format value.", "fieldId");
            }

            currentTestSite.Log.Add(
                LogEntryKind.Debug,
                @"The fieldDefinition ""[{0}]"" current ID:[{1}], expected ID:[{2}].",
                fieldDefinition.Name,
                fieldDefinition.ID,
                fieldId);

            Guid actualValue = Guid.Parse(fieldDefinition.ID);

            return(expectedValue.Equals(actualValue));
        }