Microsoft.Protocols.TestSuites.MS_LISTSWS.S05_OperationOnFiles.MSLISTSWS_S05_TC01_CheckInFile_WithoutDocument C# (CSharp) Method

MSLISTSWS_S05_TC01_CheckInFile_WithoutDocument() private method

private MSLISTSWS_S05_TC01_CheckInFile_WithoutDocument ( ) : void
return void
        public void MSLISTSWS_S05_TC01_CheckInFile_WithoutDocument()
        {
            // 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 CheckInFile operation with pageUrl not referring to a document library, and catch the exception.

            string errorCode = string.Empty;
            bool isSoapFaultExisted = false;
            try
            {
                this.listwsInstance.CheckInFile(absoluteFileUrl + TestSuiteHelper.GenerateRandomString(1), string.Empty, "0");
            }
            catch (SoapException soapEx)
            {
                isSoapFaultExisted = true;
                errorCode = TestSuiteHelper.GetErrorCode(soapEx);
            }
            #endregion

            #region Capture R393 R1642
            // If Soap Fault Existed, Capture R393
            Site.CaptureRequirementIfIsTrue(
                                 isSoapFaultExisted,
                                 393,
                                 @"[In CheckInFile 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 R1642
            Site.CaptureRequirementIfIsTrue(
                        string.IsNullOrEmpty(errorCode),
                        1642,
                        "[In CheckInFile operation] [If the pageUrl does not refer to a document library, the protocol server MUST return a SOAP fault.]There is no error code returned for this fault.");
            #endregion
        }