/// <summary>
        /// Send a meeting response email
        /// </summary>
        /// <param name="calendar">The meeting calendar</param>
        protected void SendMeetingResponse(Calendar calendar)
        {
            // Create reply mail to organizer
            string emailBody = Common.GenerateResourceName(Site, "content");
            string icalendarResponseContent = TestSuiteHelper.CreateMeetingResponseiCalendarFormatContent(
                (DateTime)calendar.DtStamp,
                (DateTime)calendar.EndTime,
                calendar.UID,
                calendar.Subject,
                calendar.Location,
                calendar.OrganizerEmail,
                calendar.Attendees.Attendee[0].Email);

            // Create reply mail mime content
            string meetingResponseEmailMime = TestSuiteHelper.CreateMeetingRequestMime(
                calendar.Attendees.Attendee[0].Email,
                calendar.OrganizerEmail,
                calendar.Subject,
                emailBody,
                icalendarResponseContent);

            string          clientId        = TestSuiteHelper.GetClientId();
            SendMailRequest sendMailRequest = TestSuiteHelper.CreateSendMailRequest(clientId, false, meetingResponseEmailMime);

            this.SwitchUser(this.User2Information, true);
            SendMailResponse response = this.EMAILAdapter.SendMail(sendMailRequest);

            Site.Assert.AreEqual <string>(
                string.Empty,
                response.ResponseDataXML,
                "The server should return an empty xml response data to indicate SendMail command success.");
        }
        /// <summary>
        /// Get the specified email item.
        /// </summary>
        /// <param name="emailSubject">The subject of the email item.</param>
        /// <param name="folderCollectionId">The serverId of the default folder.</param>
        /// <param name="bodyPreference">The preference information related to the type and size of information that is returned from fetching.</param>
        /// <returns>The result of getting the specified email item.</returns>
        protected SyncStore GetSyncResult(string emailSubject, string folderCollectionId, Request.BodyPreference bodyPreference)
        {
            SyncStore syncItemResult;
            Sync      item       = null;
            int       counter    = 0;
            int       waitTime   = int.Parse(Common.GetConfigurationPropertyValue("WaitTime", this.Site));
            int       retryCount = int.Parse(Common.GetConfigurationPropertyValue("RetryCount", this.Site));

            do
            {
                Thread.Sleep(waitTime);

                // Get the new added email item
                SyncStore initSyncResult = this.InitializeSync(folderCollectionId);
                syncItemResult = this.SyncChanges(initSyncResult.SyncKey, folderCollectionId, bodyPreference);
                if (syncItemResult != null && syncItemResult.CollectionStatus == 1)
                {
                    item = TestSuiteHelper.GetSyncAddItem(syncItemResult, emailSubject);
                }

                counter++;
            }while ((syncItemResult == null || item == null) && counter < retryCount);

            Site.Assert.IsNotNull(item, "The email item with subject {0} should be found. Retry count: {1}", emailSubject, counter);

            // Verify sync result
            Site.Assert.AreEqual <byte>(
                1,
                syncItemResult.CollectionStatus,
                "If the Sync command executes successfully, the status in response should be 1.");

            return(syncItemResult);
        }
        /// <summary>
        /// Send a plain text email.
        /// </summary>
        /// <param name="subject">The subject of email</param>
        /// <param name="cc">The cc address of the mail</param>
        /// <param name="bcc">The bcc address of the mail</param>
        protected void SendPlaintextEmail(string subject, string cc, string bcc)
        {
            string emailBody = Common.GenerateResourceName(Site, "content");
            string emailMime = TestSuiteHelper.CreatePlainTextMime(
                Common.GetMailAddress(this.User1Information.UserName, this.User1Information.UserDomain),
                Common.GetMailAddress(this.User2Information.UserName, this.User2Information.UserDomain),
                cc,
                bcc,
                subject,
                emailBody);
            string clientId = TestSuiteHelper.GetClientId();

            SendMailRequest sendMailRequest = TestSuiteHelper.CreateSendMailRequest(clientId, false, emailMime);

            this.SwitchUser(this.User1Information, false);
            SendMailResponse response = this.EMAILAdapter.SendMail(sendMailRequest);

            Site.Assert.AreEqual <string>(
                string.Empty,
                response.ResponseDataXML,
                "The server should return an empty xml response data to indicate SendMail command executes successfully.");

            this.SwitchUser(this.User2Information, true);
            this.RecordCaseRelativeItems(this.User2Information.UserName, this.User2Information.InboxCollectionId, subject);
        }
        /// <summary>
        /// Send a plain text email.
        /// </summary>
        /// <param name="subject">The subject of email</param>
        /// <param name="cc">The cc address of the mail</param>
        /// <param name="bcc">The bcc address of the mail</param>
        /// <param name="to">The to address of the mail</param>
        /// <param name="sender">The sender address of the mail</param>
        /// <param name="replyTo">The replyTo address of the mail</param>
        /// <param name="from">The from address of the mail</param>
        protected void SendPlaintextEmail(
            string subject,
            string cc,
            string bcc,
            string to,
            string sender,
            string replyTo,
            string from)
        {
            string emailBody = Common.GenerateResourceName(Site, "content");

            string emailMime = TestSuiteHelper.CreatePlainTextMime(
                string.IsNullOrEmpty(from) ? Common.GetMailAddress(this.User1Information.UserName, this.User1Information.UserDomain) : from,
                string.IsNullOrEmpty(to) ? Common.GetMailAddress(this.User2Information.UserName, this.User2Information.UserDomain) : to,
                cc,
                bcc,
                subject,
                emailBody,
                sender,
                replyTo);
            string clientId = TestSuiteHelper.GetClientId();

            SendMailRequest sendMailRequest = TestSuiteHelper.CreateSendMailRequest(clientId, false, emailMime);

            this.SwitchUser(this.User1Information, false);
            SendMailResponse response = this.EMAILAdapter.SendMail(sendMailRequest);

            Site.Assert.AreEqual <string>(
                string.Empty,
                response.ResponseDataXML,
                "The server should return an empty xml response data to indicate SendMail command was executed successfully.");
        }
        /// <summary>
        /// Sync changes between client and server
        /// </summary>
        /// <param name="syncKey">The synchronization key returned by last request.</param>
        /// <param name="collectionId">Identify the folder as the collection being synchronized.</param>
        /// <param name="bodyPreference">Sets preference information related to the type and size of information for body</param>
        /// <returns>Return change result</returns>
        protected SyncStore SyncChanges(string syncKey, string collectionId, Request.BodyPreference bodyPreference)
        {
            // Get changes from server use initial syncKey
            SyncRequest syncRequest = TestSuiteHelper.CreateSyncRequest(syncKey, collectionId, bodyPreference);
            SyncStore   syncResult  = this.EMAILAdapter.Sync(syncRequest);

            return(syncResult);
        }
        public void MSLISTSWS_S05_TC10_UndoCheckOut_Succeed()
        {
            string listTitle            = TestSuiteHelper.GetUniqueListName();
            int    docLibraryTemplateId = (int)TemplateType.Document_Library;

            TestSuiteHelper.CreateList(listTitle, docLibraryTemplateId);

            // Upload the file to the document library
            string absoluteFileUrl = this.sutControlAdapter.UploadFile(listTitle);

            Site.Assert.IsTrue(
                !string.IsNullOrEmpty(absoluteFileUrl),
                "Upload file to the list {0} should be successful, the file path is [{1}]",
                listTitle,
                absoluteFileUrl);

            #region Check out the added file.

            bool isFicheckOutSuccessfully = false;
            isFicheckOutSuccessfully = this.listwsInstance.CheckOutFile(absoluteFileUrl, bool.TrueString, string.Empty);
            if (!isFicheckOutSuccessfully)
            {
                Site.Assert.Fail("Expect CheckOutFile operation failed due to unexpected reason.");
            }

            #endregion

            #region Undo the checkout.
            bool isUndoCheckOutSucceed = false;

            // Undo a checkOut process by calling UndoCheckOut operation.
            isUndoCheckOutSucceed = this.listwsInstance.UndoCheckOut(absoluteFileUrl);
            #endregion

            #region Capture R7781 R787 and R1973 if the UndoCheckOut succeeds and returns true value.
            // Verify requirement R7781.
            // If undo check out is successful, it means implementation does support this UndoCheckOut method. R7781 can be captured.
            if (Common.IsRequirementEnabled(7781, this.Site))
            {
                Site.CaptureRequirementIfIsTrue(
                    isUndoCheckOutSucceed,
                    7781,
                    @"Implementation does support this method[UndoCheckOut]. (Windows SharePoint Services 3.0 and above follow this behavior.)");
            }

            Site.CaptureRequirementIfIsTrue(
                isUndoCheckOutSucceed,
                787,
                @"[In UndoCheckOut operation] If there are no errors, the protocol server MUST undo the checkout operation on the specified document.");

            Site.CaptureRequirementIfIsTrue(
                isUndoCheckOutSucceed,
                1973,
                @"[UndoCheckOutResponse]The value is True if the operation is successful;");

            #endregion
        }
        public void MSLISTSWS_S05_TC04_CheckInFile_Succeed()
        {
            // create a list by using document library template
            string listTitle            = TestSuiteHelper.GetUniqueListName();
            int    docLibraryTemplateId = (int)TemplateType.Document_Library;

            TestSuiteHelper.CreateList(listTitle, docLibraryTemplateId);

            // Upload the file to the document library
            string absoluteFileUrl = this.sutControlAdapter.UploadFile(listTitle);

            Site.Assert.IsTrue(
                !string.IsNullOrEmpty(absoluteFileUrl),
                "Upload file to the list {0} should be successful, the file path is [{1}]",
                listTitle,
                absoluteFileUrl);

            #region Check out the added file.
            bool checkOutSucceeded = false;
            checkOutSucceeded = this.listwsInstance.CheckOutFile(absoluteFileUrl, bool.TrueString, string.Empty);
            Site.Assert.IsTrue(checkOutSucceeded, "CheckOutFile must succeed!");
            #endregion

            #region Check in the file which has been checked out.
            bool checkInSucceeded = false;

            // generate a random string.
            string checkInComments = TestSuiteHelper.GenerateRandomString(5);
            checkInSucceeded = this.listwsInstance.CheckInFile(absoluteFileUrl, checkInComments, CheckInTypeValue.MajorCheckIn);

            #endregion

            #region Capture R16381, R398 and R1660 if the CheckInFile succeeds and returns true value.

            // Verify requirement R16381.
            // If there are no other errors, it means implementation does support this CheckInFile method. R16381 can be captured.
            if (Common.IsRequirementEnabled(16381, this.Site))
            {
                Site.CaptureRequirementIfIsTrue(
                    checkInSucceeded,
                    16381,
                    @"Implementation does support this method[CheckInFile]. (Windows SharePoint Services 3.0 and above follow this behavior.)");
            }

            // If CheckInFile operation return true, capture R398, 1660
            Site.CaptureRequirementIfIsTrue(
                checkInSucceeded,
                398,
                @"[In CheckInFile operation] If there are no other errors, the document located at pageUrl MUST be checked-in by using comments and CheckinType specified in the CheckInFileSoapIn request message.");

            Site.CaptureRequirementIfIsTrue(
                checkInSucceeded,
                1660,
                @"[CheckInFileResponse][CheckInFileResult]The value is True if the operation is successful;");
            #endregion
        }
        public void MSLISTSWS_S05_TC02_CheckInFile_EmptyCheckInType()
        {
            // create a normal list document Library and upload a file to SUT
            string listTitle = TestSuiteHelper.GetUniqueListName();

            TestSuiteHelper.CreateList(listTitle, (int)TemplateType.Document_Library);
            string absoluteFileUrl = this.sutControlAdapter.UploadFile(listTitle);

            Site.Assert.IsTrue(
                !string.IsNullOrEmpty(absoluteFileUrl),
                "Upload file to the list {0} should be successful, the file path is [{1}]",
                listTitle,
                absoluteFileUrl);

            // Check out the added file.
            bool isSoapFautExisted = false;

            isSoapFautExisted = this.listwsInstance.CheckOutFile(absoluteFileUrl, bool.TrueString, string.Empty);
            Site.Assert.IsTrue(isSoapFautExisted, "CheckOutFile must succeed!");

            // Check in file with null "comment" parameter and valid "checkinType" parameter.
            isSoapFautExisted = this.listwsInstance.CheckInFile(absoluteFileUrl, null, CheckInTypeValue.MajorCheckIn);
            Site.Assert.IsTrue(isSoapFautExisted, "CheckInFile must succeed!");

            // Check out the added file again.
            isSoapFautExisted = this.listwsInstance.CheckOutFile(absoluteFileUrl, bool.TrueString, string.Empty);
            Site.Assert.IsTrue(isSoapFautExisted, "CheckOutFile must succeed!");

            // Invoke CheckInFile operation with pageUrl not referring to a document library, and catch the exception.
            string errorCode = string.Empty;

            isSoapFautExisted = false;
            try
            {
                string emptyCheckInTypeValue = string.Empty;
                this.listwsInstance.CheckInFile(absoluteFileUrl, null, emptyCheckInTypeValue);
            }
            catch (SoapException soapEx)
            {
                isSoapFautExisted = true;
                errorCode         = TestSuiteHelper.GetErrorCode(soapEx);
            }

            // If there is a soap fault  capture R395
            Site.CaptureRequirementIfIsTrue(
                isSoapFautExisted,
                395,
                @"[In CheckInFile operation] If the CheckinType element is an empty string, the protocol server MUST return a SOAP fault.");

            // If there is a soap fault and no error code,  capture R1643
            Site.CaptureRequirementIfIsTrue(
                isSoapFautExisted && string.IsNullOrEmpty(errorCode),
                1643,
                @"[In CheckInFile operation] [If the checkInType parameter is an empty string, the protocol server MUST return a SOAP fault.]There is no error code for this fault.");
        }
        /// <summary>
        /// Update email with more data
        /// </summary>
        /// <param name="collectionId">The collectionId of the folder which contains the item to be updated.</param>
        /// <param name="syncKey">The syncKey which is returned from server</param>
        /// <param name="read">The value is TRUE indicates the email has been read; a value of FALSE indicates the email has not been read</param>
        /// <param name="serverId">The server id of the email</param>
        /// <param name="flag">The flag instance</param>
        /// <param name="categories">The list of categories</param>
        /// <param name="additionalElement">Additional flag element</param>
        /// <param name="insertTag">Additional element will insert before this tag</param>
        /// <returns>Return update email result</returns>
        protected SendStringResponse UpdateEmailWithMoreData(string collectionId, string syncKey, bool read, string serverId, Request.Flag flag, Collection <object> categories, string additionalElement, string insertTag)
        {
            // Create normal sync request
            Request.SyncCollectionChange changeData = TestSuiteHelper.CreateSyncChangeData(read, serverId, flag, categories);
            SyncRequest syncRequest = TestSuiteHelper.CreateSyncChangeRequest(syncKey, collectionId, changeData);

            // Calls Sync command to update email with invalid sync request
            SendStringResponse result = this.EMAILAdapter.InvalidSync(syncRequest, additionalElement, insertTag);

            return(result);
        }
        public void MSLISTSWS_S05_TC08_UndoCheckOut_WithNoDocument()
        {
            // create a normal document Library and upload a file to SUT
            string listTitle            = TestSuiteHelper.GetUniqueListName();
            int    docLibraryTemplateId = (int)TemplateType.Document_Library;

            TestSuiteHelper.CreateList(listTitle, docLibraryTemplateId);

            // Upload the file to the document library
            string absoluteFileUrl = this.sutControlAdapter.UploadFile(listTitle);

            Site.Assert.IsTrue(
                !string.IsNullOrEmpty(absoluteFileUrl),
                "Upload file to the list {0} should be successful, the file path is [{1}]",
                listTitle,
                absoluteFileUrl);

            #region Invoke UndoCheckOut operation with pageUrl not referring to a document library, and catch the exception.

            string errorCode          = string.Empty;
            bool   isSoapFaultExisted = false;
            try
            {
                this.listwsInstance.UndoCheckOut(absoluteFileUrl + TestSuiteHelper.GenerateRandomString(2));
            }
            catch (SoapException soapEx)
            {
                isSoapFaultExisted = true;
                errorCode          = TestSuiteHelper.GetErrorCode(soapEx);
            }
            #endregion

            #region Capture R786 R1964
            // If Soap Fault Existed, Capture R786
            Site.CaptureRequirementIfIsTrue(
                isSoapFaultExisted,
                786,
                "[In UndoCheckOut operation] If the pageUrl does not refer to a document, the protocol server MUST return a SOAP fault. ");

            // If there is no any error code in soap fault, capture R1964
            Site.CaptureRequirementIfIsTrue(
                string.IsNullOrEmpty(errorCode),
                1964,
                "[In UndoCheckOut operation] [If the pageUrl does not refer to a document, the protocol server MUST return a SOAP fault.] There is no error code for this fault.");
            #endregion
        }
        /// <summary>
        /// Update email
        /// </summary>
        /// <param name="collectionId">The collectionId of the folder which contains the item to be updated.</param>
        /// <param name="syncKey">The syncKey which is returned from server</param>
        /// <param name="read">The value is TRUE indicates the email has been read; a value of FALSE indicates the email has not been read</param>
        /// <param name="serverId">The server id of the email</param>
        /// <param name="flag">The flag instance</param>
        /// <param name="categories">The array of categories</param>
        /// <returns>Return update email result</returns>
        protected SyncStore UpdateEmail(string collectionId, string syncKey, bool?read, string serverId, Request.Flag flag, Collection <string> categories)
        {
            Request.SyncCollectionChange changeData = new Request.SyncCollectionChange
            {
                ServerId        = serverId,
                ApplicationData = new Request.SyncCollectionChangeApplicationData()
            };

            List <object> items = new List <object>();
            List <Request.ItemsChoiceType7> itemsElementName = new List <Request.ItemsChoiceType7>();

            if (null != read)
            {
                items.Add(read);
                itemsElementName.Add(Request.ItemsChoiceType7.Read);
            }

            if (null != flag)
            {
                items.Add(flag);
                itemsElementName.Add(Request.ItemsChoiceType7.Flag);
            }

            if (null != categories)
            {
                Request.Categories2 mailCategories = new Request.Categories2 {
                    Category = new string[categories.Count]
                };
                categories.CopyTo(mailCategories.Category, 0);
                items.Add(mailCategories);
                itemsElementName.Add(Request.ItemsChoiceType7.Categories2);
            }

            changeData.ApplicationData.Items            = items.ToArray();
            changeData.ApplicationData.ItemsElementName = itemsElementName.ToArray();

            SyncRequest syncRequest = TestSuiteHelper.CreateSyncChangeRequest(syncKey, collectionId, changeData);
            SyncStore   result      = this.EMAILAdapter.Sync(syncRequest);

            Site.Assert.AreEqual <byte>(
                1,
                result.CollectionStatus,
                "The server returns a Status 1 in the Sync command response indicate sync command success.");

            return(result);
        }
        public void MSLISTSWS_S05_TC07_CheckOutFile_Succeed()
        {
            string listTitle            = TestSuiteHelper.GetUniqueListName();
            int    docLibraryTemplateId = (int)TemplateType.Document_Library;

            TestSuiteHelper.CreateList(listTitle, docLibraryTemplateId);

            // Upload the file to the document library
            string absoluteFileUrl = this.sutControlAdapter.UploadFile(listTitle);

            Site.Assert.IsTrue(
                !string.IsNullOrEmpty(absoluteFileUrl),
                "Upload file to the list {0} should be successful, the file path is [{1}]",
                listTitle,
                absoluteFileUrl);

            #region Check out the added file with all valid parameters.

            bool isCheckout = false;

            isCheckout = this.listwsInstance.CheckOutFile(absoluteFileUrl, "False", null);
            #endregion

            #region Capture R16611, R412 and R1679 if the CheckOutFile succeeds and returns true value.

            // Verify requirement R16611.
            // If there are no other errors, it means implementation does support this CheckOutFile method. R16611 can be captured.
            if (Common.IsRequirementEnabled(16611, this.Site))
            {
                Site.CaptureRequirementIfIsTrue(
                    isCheckout,
                    16611,
                    @"Implementation does support this method[CheckOutFile]. (Windows SharePoint Services 3.0 and above follow this behavior.)");
            }

            Site.CaptureRequirementIfIsTrue(
                isCheckout,
                412,
                @"[In CheckOutFile operation] If there are no other errors, the document located at pageUrl MUST be checked out by using checkoutToLocal and last modified as specified in the CheckOutFileSoapIn request message.");

            Site.CaptureRequirementIfIsTrue(
                isCheckout,
                1679,
                @"[CheckOutFileResponse]The value is True if the operation is successful;");
            #endregion
        }
        public void TestCaseInitialize()
        {
            this.listwsInstance = this.Site.GetAdapter <IMS_LISTSWSAdapter>();

            Common.CheckCommonProperties(this.Site, true);

            this.sutControlAdapter = this.Site.GetAdapter <IMS_LISTSWSSUTControlAdapter>();

            #region New initialization
            if (!TestSuiteHelper.GuardEnviromentClean())
            {
                Site.Debug.Fail("The test environment is not clean, refer the log files for details.");
            }

            // Initialize the TestSuiteHelper
            TestSuiteHelper.Initialize(this.Site, this.listwsInstance);
            #endregion
        }
