public void MSASCMD_S01_TC03_ErrorCode_600()
        {
            Site.Assume.IsFalse(Common.GetSutVersion(this.Site) == SutVersion.ExchangeServer2007 && string.Equals(Common.GetConfigurationPropertyValue("TransportType", this.Site).ToUpper(CultureInfo.InvariantCulture), "HTTP"), "Autodiscover request should be passed only through HTTPS to Exchange Server 2007.");

            #region Calls Autodiscover command with two Request elements.
            AutodiscoverRequest request = new AutodiscoverRequest
            {
                RequestData = new Request.Autodiscover
                {
                    Request = new Request.RequestType
                    {
                        AcceptableResponseSchema = Common.GetConfigurationPropertyValue("AcceptableResponseSchema", Site),
                        EMailAddress             = Common.GetMailAddress(this.User1Information.UserName, this.User1Information.UserDomain)
                    }
                }
            };

            string requestText          = request.GetRequestDataSerializedXML();
            int    requestStartPosition = requestText.IndexOf("<Request>", StringComparison.OrdinalIgnoreCase);
            int    requestEndPosition   = requestText.IndexOf("</Autodiscover>", StringComparison.OrdinalIgnoreCase) - 1;
            string requestElementString = requestText.Substring(requestStartPosition, requestEndPosition - requestStartPosition + 1);
            requestText = requestText.Insert(requestEndPosition + 1, requestElementString);

            SendStringResponse response = this.CMDAdapter.SendStringRequest(CommandName.Autodiscover, null, requestText);
            XmlDocument        xmlDoc   = new XmlDocument();
            xmlDoc.LoadXml(response.ResponseDataXML);
            XmlElement xmlElement = (XmlElement)xmlDoc.DocumentElement;
            string     errorCode  = xmlElement.GetElementsByTagName("ErrorCode")[0].InnerText;

            // Add the debug information.
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R3799");

            Site.CaptureRequirementIfAreEqual <string>(
                "600",
                errorCode,
                3799,
                @"[In Request(Autodiscover)] When more than one Request elements are present in an Autodiscover command request, the server returns an ErrorCode (section 2.2.3.61) value of 600.");

            // Add the debug information.
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R2286");

            // Send more than one request means the schema doesn't match the one that AcceptableResponseSchema element provides,
            // So R2286 can be captured.
            Site.CaptureRequirementIfAreEqual <string>(
                "600",
                errorCode,
                2286,
                @"[In ErrorCode] [If the provider cannot be found, or ]if the AcceptableResponseSchema element (section 2.2.3.1) value cannot be matched, then the ErrorCode element is included in the command response.");

            // Add the debug information.
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R2287");

            Site.CaptureRequirementIfAreEqual <string>(
                "600",
                errorCode,
                2287,
                @"[In ErrorCode] A value of 600 means an invalid request was sent to the server.");
            #endregion
        }
        public void MSASCMD_S01_TC03_ErrorCode_600()
        {
            Site.Assume.IsFalse(Common.GetSutVersion(this.Site) == SutVersion.ExchangeServer2007 && string.Equals(Common.GetConfigurationPropertyValue("TransportType", this.Site).ToUpper(CultureInfo.InvariantCulture), "HTTP"), "Autodiscover request should be passed only through HTTPS to Exchange Server 2007.");
           
            #region Calls Autodiscover command with two Request elements.
            AutodiscoverRequest request = new AutodiscoverRequest
            {
                RequestData = new Request.Autodiscover
                {
                    Request = new Request.RequestType
                    {
                        AcceptableResponseSchema = Common.GetConfigurationPropertyValue("AcceptableResponseSchema", Site),
                        EMailAddress = Common.GetMailAddress(this.User1Information.UserName, this.User1Information.UserDomain)
                    }
                }
            };

            string requestText = request.GetRequestDataSerializedXML();
            int requestStartPosition = requestText.IndexOf("<Request>", StringComparison.OrdinalIgnoreCase);
            int requestEndPosition = requestText.IndexOf("</Autodiscover>", StringComparison.OrdinalIgnoreCase) - 1;
            string requestElementString = requestText.Substring(requestStartPosition, requestEndPosition - requestStartPosition + 1);
            requestText = requestText.Insert(requestEndPosition + 1, requestElementString);

            SendStringResponse response = this.CMDAdapter.SendStringRequest(CommandName.Autodiscover, null, requestText);
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.LoadXml(response.ResponseDataXML);
            XmlElement xmlElement = (XmlElement)xmlDoc.DocumentElement;
            string errorCode = xmlElement.GetElementsByTagName("ErrorCode")[0].InnerText;

            // Add the debug information.
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R3799");

            Site.CaptureRequirementIfAreEqual<string>(
                "600", 
                errorCode, 
                3799, 
                @"[In Request(Autodiscover)] When more than one Request elements are present in an Autodiscover command request, the server returns an ErrorCode (section 2.2.3.61) value of 600.");

            // Add the debug information.
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R2286");

            // Send more than one request means the schema doesn't match the one that AcceptableResponseSchema element provides,
            // So R2286 can be captured.
            Site.CaptureRequirementIfAreEqual<string>(
                "600",
                errorCode,
                2286,
                @"[In ErrorCode] [If the provider cannot be found, or ]if the AcceptableResponseSchema element (section 2.2.3.1) value cannot be matched, then the ErrorCode element is included in the command response.");

            // Add the debug information.
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R2287");

            Site.CaptureRequirementIfAreEqual<string>(
                "600",
                errorCode,
                2287,
                @"[In ErrorCode] A value of 600 means an invalid request was sent to the server.");            
            #endregion
        }