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

MSLISTSWS_S04_TC03_AddAttachment_NullFileName() private method

private MSLISTSWS_S04_TC03_AddAttachment_NullFileName ( ) : void
return void
        public void MSLISTSWS_S04_TC03_AddAttachment_NullFileName()
        {
            #region Create a new list

            bool createListSucceeded = false;
            string listName = TestSuiteHelper.GetUniqueListName();
            string listGuid = TestSuiteHelper.CreateList(listName);
            createListSucceeded = !string.IsNullOrEmpty(listGuid);
            Site.Assert.IsTrue(createListSucceeded, "MSLISTSWS_S04_TC03_AddAttachment_NullFileName, created a new list successfully.");
            #endregion

            #region Add a list item
            List<string> listItemIds = TestSuiteHelper.AddListItems(listGuid, 1);
            Site.Assert.IsNotNull(listItemIds, "Called AddListItems successfully.");

            #endregion

            #region AddAttachment with the file name is null

            bool addAttachmentFail = false;
            string errorCode = null;
            try
            {
                // Call the AddAttachment with the file name is null.
                string fileName = Common.GetConfigurationPropertyValue("AttachmentName", this.Site);
                byte[] attachment = TestSuiteHelper.GetAttachmentContent(fileName);
                this.listswsAdapterInstance.AddAttachment(listName, listItemIds[0], null, attachment);
            }
            catch (SoapException exp)
            {
                errorCode = TestSuiteHelper.GetErrorCode(exp);
                addAttachmentFail = true;
            }

            Site.Assert.IsTrue(addAttachmentFail, "MSLISTSWS_S04_TC03_AddAttachment_NullFileName, call AddAttachmet with file name is null.");

            // Capture R3011 if the error code 0x81020073 is returned.
            Site.CaptureRequirementIfAreEqual<string>(
                "0x81020073",
                errorCode,
                3011,
                @"[In AddAttachment] Otherwise [if the protocol client request includes the listItemID, listName and attachment parameters], if the fileName parameter is missing, the protocol server MUST return a SOAP fault with error code 0x81020073.");

            #endregion
        }