Microsoft.Protocols.TestSuites.MS_LISTSWS.S04_OperationOnAttachment.MSLISTSWS_S04_TC11_GetAttachmentCollection_ZeroAttachmentTest C# (CSharp) Method

MSLISTSWS_S04_TC11_GetAttachmentCollection_ZeroAttachmentTest() private method

        public void MSLISTSWS_S04_TC11_GetAttachmentCollection_ZeroAttachmentTest()
        {
            #region Add a list and add a list item

            string listId = TestSuiteHelper.CreateList();

            // add one item, if not successful or added number not equal to the specified, will fail the test case.
            List<string> listitemIds = TestSuiteHelper.AddListItems(listId, 1);
            #endregion

            #region Invoke GetAttachmentCollection and capture requirements

            GetAttachmentCollectionResponseGetAttachmentCollectionResult getAttachmentCollectionResult = null;
            bool isSoapFault = false;
            try
            {
                // pick up the added item id, the number is one. 
                getAttachmentCollectionResult = this.listswsAdapterInstance.GetAttachmentCollection(listId, listitemIds[0]);
            }
            catch (SoapException)
            {
                isSoapFault = true;
            }

            #endregion

            #region Requirement Verification

            // If no soap fault, and getAttachmentCollectionResult is not null and the returned 
            // Attachments' length is zero, requirement 543 is captured.
            this.Site.Assert.IsFalse(isSoapFault, "There is unexpected Soap Fault when calling [GetAttachmentCollection] operation.");

            Site.CaptureRequirementIfAreEqual<int>(
                0,
                getAttachmentCollectionResult.Attachments.Length,
                543,
                @"[In GetAttachmentCollection operation] If the protocol client calls the operation on a listItemID containing zero attachments, the protocol server MUST return an empty attachment collection.");

            #endregion
        }