private Sensitivity Convert(SensitivityChoicesType sensitivity) { switch (sensitivity) { case SensitivityChoicesType.Normal: return(Sensitivity.Normal); case SensitivityChoicesType.Personal: return(Sensitivity.Personal); case SensitivityChoicesType.Private: return(Sensitivity.Private); case SensitivityChoicesType.Confidential: return(Sensitivity.CompanyConfidential); default: AppointmentTranslator.Tracer.TraceError((long)this.GetHashCode(), "{0}: Unknown SensitivityChoicesType. Name: {1}, Value: {2}. Acceptable Range {3}-{4}.", new object[] { this, sensitivity, (int)sensitivity, 0, 3 }); throw new InvalidAppointmentException(); } }
public void MSOXWSCORE_S01_TC11_VerifyItemWithSensitivityChoicesTypeEnums() { // Define the count of enumerations int enumCount = 4; SensitivityChoicesType[] sensitivityChoicesTypes = new SensitivityChoicesType[enumCount]; sensitivityChoicesTypes[0] = SensitivityChoicesType.Confidential; sensitivityChoicesTypes[1] = SensitivityChoicesType.Normal; sensitivityChoicesTypes[2] = SensitivityChoicesType.Personal; sensitivityChoicesTypes[3] = SensitivityChoicesType.Private; // Define an item array to store the items got from GetItem operation response. // Each item should contain a SensitivityChoicesType value as its element's value ItemType[] items = new ItemType[enumCount]; for (int i = 0; i < enumCount; i++) { SensitivityChoicesType sensitivityChoicesType = sensitivityChoicesTypes[i]; #region Step 1: Create the item. ItemType[] createdItems = new ItemType[] { new ItemType() }; createdItems[0].Subject = Common.GenerateResourceName( this.Site, TestSuiteHelper.SubjectForCreateItem); createdItems[0].Sensitivity = sensitivityChoicesType; createdItems[0].SensitivitySpecified = 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. // Call the GetItem operation. 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_R1650, Expected result:{0}, Actual result:{1}", sensitivityChoicesTypes[0], items[0].Sensitivity); // If the Sensitivity element is present, // and the Sensitivity element of items[0] equal to the Confidential, which is the same value of sensitivityChoicesTypes[0] in request, // then this requirement can be verified. bool isVerifyR1650 = items[0].SensitivitySpecified && items[0].Sensitivity == SensitivityChoicesType.Confidential; // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1650 Site.CaptureRequirementIfIsTrue( isVerifyR1650, 1650, @"[In t:ItemType Complex Type] The value ""Confidential"" of ""Sensitivity"" specifies the item as confidential."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1651, Expected result:{0}, Actual result:{1}", sensitivityChoicesTypes[1], items[1].Sensitivity); // If the Sensitivity element is present, // and the Sensitivity element of items[1] equal to the Normal, which is the same value of sensitivityChoicesTypes[1] in request, // then this requirement can be verified. bool isVerifyR1651 = items[1].SensitivitySpecified && items[1].Sensitivity == SensitivityChoicesType.Normal; // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1651 Site.CaptureRequirementIfIsTrue( isVerifyR1651, 1651, @"[In t:ItemType Complex Type] The value ""Normal"" of ""Sensitivity"" specifies the item as normal."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1652, Expected result:{0}, Actual result:{1}", sensitivityChoicesTypes[2], items[2].Sensitivity); // If the Sensitivity element is present, // and the Sensitivity element of items[2] equal to the Personal, which is the same value of sensitivityChoicesTypes[2] in request, // then this requirement can be verified. bool isVerifyR1652 = items[2].SensitivitySpecified && items[2].Sensitivity == SensitivityChoicesType.Personal; // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1652 Site.CaptureRequirementIfIsTrue( isVerifyR1652, 1652, @"[In t:ItemType Complex Type] The value ""Personal"" of ""Sensitivity"" specifies the item as personal."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1653, Expected result:{0}, Actual result:{1}", sensitivityChoicesTypes[3], items[3].Sensitivity); // If the Sensitivity element is present, // and the Sensitivity element of items[3] equal to the Private, which is the same value of sensitivityChoicesTypes[3] in request, // then this requirement can be verified. bool isVerifyR1653 = items[3].SensitivitySpecified && items[3].Sensitivity == SensitivityChoicesType.Private; // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1653 Site.CaptureRequirementIfIsTrue( isVerifyR1653, 1653, @"[In t:ItemType Complex Type] The value ""Private"" of ""Sensitivity"" specifies the item as private."); #endregion }