Exemple #14
0
        /// <summary>
        /// Call SendMail command to send one voice email
        /// </summary>
        /// <param name="emailSubject">Email subject</param>
        /// <param name="firstVoiceFilePath">First voice attachment file name</param>
        /// <param name="secondVoiceFilePath">Second voice attachment file name</param>
        /// <returns>Email item</returns>
        private Sync SendVoiceMail(string emailSubject, string firstVoiceFilePath, string secondVoiceFilePath)
        {
            // Create mail content
            string senderEmail   = Common.GetMailAddress(this.User1Information.UserName, this.User1Information.UserDomain);
            string receiverEmail = Common.GetMailAddress(this.User2Information.UserName, this.User2Information.UserDomain);
            string emailBody     = Common.GenerateResourceName(Site, "content");
            string callNumber    = "7125550123";

            // Create voice mail content mime
            string voiceMailMime = TestSuiteHelper.CreateVoiceAttachmentMime(
                senderEmail,
                receiverEmail,
                emailSubject,
                emailBody,
                callNumber,
                firstVoiceFilePath,
                secondVoiceFilePath);

            string           clientId        = TestSuiteHelper.GetClientId();
            SendMailRequest  sendMailRequest = TestSuiteHelper.CreateSendMailRequest(clientId, false, voiceMailMime);
            SendMailResponse response        = this.EMAILAdapter.SendMail(sendMailRequest);

            // Verify send voice mail success
            Site.Assert.AreEqual <string>(
                string.Empty,
                response.ResponseDataXML,
                "The server should return an empty xml response data to indicate SendMail command executes successfully.",
                response.ResponseDataXML);

            #region Record user name, folder collectionId and item subject that are used in this case.
            this.SwitchUser(this.User2Information, true);
            this.RecordCaseRelativeItems(this.User2Information.UserName, this.User2Information.InboxCollectionId, emailSubject);
            #endregion

            #region Sync changes in user2 mailbox .
            // Sync changes
            SyncStore result    = this.GetSyncResult(emailSubject, this.User2Information.InboxCollectionId, null);
            Sync      emailItem = TestSuiteHelper.GetSyncAddItem(result, emailSubject);
            #endregion

            return(emailItem);
        }
