public static int ParceActivityPriority(ImportanceChoicesType priority) { switch (priority) { case ImportanceChoicesType.Low: return(0); case ImportanceChoicesType.Normal: return(1); case ImportanceChoicesType.High: return(2); default: return(1); } }
public void MSOXWSCORE_S01_TC10_VerifyItemWithImportanceChoicesTypeEnums() { // Define the count of enumerations int enumCount = 3; ImportanceChoicesType[] importanceChoicesTypes = new ImportanceChoicesType[enumCount]; importanceChoicesTypes[0] = ImportanceChoicesType.High; importanceChoicesTypes[1] = ImportanceChoicesType.Low; importanceChoicesTypes[2] = ImportanceChoicesType.Normal; // Define an item array to store the items got from GetItem operation response. // Each item should contain a ImportanceChoicesType value as its element's value ItemType[] items = new ItemType[enumCount]; for (int i = 0; i < enumCount; i++) { ImportanceChoicesType importanceChoicesType = importanceChoicesTypes[i]; #region Step 1: Create the item. ItemType[] createdItems = new ItemType[] { new ItemType() }; createdItems[0].Subject = Common.GenerateResourceName( this.Site, TestSuiteHelper.SubjectForCreateItem); createdItems[0].Importance = importanceChoicesType; createdItems[0].ImportanceSpecified = true; CreateItemResponseType createItemResponse = this.CallCreateItemOperation(DistinguishedFolderIdNameType.drafts, createdItems); // Check the operation response. Common.CheckOperationSuccess(createItemResponse, 1, this.Site); ItemIdType[] createdItemIds = Common.GetItemIdsFromInfoResponse(createItemResponse); // One created item should be returned. Site.Assert.AreEqual<int>( 1, createdItemIds.GetLength(0), "One created item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, createdItemIds.GetLength(0)); #endregion #region Step 2: Get the item. GetItemResponseType getItemResponse = this.CallGetItemOperation(createdItemIds); // Check the operation response. Common.CheckOperationSuccess(getItemResponse, 1, this.Site); ItemType[] getItems = Common.GetItemsFromInfoResponse<ItemType>(getItemResponse); // One item should be returned. Site.Assert.AreEqual<int>( 1, getItems.GetLength(0), "One item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, getItems.GetLength(0)); Site.Assert.IsTrue(this.IsSchemaValidated, "The schema should be validated."); items[i] = getItems[0]; #endregion } #region Capture Code // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R198, Expected result:{0}, Actual result:{1}", importanceChoicesTypes[0], items[0].Importance); // If the Importance element is present, // and the Importance element of items[0] equal to the High, which is the same value of importanceChoicesTypes[0] in request, // then this requirement can be verified. bool isVerifyR198 = items[0].ImportanceSpecified && items[0].Importance == ImportanceChoicesType.High; Site.CaptureRequirementIfIsTrue( isVerifyR198, 198, @"[In t:ImportanceChoicesType Simple Type] [The value ""High""] Specifies high importance."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R199, Expected result:{0}, Actual result:{1}", importanceChoicesTypes[1], items[1].Importance); // If the Importance element is present, // and the Importance element of items[1] equal to the Low, which is the same value of importanceChoicesTypes[1] in request, // then this requirement can be verified. bool isVerifyR199 = items[1].ImportanceSpecified && items[1].Importance == ImportanceChoicesType.Low; Site.CaptureRequirementIfIsTrue( isVerifyR199, 199, @"[In t:ImportanceChoicesType Simple Type] [The value ""Low""] Specifies low importance."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R200, Expected result:{0}, Actual result:{1}", importanceChoicesTypes[2], items[2].Importance); // If the Importance element is present, // and the Importance element of items[2] equal to the Normal, which is the same value of importanceChoicesTypes[2] in request, // then this requirement can be verified. bool isVerifyR200 = items[2].ImportanceSpecified && items[2].Importance == ImportanceChoicesType.Normal; Site.CaptureRequirementIfIsTrue( isVerifyR200, 200, @"[In t:ImportanceChoicesType Simple Type] [The value ""Normal""] Specifies normal importance."); #endregion }