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

MSLISTSWS_S05_TC02_CheckInFile_EmptyCheckInType() private method

private MSLISTSWS_S05_TC02_CheckInFile_EmptyCheckInType ( ) : void
return void
        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.");
        }