Exemple #15
0
        /// <summary>
        /// Update email with invalid data
        /// </summary>
        /// <param name="invalidElement">invalid element send to server</param>
        /// <returns>Update results status code</returns>
        private string UpdateVoiceEmailWithInvalidData(string invalidElement)
        {
            // Switch to user2 mailbox
            this.SwitchUser(this.User2Information, true);

            // Sync changes
            SyncStore initSyncResult   = this.InitializeSync(this.User2Information.InboxCollectionId);
            SyncStore syncChangeResult = this.SyncChanges(initSyncResult.SyncKey, this.User2Information.InboxCollectionId, null);
            string    syncKey          = syncChangeResult.SyncKey;
            string    serverId         = this.User2Information.InboxCollectionId;

            // Create normal Sync change request
            Request.SyncCollectionChange changeData = TestSuiteHelper.CreateSyncChangeData(true, serverId, null, null);
            SyncRequest syncRequest = TestSuiteHelper.CreateSyncChangeRequest(syncKey, this.User2Information.InboxCollectionId, changeData);

            // Calls Sync command to update email with invalid sync request
            string             insertTag = "</ApplicationData>";
            SendStringResponse result    = this.EMAILAdapter.InvalidSync(syncRequest, invalidElement, insertTag);

            // Get status code
            return(TestSuiteHelper.GetStatusCode(result.ResponseDataXML));
        }
        /// <summary>
        /// Send a meeting request email.
        /// </summary>
        /// <param name="subject">The subject of email</param>
        /// <param name="calendar">The meeting calendar</param>
        protected void SendMeetingRequest(string subject, Calendar calendar)
        {
            string emailBody = Common.GenerateResourceName(Site, "content");
            string icalendarFormatContent = TestSuiteHelper.CreateiCalendarFormatContent(calendar);

            string meetingEmailMime = TestSuiteHelper.CreateMeetingRequestMime(
                calendar.OrganizerEmail,
                calendar.Attendees.Attendee[0].Email,
                subject,
                emailBody,
                icalendarFormatContent);
            string clientId = TestSuiteHelper.GetClientId();

            SendMailRequest sendMailRequest = TestSuiteHelper.CreateSendMailRequest(clientId, false, meetingEmailMime);

            this.SwitchUser(this.User1Information, false);
            SendMailResponse response = this.EMAILAdapter.SendMail(sendMailRequest);

            Site.Assert.AreEqual <string>(
                string.Empty,
                response.ResponseDataXML,
                "The server should return an empty xml response data to indicate SendMail command success.");
        }
        /// <summary>
        /// Add a meeting to the server.
        /// </summary>
        /// <param name="calendarCollectionId">The collectionId of the folder which the item should be added.</param>
        /// <param name="elementsToValueMap">The key and value pairs of common meeting properties.</param>
        protected void SyncAddMeeting(string calendarCollectionId, Dictionary <Request.ItemsChoiceType8, object> elementsToValueMap)
        {
            Request.SyncCollectionAddApplicationData applicationData = new Request.SyncCollectionAddApplicationData
            {
                Items            = new object[elementsToValueMap.Count],
                ItemsElementName = new Request.ItemsChoiceType8[elementsToValueMap.Count]
            };

            if (elementsToValueMap.Count > 0)
            {
                elementsToValueMap.Values.CopyTo(applicationData.Items, 0);
                elementsToValueMap.Keys.CopyTo(applicationData.ItemsElementName, 0);
            }

            SyncStore   iniSync        = this.InitializeSync(calendarCollectionId);
            SyncRequest syncAddRequest = TestSuiteHelper.CreateSyncAddRequest(iniSync.SyncKey, calendarCollectionId, applicationData);

            SyncStore syncAddResponse = this.EMAILAdapter.Sync(syncAddRequest);

            Site.Assert.AreEqual <int>(
                1,
                int.Parse(syncAddResponse.AddResponses[0].Status),
                "The sync add operation should be successful.");
        }
 public void TestCaseCleanup()
 {
     #region New clean up
     TestSuiteHelper.CleanUp();
     #endregion
 }
        /// <summary>
        /// Create a default calendar object in the current login user calendar folder
        /// </summary>
        /// <param name="subject">The calendar subject</param>
        /// <param name="organizerEmailAddress">The organizer email address</param>
        /// <param name="attendeeEmailAddress">The attendee email address</param>
        /// <param name="calendarUID">The uid of calendar</param>
        /// <param name="timestamp">The DtStamp of calendar</param>
        /// <param name="startTime">The StartTime of calendar</param>
        /// <param name="endTime">The EndTime of calendar</param>
        /// <returns>Returns the Calendar instance</returns>
        protected Calendar CreateDefaultCalendar(
            string subject,
            string organizerEmailAddress,
            string attendeeEmailAddress,
            string calendarUID,
            DateTime?timestamp,
            DateTime?startTime,
            DateTime?endTime)
        {
            #region Configure the default calendar application data
            Request.SyncCollectionAdd syncAddCollection = new Request.SyncCollectionAdd();
            string clientId = TestSuiteHelper.GetClientId();
            syncAddCollection.ClientId        = clientId;
            syncAddCollection.ApplicationData = new Request.SyncCollectionAddApplicationData();

            List <object> items = new List <object>();
            List <Request.ItemsChoiceType8> itemsElementName = new List <Request.ItemsChoiceType8>();

            if (!Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("12.1"))
            {
                items.Add(true);
                itemsElementName.Add(Request.ItemsChoiceType8.ResponseRequested);
            }
            #region TIME/Subject/Location/UID
            items.Add(string.Format("{0:yyyyMMddTHHmmss}Z", null == startTime ? DateTime.UtcNow.AddDays(5) : startTime.Value));
            itemsElementName.Add(Request.ItemsChoiceType8.StartTime);

            items.Add(string.Format("{0:yyyyMMddTHHmmss}Z", null == endTime ? DateTime.UtcNow.AddDays(5).AddMinutes(30) : endTime.Value));
            itemsElementName.Add(Request.ItemsChoiceType8.EndTime);

            if (!Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("16.0") && !Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("16.1"))
            {
                items.Add(string.Format("{0:yyyyMMddTHHmmss}Z", null == timestamp ? DateTime.UtcNow.AddDays(5) : timestamp.Value));
                itemsElementName.Add(Request.ItemsChoiceType8.DtStamp);
            }

            items.Add(subject);
            itemsElementName.Add(Request.ItemsChoiceType8.Subject);

            items.Add(calendarUID ?? Guid.NewGuid().ToString());
            if (Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("16.0") || Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("16.1"))
            {
                itemsElementName.Add(Request.ItemsChoiceType8.ClientUid);
            }
            else
            {
                itemsElementName.Add(Request.ItemsChoiceType8.UID);
            }

            if (Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("16.0") || Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("16.1"))
            {
                Request.Location location = new Request.Location();
                location.DisplayName = "OFFICE";
                items.Add(location);
                itemsElementName.Add(Request.ItemsChoiceType8.Location);
            }
            else
            {
                items.Add("OFFICE");
                itemsElementName.Add(Request.ItemsChoiceType8.Location1);
            }
            #endregion

            #region Attendee/Organizer
            Request.AttendeesAttendee attendee = new Request.AttendeesAttendee
            {
                Email                 = attendeeEmailAddress,
                Name                  = new MailAddress(attendeeEmailAddress).User,
                AttendeeStatus        = 0x0,
                AttendeeTypeSpecified = true,
                AttendeeType          = 0x1
            };

            // 0x0 = Response unknown

            // 0x1 = Required
            items.Add(new Request.Attendees()
            {
                Attendee = new Request.AttendeesAttendee[] { attendee }
            });
            itemsElementName.Add(Request.ItemsChoiceType8.Attendees);

            if (!Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("16.0") && !Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("16.1"))
            {
                items.Add(organizerEmailAddress);
                itemsElementName.Add(Request.ItemsChoiceType8.OrganizerEmail);
                items.Add(new MailAddress(organizerEmailAddress).DisplayName);
                itemsElementName.Add(Request.ItemsChoiceType8.OrganizerName);
            }
            #endregion

            #region Sensitivity/BusyStatus/AllDayEvent
            // 0x0 == Normal
            items.Add((byte)0x0);
            itemsElementName.Add(Request.ItemsChoiceType8.Sensitivity);

            // 0x1 == Tentative
            items.Add((byte)0x1);
            itemsElementName.Add(Request.ItemsChoiceType8.BusyStatus);

            // 0x0 not an all-day event
            items.Add((byte)0x0);
            itemsElementName.Add(Request.ItemsChoiceType8.AllDayEvent);
            #endregion

            syncAddCollection.ApplicationData.Items            = items.ToArray();
            syncAddCollection.ApplicationData.ItemsElementName = itemsElementName.ToArray();
            #endregion

            #region Execute the Sync command to upload the calendar
            SyncStore   initSyncResponse      = this.InitializeSync(this.User1Information.CalendarCollectionId);
            SyncRequest uploadCalendarRequest = TestSuiteHelper.CreateSyncAddRequest(initSyncResponse.SyncKey, this.User1Information.CalendarCollectionId, syncAddCollection);
            this.EMAILAdapter.Sync(uploadCalendarRequest);
            #endregion

            #region Get the new added calendar item
            SyncStore getItemResponse = this.GetSyncResult(subject, this.User1Information.CalendarCollectionId, null);
            Sync      calendarItem    = TestSuiteHelper.GetSyncAddItem(getItemResponse, subject);
            Site.Assert.IsNotNull(calendarItem, "The item with subject {0} should be found in the folder {1}.", subject, FolderType.Calendar.ToString());
            #endregion

            return(calendarItem.Calendar);
        }
        /// <summary>
        /// Delete all the items in a folder.
        /// </summary>
        /// <param name="userInformation">The user information which contains user created items</param>
        private void DeleteItemsInFolder(UserInformation userInformation)
        {
            foreach (CreatedItems createdItems in userInformation.UserCreatedItems)
            {
                SyncStore syncStore  = this.InitializeSync(createdItems.CollectionId);
                SyncStore result     = this.SyncChanges(syncStore.SyncKey, createdItems.CollectionId, null);
                string    syncKey    = result.SyncKey;
                int       retryCount = int.Parse(Common.GetConfigurationPropertyValue("RetryCount", this.Site));
                int       waitTime   = int.Parse(Common.GetConfigurationPropertyValue("WaitTime", this.Site));
                int       counter    = 0;
                do
                {
                    Thread.Sleep(waitTime);
                    if (result != null)
                    {
                        if (result.CollectionStatus == 1)
                        {
                            break;
                        }
                    }

                    counter++;
                }while (counter < retryCount / 10);
                if (result.AddElements != null)
                {
                    SyncRequest deleteRequest;
                    foreach (Sync syncItem in result.AddElements)
                    {
                        if (createdItems.CollectionId == userInformation.CalendarCollectionId)
                        {
                            foreach (string subject in createdItems.ItemSubject)
                            {
                                if (syncItem.Calendar != null && syncItem.Calendar.Subject != null)
                                {
                                    if (syncItem.Calendar.Subject.Equals(subject, StringComparison.CurrentCultureIgnoreCase))
                                    {
                                        deleteRequest = CreateSyncPermanentDeleteRequest(syncKey, createdItems.CollectionId, syncItem.ServerId);
                                        SyncStore deleteSyncResult = this.EMAILAdapter.Sync(deleteRequest);
                                        syncKey = deleteSyncResult.SyncKey;
                                        Site.Assert.AreEqual <byte>(1, deleteSyncResult.CollectionStatus, "Item should be deleted.");
                                    }
                                }
                            }
                        }
                        else
                        {
                            List <Request.SyncCollectionDelete> deleteData = new List <Request.SyncCollectionDelete>();
                            foreach (string subject in createdItems.ItemSubject)
                            {
                                string serverId = null;
                                if (result != null)
                                {
                                    foreach (Sync item in result.AddElements)
                                    {
                                        if (item.Email.Subject != null && item.Email.Subject.Contains(subject))
                                        {
                                            serverId = item.ServerId;
                                            break;
                                        }

                                        if (item.Calendar.Subject != null && item.Calendar.Subject.Contains(subject))
                                        {
                                            serverId = item.ServerId;
                                            break;
                                        }
                                    }
                                }

                                if (serverId != null)
                                {
                                    deleteData.Add(new Request.SyncCollectionDelete()
                                    {
                                        ServerId = serverId
                                    });
                                }
                            }

                            if (deleteData.Count > 0)
                            {
                                Request.SyncCollection syncCollection = TestSuiteHelper.CreateSyncCollection(syncKey, createdItems.CollectionId);
                                syncCollection.Commands                = deleteData.ToArray();
                                syncCollection.DeletesAsMoves          = false;
                                syncCollection.DeletesAsMovesSpecified = true;

                                SyncRequest syncRequest  = Common.CreateSyncRequest(new Request.SyncCollection[] { syncCollection });
                                SyncStore   deleteResult = this.EMAILAdapter.Sync(syncRequest);
                                syncKey = deleteResult.SyncKey;
                                Site.Assert.AreEqual <byte>(
                                    1,
                                    deleteResult.CollectionStatus,
                                    "The value of Status should be 1 to indicate the Sync command executes successfully.");
                            }
                        }
                    }
                }
            }
        }
        public void MSLISTSWS_S05_TC09_UndoCheckOut_InvalidParameter()
        {
            string listTitle            = TestSuiteHelper.GetUniqueListName();
            int    docLibraryTemplateId = (int)TemplateType.Document_Library;

            TestSuiteHelper.CreateList(listTitle, docLibraryTemplateId);

            // Upload the file to the document library
            string absoluteFileUrl = this.sutControlAdapter.UploadFile(listTitle);

            Site.Assert.IsTrue(
                !string.IsNullOrEmpty(absoluteFileUrl),
                "Upload file to the list {0} should be successful, the file path is [{1}]",
                listTitle,
                absoluteFileUrl);

            #region Check out the added file.

            bool checkOutSucceeded = false;
            checkOutSucceeded = this.listwsInstance.CheckOutFile(absoluteFileUrl, bool.TrueString, string.Empty);
            if (!checkOutSucceeded)
            {
                Site.Assert.Fail("Expect CheckOutFile operation failed due to unexpected reason.");
            }

            #endregion

            #region Undo the checkout with null pageUrl parameter, try to capture R783 and R2306

            bool   isSoapFaultExist = false;
            string errorCode        = string.Empty;
            try
            {
                string nullPageUrl = null;
                this.listwsInstance.UndoCheckOut(nullPageUrl);
            }
            catch (SoapException soapEx)
            {
                isSoapFaultExist = true;
                errorCode        = TestSuiteHelper.GetErrorCode(soapEx);
            }

            // Capture R783 if the error code 0x82000001 is returned.
            Site.CaptureRequirementIfIsTrue(
                isSoapFaultExist && errorCode.Equals("0x82000001", StringComparison.OrdinalIgnoreCase),
                783,
                @"[In UndoCheckOut operation] If the pageUrl is null the protocol server MUST return a SOAP fault with error code 0x82000001.");

            #endregion

            #region Undo the checkout with pageUrl parameter setting to an invalid URL, try to capture R7851 and R7852

            isSoapFaultExist = false;
            string errorString = string.Empty;
            try
            {
                string invalidPageUrl = "/";
                this.listwsInstance.UndoCheckOut(invalidPageUrl);
            }
            catch (SoapException soapEx)
            {
                isSoapFaultExist = true;
                errorString      = TestSuiteHelper.GetErrorString(soapEx);
            }

            if (Common.IsRequirementEnabled(7851, this.Site))
            {
                this.Site.CaptureRequirementIfIsFalse(
                    isSoapFaultExist,
                    7851,
                    @"[In UndoCheckOut operation] Implementation does not return a SOAP fault if the pageUrl is an invalid URL. <74> Section 3.1.4.26: wss3 does not return a SOAP fault.");
            }

            if (Common.IsRequirementEnabled(7852, this.Site))
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-LISTSWS_R7852. SOAP fault {0}.", isSoapFaultExist ? "is returned with error string '" + errorString + "'" : "is not returned");

                // Verify MS-LISTSWS requirement: MS-LISTSWS_R7852
                bool isVerifiedR7852 = isSoapFaultExist && string.Equals(errorString, "Invalid URI: The format of the URI could not be determined.");

                this.Site.CaptureRequirementIfIsTrue(
                    isVerifiedR7852,
                    7852,
                    @"[In UndoCheckOut operation] Implementation does return a SOAP fault with the error string: ""Invalid URI: The format of the URI could not be determined."" if the pageUrl is an invalid URL.(Microsoft® SharePoint® Foundation 2010 and above follow this behavior.)");
            }

            #endregion

            #region Undo the checkout with the pageUrl is an empty string, try to capture R784 and R1962
            isSoapFaultExist = false;
            errorCode        = string.Empty;
            try
            {
                string nullPageUrl = string.Empty;
                this.listwsInstance.UndoCheckOut(nullPageUrl);
            }
            catch (SoapException soapEx)
            {
                isSoapFaultExist = true;
                errorCode        = TestSuiteHelper.GetErrorCode(soapEx);
            }

            // Capture R784 if the error code 0x82000001 is returned.
            Site.CaptureRequirementIfIsTrue(
                isSoapFaultExist && errorCode.Equals("0x82000001", StringComparison.OrdinalIgnoreCase),
                784,
                @"[In UndoCheckOut operation] If the pageUrl is an empty string the protocol server MUST return a SOAP fault with error code 0x82000001.");

            // Capture R1962 if the error code 0x82000001 is returned.
            Site.CaptureRequirementIfIsTrue(
                isSoapFaultExist && errorCode.Equals("0x82000001", StringComparison.OrdinalIgnoreCase),
                1962,
                @"[In UndoCheckOut operation] [If the pageUrl is an empty string the protocol server MUST return a SOAP fault with error code 0x82000001.] This indicates that the parameter pageUrl is missing or invalid.");
            #endregion

            #region Check out a file that has been checked out, if the CheckOutFile should return false, capture R2305;

            bool isUndoCheckOutSuccess = false;
            isUndoCheckOutSuccess = this.listwsInstance.UndoCheckOut(absoluteFileUrl);
            Site.Assert.IsTrue(isUndoCheckOutSuccess, "The UndoCheckOutFile operation must be successful in the first time.");

            // Check out a file that have been undo checked out
            isUndoCheckOutSuccess = this.listwsInstance.UndoCheckOut(absoluteFileUrl);

            // Capture R2306 if the UndoCheckOut returns a false value.
            Site.CaptureRequirementIfIsFalse(
                isUndoCheckOutSuccess,
                2306,
                @"[UndoCheckOutResponse] [The value is True if the operation is successful;]otherwise, False is returned.");

            #endregion
        }
        public void MSLISTSWS_S05_TC03_CheckInFile_InvalidParameter()
        {
            // create a normal document Library and upload a file to SUT
            string listTitle            = TestSuiteHelper.GetUniqueListName();
            int    docLibraryTemplateId = (int)TemplateType.Document_Library;

            TestSuiteHelper.CreateList(listTitle, docLibraryTemplateId);

            // Upload the file to the document library
            string absoluteFileUrl = this.sutControlAdapter.UploadFile(listTitle);

            Site.Assert.IsTrue(
                !string.IsNullOrEmpty(absoluteFileUrl),
                "Upload file to the list {0} should be successful, the file path is [{1}]",
                listTitle,
                absoluteFileUrl);

            #region Check out the added file.

            bool isFileCheckOutSuccessfully = false;
            isFileCheckOutSuccessfully = this.listwsInstance.CheckOutFile(absoluteFileUrl, bool.TrueString, string.Empty);

            Site.Assert.IsTrue(isFileCheckOutSuccessfully, "CheckOutFile must succeed!");

            #endregion

            #region Try to check in the file which has been checked out with invalid pageUrl parameter.

            bool   isSoapFaultExisted = false;
            string errorCode          = string.Empty;
            try
            {
                string nullPageUrl = null;
                this.listwsInstance.CheckInFile(nullPageUrl, string.Empty, CheckInTypeValue.MajorCheckIn);
            }
            catch (SoapException soapEx)
            {
                isSoapFaultExisted = true;
                errorCode          = TestSuiteHelper.GetErrorCode(soapEx);
            }

            #endregion

            #region Capture R390 if the error code 0x82000001 is returned.

            // if there are a soap fault and the error code equal to the "0x82000001", capture R390
            Site.CaptureRequirementIfIsTrue(
                isSoapFaultExisted && errorCode.Equals("0x82000001", StringComparison.OrdinalIgnoreCase),
                390,
                @"[In CheckInFile operation] If the pageUrl is null the protocol server MUST return a SOAP fault with error code 0x82000001.");
            #endregion

            #region Try to check in the file if the pageUrl is empty string.

            isSoapFaultExisted = false;
            errorCode          = string.Empty;
            try
            {
                string emptyPageUrl = string.Empty;
                this.listwsInstance.CheckInFile(emptyPageUrl, string.Empty, CheckInTypeValue.MajorCheckIn);
            }
            catch (SoapException soapEx)
            {
                isSoapFaultExisted = true;
                errorCode          = TestSuiteHelper.GetErrorCode(soapEx);
            }

            // if there are a soap fault and the error code equal to the "0x82000001", capture R391
            Site.CaptureRequirementIfIsTrue(
                isSoapFaultExisted && errorCode.Equals("0x82000001", StringComparison.OrdinalIgnoreCase),
                391,
                @"[In CheckInFile operation] If the pageUrl is empty string the protocol server MUST return a SOAP fault with error code 0x82000001.");

            // if there are a soap fault and the error code equal to the "0x82000001", capture 1640
            Site.CaptureRequirementIfIsTrue(
                isSoapFaultExisted && errorCode.Equals("0x82000001", StringComparison.OrdinalIgnoreCase),
                1640,
                @"[In CheckInFile operation] [If the pageUrl is empty string the protocol server MUST return a SOAP fault with error code 0x82000001.] This indicates that the parameter pageUrl is missing.");

            #endregion

            #region Try to check in the file if pageUrl setting to an invalid URL.

            isSoapFaultExisted = false;
            string errorString = string.Empty;
            errorCode = string.Empty;
            try
            {
                string invalidPageUrl = "/";
                this.listwsInstance.CheckInFile(invalidPageUrl, string.Empty, CheckInTypeValue.MajorCheckIn);
            }
            catch (SoapException soapEx)
            {
                isSoapFaultExisted = true;
                errorString        = TestSuiteHelper.GetErrorString(soapEx);
            }

            if (Common.IsRequirementEnabled(3921, this.Site))
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-LISTSWS_R3921. SOAP fault {0}.", isSoapFaultExisted ? "is returned with error string '" + errorString + "'" : "is not returned");

                // Verify MS-LISTSWS requirement: MS-LISTSWS_R3921
                bool isVerifiedR3921 = isSoapFaultExisted && string.Equals(errorString, "Invalid URI: The format of the URI could not be determined.");

                this.Site.CaptureRequirementIfIsTrue(
                    isVerifiedR3921,
                    3921,
                    @"[In CheckInFile operation] [If the pageUrl is an invalid URL] Implementation does return a SOAP fault with error string ""Invalid URI: The format of the URI could not be determined"".(SharePoint Foundation 2010 and above follow this behavior.)");

                // Verify MS-LISTSWS requirement: MS-LISTSWS_R1641
                this.Site.CaptureRequirementIfIsTrue(
                    isVerifiedR3921,
                    1641,
                    @"[In CheckInFile operation] [If the pageUrl is an invalid URL, the protocol server SHOULD<36> return a SOAP fault with error string ""Invalid URI: The format of the URI could not be determined"".] This indicates that the parameter pageUrl is invalid.");
            }

            if (Common.IsRequirementEnabled(3922, this.Site))
            {
                this.Site.CaptureRequirementIfIsFalse(
                    isSoapFaultExisted,
                    3922,
                    @"[In CheckInFile operation] [If the pageUrl is an invalid URL] Implementation does not return a SOAP fault.(<36> Section 3.1.4.7:  Windows SharePoint Services 3.0 does not return a SOAP fault..)");
            }

            #endregion

            #region Try to check in the file that have been check in success

            bool isCheckInSuccess = false;

            // Call the "CheckInFile" operation and ensure check in successfully.
            isCheckInSuccess = this.listwsInstance.CheckInFile(absoluteFileUrl, string.Empty, CheckInTypeValue.MajorCheckIn);
            Site.Assert.IsTrue(isCheckInSuccess, "CheckInFile operation must be successfully for the first time");

            // Call the "CheckInFile" operation to check in the file which have been check in successfully in previous checked in file operation.
            isCheckInSuccess = this.listwsInstance.CheckInFile(absoluteFileUrl, string.Empty, CheckInTypeValue.MajorCheckIn);

            // If "CheckInFile" operation return false, capture R2304
            Site.CaptureRequirementIfIsFalse(
                isCheckInSuccess,
                2304,
                @"[CheckInFileResponse][CheckInFileResult] [The value is True if the operation is successful;] otherwise, False is returned.");

            #endregion
        }
        public void MSLISTSWS_S05_TC06_CheckOutFile_InvalidParameter()
        {
            // create a normal document Library and upload a file to SUT
            string listTitle            = TestSuiteHelper.GetUniqueListName();
            int    docLibraryTemplateId = (int)TemplateType.Document_Library;

            TestSuiteHelper.CreateList(listTitle, docLibraryTemplateId);

            // Upload the file to the document library
            string absoluteFileUrl = this.sutControlAdapter.UploadFile(listTitle);

            Site.Assert.IsTrue(
                !string.IsNullOrEmpty(absoluteFileUrl),
                "Upload file to the list {0} should be successful, the file path is [{1}]",
                listTitle,
                absoluteFileUrl);

            #region Check out the added file with null pageUrl parameter, try to capture R406; R2305;

            bool   isSoapFaultExist = false;
            string errorCode        = string.Empty;
            try
            {
                string nullPageUrl = null;
                this.listwsInstance.CheckOutFile(nullPageUrl, bool.TrueString, string.Empty);
            }
            catch (SoapException soapEx)
            {
                isSoapFaultExist = true;
                errorCode        = TestSuiteHelper.GetErrorCode(soapEx);
            }

            // if there are a soap fault and the error code equal to the "0x82000001", capture R406
            Site.CaptureRequirementIfIsTrue(
                isSoapFaultExist && errorCode.Equals("0x82000001", StringComparison.OrdinalIgnoreCase),
                406,
                @"[In CheckOutFile operation]If the pageUrl is null  the protocol server MUST return a SOAP fault with error code 0x82000001.");

            #endregion

            #region Check out the added file with pageUrl is empty string, and try to capture R407; R1663

            isSoapFaultExist = false;
            errorCode        = string.Empty;
            try
            {
                string emptyPageUrl = string.Empty;
                this.listwsInstance.CheckOutFile(emptyPageUrl, bool.TrueString, string.Empty);
            }
            catch (SoapException soapEx)
            {
                isSoapFaultExist = true;
                errorCode        = TestSuiteHelper.GetErrorCode(soapEx);
            }

            // If there are a soap fault and the error code equal to the "0x82000001", capture R407
            Site.CaptureRequirementIfIsTrue(
                isSoapFaultExist && errorCode.Equals("0x82000001", StringComparison.OrdinalIgnoreCase),
                407,
                @"[In CheckOutFile operation] If the pageUrl is empty string, the protocol server MUST return a SOAP fault with error code 0x82000001.");

            // If there are a soap fault and the error code equal to the "0x82000001", capture R1663
            Site.CaptureRequirementIfIsTrue(
                isSoapFaultExist && errorCode.Equals("0x82000001", StringComparison.OrdinalIgnoreCase),
                1663,
                @"[In CheckOutFile operation] [If the pageUrl is empty string, the protocol server MUST return a SOAP fault with error code 0x82000001.] This indicates that the pageUrl is an empty string.");
            #endregion

            #region Check out the added file with pageUrl setting to an invalid URL, try to capture MS-LISTSWS_R4081 MS-LISTSWS_R1664 and MS-LISTSWS_R4082

            isSoapFaultExist = false;
            string errorString = string.Empty;
            errorCode = string.Empty;
            try
            {
                string invalidPageUrl = "/";
                this.listwsInstance.CheckOutFile(invalidPageUrl, bool.TrueString, string.Empty);
            }
            catch (SoapException soapEx)
            {
                isSoapFaultExist = true;
                errorString      = TestSuiteHelper.GetErrorString(soapEx);
                errorCode        = TestSuiteHelper.GetErrorCode(soapEx);
            }

            if (Common.IsRequirementEnabled(4081, this.Site))
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-LISTSWS_R4081. SOAP fault {0}.", isSoapFaultExist ? "is returned with error string '" + errorString + "'" : "is not returned");

                // Verify MS-LISTSWS requirement: MS-LISTSWS_R4081
                bool isVerifiedR4081 = isSoapFaultExist && string.Equals(errorString, "Invalid URI: The format of the URI could not be determined.");

                this.Site.CaptureRequirementIfIsTrue(
                    isVerifiedR4081,
                    4081,
                    @"[In CheckOutFile operation] [If the pageUrl is an invalid URL] Implementation does return a SOAP fault with error string ""Invalid URI: The format of the URI could not be determined."".(SharePoint Foundation 2010 and above follow this behavior.)");

                // If there is no any error code in soap fault, capture MS-LISTSWS_R1664
                this.Site.CaptureRequirementIfIsTrue(
                    string.IsNullOrEmpty(errorCode),
                    1664,
                    @"[In CheckOutFile operation] [If the pageUrl is an invalid URL, the protocol server SHOULD<38> return a SOAP fault with error string ""Invalid URI: The format of the URI could not be determined."". ]There is no error code for this fault.");
            }

            if (Common.IsRequirementEnabled(4082, this.Site))
            {
                this.Site.CaptureRequirementIfIsFalse(
                    isSoapFaultExist,
                    4082,
                    @"[In CheckOutFile operation] [If the pageUrl is an invalid URL] Implementation does not return a SOAP fault.(<38> Section 3.1.4.8:  wss3 does not return a SOAP fault.)");
            }

            #endregion

            #region Check out the added file with the checkoutToLocal parameter does not resolve to a valid Boolean string.Try to capture R410;R1666;

            isSoapFaultExist = false;
            errorCode        = string.Empty;
            try
            {
                // Get an invalid path
                string invalidBoolValue = Guid.NewGuid().ToString("N");
                this.listwsInstance.CheckOutFile(absoluteFileUrl, invalidBoolValue, string.Empty);
            }
            catch (SoapException soapEx)
            {
                isSoapFaultExist = true;
                errorCode        = TestSuiteHelper.GetErrorCode(soapEx);
            }

            // If there are a Soap fault, capture R410
            Site.CaptureRequirementIfIsTrue(
                isSoapFaultExist,
                410,
                @"[In CheckOutFile operation] If the checkoutToLocal parameter does not resolve to a valid Boolean string (case-insensitive equality to ""True"" or ""False"", ignoring leading and trailing white space), the protocol server MUST return a SOAP fault.");

            // If there are a soap fault and no error code return in SoapFault, capture R1666
            Site.CaptureRequirementIfIsTrue(
                isSoapFaultExist && string.IsNullOrEmpty(errorCode),
                1666,
                @"[In CheckOutFile operation] [If the checkoutToLocal parameter does not resolve to a valid Boolean string (case-insensitive equality to ""True"" or ""False"", ignoring leading and trailing white space), the protocol server MUST return a SOAP fault.]There is no error code for this fault.");

            #endregion

            isSoapFaultExist = false;
            errorCode        = string.Empty;
            try
            {
                // Get an invalid path
                string invalidBoolValue = Guid.NewGuid().ToString("N");
                this.listwsInstance.CheckOutFile(absoluteFileUrl, invalidBoolValue, string.Empty);
            }
            catch (SoapException soapEx)
            {
                isSoapFaultExist = true;
                errorCode        = TestSuiteHelper.GetErrorCode(soapEx);
            }

            #region Check out a file that have been checked out, if the CheckOutFile should return false, capture R2305;

            bool ischeckOutSuccess = false;
            ischeckOutSuccess = this.listwsInstance.CheckOutFile(absoluteFileUrl, bool.TrueString, string.Empty);
            Site.Assert.IsTrue(ischeckOutSuccess, "The CheckOutFile operation must be successful in the first time.");

            // Check out a file that have been checked out
            ischeckOutSuccess = this.listwsInstance.CheckOutFile(absoluteFileUrl, bool.TrueString, string.Empty);

            // if the second CheckOutFile operation return false, capture R2305
            Site.CaptureRequirementIfIsFalse(
                ischeckOutSuccess,
                2305,
                @"[CheckOutFileResponse][The value is True if the operation is successful; ]otherwise, False is returned");

            #endregion
        }