Microsoft.Protocols.TestSuites.MS_OXWSCORE.S01_ManageBaseItems.MSOXWSCORE_S01_TC26_CreateItemWithFlagStatusFlagged C# (CSharp) Method

MSOXWSCORE_S01_TC26_CreateItemWithFlagStatusFlagged() private method

        public void MSOXWSCORE_S01_TC26_CreateItemWithFlagStatusFlagged()
        {
            Site.Assume.IsTrue(Common.IsRequirementEnabled(1271, this.Site), "Exchange 2007 and Exchange 2010 do not support the FlagType complex type.");

            #region Step 1: Create the item, set FlagStatus to Flagged, set element StartDate and DueDate and do not set CompleteDate element.
            ItemType[] createdItems = new ItemType[] { new ItemType() };
            createdItems[0].Subject = Common.GenerateResourceName(
                this.Site,
                TestSuiteHelper.SubjectForCreateItem,
                1);

            createdItems[0].Flag = new FlagType();
            createdItems[0].Flag.FlagStatus = FlagStatusType.Flagged;
            createdItems[0].Flag.StartDateSpecified = true;
            createdItems[0].Flag.StartDate = DateTime.Now;
            createdItems[0].Flag.DueDateSpecified = true;
            createdItems[0].Flag.DueDate = DateTime.Now.AddDays(1);

            CreateItemResponseType createItemResponse = this.CallCreateItemOperation(DistinguishedFolderIdNameType.drafts, createdItems);

            // Check the operation response.
            Common.CheckOperationSuccess(createItemResponse, 1, this.Site);

            ItemIdType[] createdItemIds = Common.GetItemIdsFromInfoResponse(createItemResponse);
            #endregion

            #region Step 2: Get the item.
            // Call the GetItem operation.
            GetItemResponseType getItemResponse = this.CallGetItemOperation(createdItemIds);

            // Check the operation response.
            Common.CheckOperationSuccess(getItemResponse, 1, this.Site);

            ItemIdType[] getItemIds = Common.GetItemIdsFromInfoResponse(getItemResponse);

            // One item should be returned.
            Site.Assert.AreEqual<int>(
                 1,
                 getItemIds.GetLength(0),
                 "One item should be returned! Expected Item Count: {0}, Actual Item Count: {1}",
                 1,
                 getItemIds.GetLength(0));

            Site.Assert.IsTrue(this.IsSchemaValidated, "The schema should be validated.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2002");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2002
            // FlagStatus element is set to Flagged, CompleteDate element is not set, and StartDate and DueDate elements are set,
            // the item is created and gotten successfully, so this requirement can be captured directly.
            this.Site.CaptureRequirement(
                2002,
                @"[In t:FlagType Complex Type] If the FlagStatus element is set to Flagged, the CompleteDate element MUST not be set in the request, and the StartDate and DueDate elements MUST be set or unset in pair;");

            #endregion

            #region Step 3: Create the item, set FlagStatus to Flagged, and do not set StartDate/DueDate/CompleteDate element.
            createdItems = new ItemType[] { new ItemType() };
            createdItems[0].Subject = Common.GenerateResourceName(
                this.Site,
                TestSuiteHelper.SubjectForCreateItem,
                2);

            createdItems[0].Flag = new FlagType();
            createdItems[0].Flag.FlagStatus = FlagStatusType.Flagged;

            createItemResponse = this.CallCreateItemOperation(DistinguishedFolderIdNameType.drafts, createdItems);

            // Check the operation response.
            Common.CheckOperationSuccess(createItemResponse, 1, this.Site);

            createdItemIds = Common.GetItemIdsFromInfoResponse(createItemResponse);
            #endregion

            #region Step 2: Get the item.
            // Call the GetItem operation.
            getItemResponse = this.CallGetItemOperation(createdItemIds);

            // Check the operation response.
            Common.CheckOperationSuccess(getItemResponse, 1, this.Site);

            getItemIds = Common.GetItemIdsFromInfoResponse(getItemResponse);

            // One item should be returned.
            Site.Assert.AreEqual<int>(
                 1,
                 getItemIds.GetLength(0),
                 "One item should be returned! Expected Item Count: {0}, Actual Item Count: {1}",
                 1,
                 getItemIds.GetLength(0));

            Site.Assert.IsTrue(this.IsSchemaValidated, "The schema should be validated.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2002");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2002
            // FlagStatus element is set to Flagged, and do not set StartDate/DueDate/CompleteDate element,
            // the item is created and gotten successfully, so this requirement can be captured directly.
            this.Site.CaptureRequirement(
                2002,
                @"[In t:FlagType Complex Type] If the FlagStatus element is set to Flagged, the CompleteDate element MUST not be set in the request, and the StartDate and DueDate elements MUST be set or unset in pair;");

            #endregion
        }
S01_ManageBaseItems