Ejemplo n.º 1
0
        public void MSOXWSCORE_S02_TC07_CreateContactItemFailed()
        {
            #region Step 1: Create the contact item with invalid item class.
            ContactItemType[] createdItems = new ContactItemType[]
            {
                new ContactItemType()
                {
                    Subject = Common.GenerateResourceName(
                        this.Site,
                        TestSuiteHelper.SubjectForCreateItem),

                    // Set an invalid ItemClass to contact item.
                    ItemClass = TestSuiteHelper.InvalidItemClass
                }
            };

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

            #endregion

            // Get ResponseCode from CreateItem operation response.
            ResponseCodeType responseCode = createItemResponse.ResponseMessages.Items[0].ResponseCode;

            // Verify MS-OXWSCDATA_R619.
            this.VerifyErrorObjectTypeChanged(responseCode);
        }
Ejemplo n.º 2
0
        public void MSOXWSCORE_S02_TC08_VerifyExtendPropertyType()
        {
            ContactItemType item = new ContactItemType();

            this.TestSteps_VerifyDistinguishedPropertySetIdConflictsWithPropertySetId(DistinguishedFolderIdNameType.contacts, item);

            this.TestSteps_VerifyDistinguishedPropertySetIdConflictsWithPropertyTag(DistinguishedFolderIdNameType.contacts, item);

            this.TestSteps_VerifyDistinguishedPropertySetIdWithPropertyTypeOrPropertyName(DistinguishedFolderIdNameType.contacts, item);

            this.TestSteps_VerifyPropertySetIdConflictsWithDistinguishedPropertySetId(DistinguishedFolderIdNameType.contacts, item);

            this.TestSteps_VerifyPropertySetIdConflictsWithPropertyTag(DistinguishedFolderIdNameType.contacts, item);

            this.TestSteps_VerifyPropertySetIdWithPropertyTypeOrPropertyName(DistinguishedFolderIdNameType.contacts, item);

            this.TestSteps_VerifyPropertyTagRepresentation(DistinguishedFolderIdNameType.contacts, item);

            this.TestSteps_VerifyPropertyTagConflictsWithDistinguishedPropertySetId(DistinguishedFolderIdNameType.contacts, item);

            this.TestSteps_VerifyPropertyTagConflictsWithPropertySetId(DistinguishedFolderIdNameType.contacts, item);

            this.TestSteps_VerifyPropertyTagConflictsWithPropertyName(DistinguishedFolderIdNameType.contacts, item);

            this.TestSteps_VerifyPropertyTagConflictsWithPropertyId(DistinguishedFolderIdNameType.contacts, item);

            this.TestSteps_VerifyPropertyNameWithDistinguishedPropertySetIdOrPropertySetId(DistinguishedFolderIdNameType.contacts, item);

            this.TestSteps_VerifyPropertyIdWithDistinguishedPropertySetIdOrPropertySetId(DistinguishedFolderIdNameType.contacts, item);
        }
Ejemplo n.º 3
0
        public void MSOXWSCORE_S02_TC05_MarkAllContactItemsAsReadSuccessfully()
        {
            Site.Assume.IsTrue(Common.IsRequirementEnabled(1290, this.Site), "Exchange 2007 and Exchange 2010 do not support the MarkAllItemsAsRead operation.");

            ContactItemType[] items = new ContactItemType[] { new ContactItemType(), new ContactItemType() };
            this.TestSteps_VerifyMarkAllItemsAsRead <ContactItemType>(items);
        }
        private void SyncPhysicalAddresses(ContactItemType remoteItem, Contact localItem)
        {
            localItem.DeleteProperties(new PropertyDefinition[]
            {
                ContactSchema.WorkAddressCity,
                ContactSchema.WorkAddressCountry,
                ContactSchema.WorkAddressPostalCode,
                ContactSchema.WorkAddressState,
                ContactSchema.WorkAddressStreet,
                ContactSchema.HomeCity,
                ContactSchema.HomeCountry,
                ContactSchema.HomePostalCode,
                ContactSchema.HomeState,
                ContactSchema.HomeStreet,
                ContactSchema.OtherCity,
                ContactSchema.OtherCountry,
                ContactSchema.OtherPostalCode,
                ContactSchema.OtherState,
                ContactSchema.OtherStreet
            });
            if (remoteItem.PhysicalAddresses != null)
            {
                foreach (PhysicalAddressDictionaryEntryType physicalAddressDictionaryEntryType in remoteItem.PhysicalAddresses)
                {
                    switch (physicalAddressDictionaryEntryType.Key)
                    {
                    case PhysicalAddressKeyType.Home:
                        localItem.SetOrDeleteProperty(ContactSchema.HomeCity, physicalAddressDictionaryEntryType.City);
                        localItem.SetOrDeleteProperty(ContactSchema.HomeCountry, physicalAddressDictionaryEntryType.CountryOrRegion);
                        localItem.SetOrDeleteProperty(ContactSchema.HomePostalCode, physicalAddressDictionaryEntryType.PostalCode);
                        localItem.SetOrDeleteProperty(ContactSchema.HomeState, physicalAddressDictionaryEntryType.State);
                        localItem.SetOrDeleteProperty(ContactSchema.HomeStreet, physicalAddressDictionaryEntryType.Street);
                        break;

                    case PhysicalAddressKeyType.Business:
                        localItem.SetOrDeleteProperty(ContactSchema.WorkAddressCity, physicalAddressDictionaryEntryType.City);
                        localItem.SetOrDeleteProperty(ContactSchema.WorkAddressCountry, physicalAddressDictionaryEntryType.CountryOrRegion);
                        localItem.SetOrDeleteProperty(ContactSchema.WorkAddressPostalCode, physicalAddressDictionaryEntryType.PostalCode);
                        localItem.SetOrDeleteProperty(ContactSchema.WorkAddressState, physicalAddressDictionaryEntryType.State);
                        localItem.SetOrDeleteProperty(ContactSchema.WorkAddressStreet, physicalAddressDictionaryEntryType.Street);
                        break;

                    case PhysicalAddressKeyType.Other:
                        localItem.SetOrDeleteProperty(ContactSchema.OtherCity, physicalAddressDictionaryEntryType.City);
                        localItem.SetOrDeleteProperty(ContactSchema.OtherCountry, physicalAddressDictionaryEntryType.CountryOrRegion);
                        localItem.SetOrDeleteProperty(ContactSchema.OtherPostalCode, physicalAddressDictionaryEntryType.PostalCode);
                        localItem.SetOrDeleteProperty(ContactSchema.OtherState, physicalAddressDictionaryEntryType.State);
                        localItem.SetOrDeleteProperty(ContactSchema.OtherStreet, physicalAddressDictionaryEntryType.Street);
                        break;
                    }
                }
            }
            if (remoteItem.PostalAddressIndexSpecified)
            {
                localItem[ContactSchema.PostalAddressId] = this.Convert(remoteItem.PostalAddressIndex);
                return;
            }
            localItem.Delete(ContactSchema.PostalAddressId);
        }
Ejemplo n.º 5
0
        public void MSOXWSCORE_S02_TC12_GetContactItemWithAddBlankTargetToLinks()
        {
            Site.Assume.IsTrue(Common.IsRequirementEnabled(2149908, this.Site), "Exchange 2007 and Exchange 2010 do not use the AddBlankTargetToLinks element.");

            ContactItemType item = new ContactItemType();

            this.TestSteps_VerifyGetItemWithItemResponseShapeType_AddBlankTargetToLinksBoolean(item);
        }
Ejemplo n.º 6
0
        public void MSOXWSCORE_S02_TC11_GetContactItemWithConvertHtmlCodePageToUTF8()
        {
            Site.Assume.IsTrue(Common.IsRequirementEnabled(21498, this.Site), "Exchange 2007 and Exchange 2010 do not include the ConvertHtmlCodePageToUTF8 element.");

            ContactItemType item = new ContactItemType();

            this.TestSteps_VerifyGetItemWithItemResponseShapeType_ConvertHtmlCodePageToUTF8Boolean(item);
        }
Ejemplo n.º 7
0
        public void MSOXWSCORE_S02_TC17_VerifyGetItemWithItemResponseShapeType_IncludeMimeContentBoolean()
        {
            Site.Assume.IsTrue(Common.IsRequirementEnabled(23091, this.Site), "E2010SP3 version below do not support the MimeContent element for ContactType, TaskType and DistributionListType item when retrieving MIME content.");

            ContactItemType item = new ContactItemType();

            this.TestSteps_VerifyGetItemWithItemResponseShapeType_IncludeMimeContentBoolean(item);
        }
Ejemplo n.º 8
0
        public void MSOXWSCORE_S02_TC13_GetContactItemWithBlockExternalImages()
        {
            Site.Assume.IsTrue(Common.IsRequirementEnabled(2149905, this.Site), "Exchange 2007 and Exchange 2010 do not use the BlockExternalImages element.");

            ContactItemType item = new ContactItemType();

            this.TestSteps_VerifyGetItemWithItemResponseShapeType_BlockExternalImagesBoolean(item);
        }
        private void SyncNotes(ContactItemType remoteItem, Contact localItem)
        {
            string     text       = string.Empty;
            BodyFormat bodyFormat = BodyFormat.TextPlain;

            if (remoteItem.Body != null)
            {
                text       = remoteItem.Body.Value;
                bodyFormat = this.Convert(remoteItem.Body.BodyType1);
                ItemSynchronizer.Tracer.TraceDebug <ContactItemSynchronizer, string>((long)this.GetHashCode(), "{0}: Copying body: {1}", this, text);
            }
            using (TextWriter textWriter = localItem.Body.OpenTextWriter(bodyFormat))
            {
                textWriter.Write(text);
            }
        }
        public void MSOXWSCONT_S03_TC01_CopyContactItem()
        {
            #region Step 1:Create the contact item.
            // Create a contact item.
            ContactItemType        item = this.BuildContactItemWithRequiredProperties();
            CreateItemResponseType createItemResponse = this.CallCreateItemOperation(item);

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

            #region Step 2:Copy the contact item.
            CopyItemType         copyItemRequest  = new CopyItemType();
            CopyItemResponseType copyItemResponse = new CopyItemResponseType();

            // Configure ItemIds.
            copyItemRequest.ItemIds    = new BaseItemIdType[1];
            copyItemRequest.ItemIds[0] = this.ExistContactItems[0];

            // Configure the copy Distinguished Folder.
            DistinguishedFolderIdType distinguishedFolderIdForCopyItem = new DistinguishedFolderIdType();
            distinguishedFolderIdForCopyItem.Id = DistinguishedFolderIdNameType.drafts;
            copyItemRequest.ToFolderId          = new TargetFolderIdType();
            copyItemRequest.ToFolderId.Item     = distinguishedFolderIdForCopyItem;

            copyItemResponse = this.CONTAdapter.CopyItem(copyItemRequest);

            // Check the response.
            Common.CheckOperationSuccess(copyItemResponse, 1, this.Site);
            #endregion

            #region Step 3:Get the contact item.
            // The contact item to get.
            ItemIdType[] itemArray = new ItemIdType[this.ExistContactItems.Count];
            this.ExistContactItems.CopyTo(itemArray, 0);

            GetItemResponseType getItemResponse = this.CallGetItemOperation(itemArray);

            // Check the response.
            Common.CheckOperationSuccess(getItemResponse, 2, this.Site);
            #endregion
        }
Ejemplo n.º 11
0
        ImageSource GetContactItemTypeImage()
        {
            var defaultImage = SharedUtils.Instance.ConvertBitmapToImageSource(Properties.Resources.ResourceManager.GetObject("OtherContacts") as Bitmap);

            if (ContactItemType == null)
            {
                return(null);
            }

            var image = Properties.Resources.ResourceManager.GetObject(ContactItemType.Replace(" ", ""));

            if (image != null)
            {
                return(SharedUtils.Instance.ConvertBitmapToImageSource(image as Bitmap));
            }
            else
            {
                return(defaultImage);
            }
        }
Ejemplo n.º 12
0
        public void MSOXWSCORE_S02_TC04_UpdateContactItemSuccessfully()
        {
            ContactItemType item = new ContactItemType();

            this.TestSteps_VerifyUpdateItemSuccessfulResponse(item);
        }
Ejemplo n.º 13
0
        public void MSOXWSCORE_S02_TC15_GetContactItemWithBodyTypeResponseTypeEnum()
        {
            ContactItemType item = new ContactItemType();

            this.TestSteps_VerifyGetItemWithItemResponseShapeType_BodyTypeResponseTypeEnum(item);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Create an item in the specified folder.
        /// </summary>
        /// <param name="parentFolderType">Type of the parent folder.</param>
        /// <param name="parentFolderId">ID of the parent folder.</param>
        /// <param name="itemSubject">Subject of the item which should be created.</param>
        /// <returns>ID of the created item.</returns>
        protected ItemIdType CreateItem(DistinguishedFolderIdNameType parentFolderType, string parentFolderId, string itemSubject)
        {
            // Create a request for the CreateItem operation and initialize the ItemType instance.
            CreateItemType createItemRequest = new CreateItemType();
            ItemType       item = null;

            // Get different values for item based on different parent folder type.
            switch (parentFolderType)
            {
            case DistinguishedFolderIdNameType.contacts:
                ContactItemType contact = new ContactItemType();
                contact.Subject = itemSubject;
                contact.FileAs  = itemSubject;
                item            = contact;
                break;

            case DistinguishedFolderIdNameType.calendar:
                // Set the sendMeetingInvitations property.
                CalendarItemCreateOrDeleteOperationType sendMeetingInvitations = CalendarItemCreateOrDeleteOperationType.SendToNone;
                createItemRequest.SendMeetingInvitations          = (CalendarItemCreateOrDeleteOperationType)sendMeetingInvitations;
                createItemRequest.SendMeetingInvitationsSpecified = true;
                CalendarItemType calendar = new CalendarItemType();
                calendar.Subject = itemSubject;
                item             = calendar;
                break;

            case DistinguishedFolderIdNameType.inbox:
                MessageType message = new MessageType();
                message.Subject = itemSubject;
                item            = message;
                break;

            case DistinguishedFolderIdNameType.tasks:
                TaskType taskItem = new TaskType();
                taskItem.Subject = itemSubject;
                item             = taskItem;
                break;

            default:
                Site.Assert.Fail("The parent folder type '{0}' is invalid and the valid folder types are: contacts, calendar, inbox and tasks.", parentFolderType.ToString());
                break;
            }

            // Set the MessageDisposition property.
            MessageDispositionType messageDisposition = MessageDispositionType.SaveOnly;

            createItemRequest.MessageDisposition          = (MessageDispositionType)messageDisposition;
            createItemRequest.MessageDispositionSpecified = true;

            // Specify the folder in which new items are saved.
            createItemRequest.SavedItemFolderId = new TargetFolderIdType();
            FolderIdType folderId = new FolderIdType();

            folderId.Id = parentFolderId;
            createItemRequest.SavedItemFolderId.Item = folderId;

            // Specify the collection of items to be created.
            createItemRequest.Items       = new NonEmptyArrayOfAllItemsType();
            createItemRequest.Items.Items = new ItemType[] { item };

            // Initialize the ID of the created item.
            ItemIdType createdItemId = null;

            // Invoke the create item operation and get the response.
            CreateItemResponseType createItemResponse = this.COREAdapter.CreateItem(createItemRequest);

            if (createItemResponse != null && createItemResponse.ResponseMessages.Items[0].ResponseClass == ResponseClassType.Success)
            {
                ItemInfoResponseMessageType info = createItemResponse.ResponseMessages.Items[0] as ItemInfoResponseMessageType;
                Site.Assert.IsNotNull(info, "The items in CreateItem response should not be null.");

                // Get the ID of the created item.
                createdItemId = info.Items.Items[0].ItemId;
            }

            return(createdItemId);
        }
        public override void Sync(ItemType item, MailboxSession mailboxSession, ExchangeService exchangeService)
        {
            ContactItemType contactItemType = item as ContactItemType;

            if (contactItemType == null)
            {
                ItemSynchronizer.Tracer.TraceDebug <ContactItemSynchronizer, string>((long)this.GetHashCode(), "{0}: Found non-Contact item in a Contact folder: {1}. Skipping.", this, item.ItemId.Id);
                return;
            }
            string  id      = contactItemType.ItemId.Id;
            Contact contact = base.FindLocalCopy(id, mailboxSession) as Contact;
            bool    flag    = false;

            try
            {
                if (contactItemType.Sensitivity != SensitivityChoicesType.Normal)
                {
                    ItemSynchronizer.Tracer.TraceDebug <ContactItemSynchronizer, string>((long)this.GetHashCode(), "{0}: Remote item {1} is private and will not be synced.", this, id);
                    return;
                }
                if (contact == null)
                {
                    ItemSynchronizer.Tracer.TraceDebug <ContactItemSynchronizer, string>((long)this.GetHashCode(), "{0}: Creating a local copy of Contact item: {1}", this, id);
                    contact = Contact.Create(mailboxSession, this.localFolder.Id);
                }
                ItemSynchronizer.Tracer.TraceDebug <ContactItemSynchronizer, string>((long)this.GetHashCode(), "{0}: Updating properties for Contact item: {1}", this, id);
                contact.SetOrDeleteProperty(ContactSchema.AssistantName, contactItemType.AssistantName);
                contact.SetOrDeleteProperty(ContactSchema.BusinessHomePage, contactItemType.BusinessHomePage);
                contact.SetOrDeleteProperty(ContactSchema.CompanyName, contactItemType.CompanyName);
                contact.SetOrDeleteProperty(ContactSchema.Department, contactItemType.Department);
                contact.SetOrDeleteProperty(StoreObjectSchema.DisplayName, contactItemType.DisplayName);
                contact.SetOrDeleteProperty(ContactSchema.Manager, contactItemType.Manager);
                contact.SetOrDeleteProperty(ContactSchema.Mileage, contactItemType.Mileage);
                contact.SetOrDeleteProperty(ContactSchema.OfficeLocation, contactItemType.OfficeLocation);
                contact.SetOrDeleteProperty(ContactSchema.Profession, contactItemType.Profession);
                contact.SetOrDeleteProperty(ContactSchema.SpouseName, contactItemType.SpouseName);
                contact.SetOrDeleteProperty(ContactSchema.Title, contactItemType.JobTitle);
                if (contactItemType.CompleteName != null)
                {
                    contact.SetOrDeleteProperty(ContactSchema.DisplayNamePrefix, contactItemType.CompleteName.Title);
                    contact.SetOrDeleteProperty(ContactSchema.FullName, contactItemType.CompleteName.FullName);
                    contact.SetOrDeleteProperty(ContactSchema.Generation, contactItemType.CompleteName.Suffix);
                    contact.SetOrDeleteProperty(ContactSchema.GivenName, contactItemType.CompleteName.FirstName);
                    contact.SetOrDeleteProperty(ContactSchema.Initials, contactItemType.CompleteName.Initials);
                    contact.SetOrDeleteProperty(ContactSchema.MiddleName, contactItemType.CompleteName.MiddleName);
                    contact.SetOrDeleteProperty(ContactSchema.Nickname, contactItemType.CompleteName.Nickname);
                    contact.SetOrDeleteProperty(ContactSchema.Surname, contactItemType.CompleteName.LastName);
                }
                else
                {
                    contact.DeleteProperties(new PropertyDefinition[]
                    {
                        ContactSchema.DisplayNamePrefix,
                        ContactSchema.FullName,
                        ContactSchema.Generation,
                        ContactSchema.GivenName,
                        ContactSchema.Initials,
                        ContactSchema.MiddleName,
                        ContactSchema.Nickname,
                        ContactSchema.Surname
                    });
                }
                contact.FileAs = this.Convert(contactItemType.FileAsMapping);
                if (contactItemType.Children != null && contactItemType.Children.Length > 0)
                {
                    contact[ContactSchema.Children] = contactItemType.Children;
                }
                else
                {
                    contact.Delete(ContactSchema.Children);
                }
                contact.Categories.Clear();
                if (contactItemType.Categories != null)
                {
                    contact.Categories.AddRange(contactItemType.Categories);
                }
                if (contactItemType.BirthdaySpecified)
                {
                    contact[ContactSchema.Birthday] = contactItemType.Birthday;
                }
                else
                {
                    contact.Delete(ContactSchema.Birthday);
                }
                if (contactItemType.WeddingAnniversarySpecified)
                {
                    contact[ContactSchema.WeddingAnniversary] = contactItemType.WeddingAnniversary;
                }
                else
                {
                    contact.Delete(ContactSchema.WeddingAnniversary);
                }
                if (contactItemType.PhoneNumbers != null)
                {
                    foreach (PhoneNumberDictionaryEntryType phoneNumberDictionaryEntryType in contactItemType.PhoneNumbers)
                    {
                        contact.SetOrDeleteProperty(this.Convert(phoneNumberDictionaryEntryType.Key), phoneNumberDictionaryEntryType.Value);
                    }
                }
                contact.EmailAddresses.Clear();
                if (contactItemType.EmailAddresses != null)
                {
                    foreach (EmailAddressDictionaryEntryType emailAddressDictionaryEntryType in contactItemType.EmailAddresses)
                    {
                        contact.EmailAddresses.Add(this.Convert(emailAddressDictionaryEntryType.Key), new Participant(null, emailAddressDictionaryEntryType.Value, null));
                    }
                }
                if (contactItemType.ImAddresses != null && contactItemType.ImAddresses.Length > 0 && contactItemType.ImAddresses[0].Value != null)
                {
                    contact.ImAddress = contactItemType.ImAddresses[0].Value;
                }
                else
                {
                    contact.Delete(ContactSchema.IMAddress);
                }
                this.SyncNotes(contactItemType, contact);
                this.SyncPhysicalAddresses(contactItemType, contact);
                ItemSynchronizer.Tracer.TraceDebug <ContactItemSynchronizer, string>((long)this.GetHashCode(), "{0}: Copying Id: {1}", this, id);
                contact[SharingSchema.ExternalSharingMasterId] = contactItemType.ItemId.Id;
                ItemSynchronizer.Tracer.TraceDebug <ContactItemSynchronizer, string>((long)this.GetHashCode(), "{0}: Saving local item {1}", this, id);
                contact.Save(SaveMode.NoConflictResolution);
                flag = true;
            }
            finally
            {
                if (!flag && contact != null && contact.Id != null)
                {
                    this.localFolder.SelectItemToDelete(contact.Id.ObjectId);
                }
                if (contact != null)
                {
                    contact.Dispose();
                }
            }
            PerformanceCounters.ContactItemsSynced.Increment();
        }
        public void MSOXWSCONT_S04_TC01_MoveContactItem()
        {
            #region Step 1:Create the contact item.
            // Create a contact item.
            ContactItemType        item = this.BuildContactItemWithRequiredProperties();
            CreateItemResponseType createItemResponse = this.CallCreateItemOperation(item);

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

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

            #region Step 2:Move the contact item.
            MoveItemType         moveItemRequest  = new MoveItemType();
            MoveItemResponseType moveItemResponse = new MoveItemResponseType();

            // Configure ItemIds.
            moveItemRequest.ItemIds    = new BaseItemIdType[1];
            moveItemRequest.ItemIds[0] = this.ExistContactItems[0];

            // Clear existContactItems for MoveItem.
            this.InitializeCollection();

            // Configure move Distinguished Folder.
            DistinguishedFolderIdType distinguishedFolderId = new DistinguishedFolderIdType();
            distinguishedFolderId.Id        = DistinguishedFolderIdNameType.drafts;
            moveItemRequest.ToFolderId      = new TargetFolderIdType();
            moveItemRequest.ToFolderId.Item = distinguishedFolderId;

            moveItemResponse = this.CONTAdapter.MoveItem(moveItemRequest);

            // Check the response.
            Common.CheckOperationSuccess(moveItemResponse, 1, this.Site);
            #endregion

            #region Step 3:Get the moved contact item.
            // The contact item to get.
            ItemIdType[] itemArray = new ItemIdType[this.ExistContactItems.Count];
            this.ExistContactItems.CopyTo(itemArray, 0);

            GetItemResponseType getItemResponse = this.CallGetItemOperation(itemArray);

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

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

            Site.Assert.AreEqual <int>(
                1,
                getItemResponse.ResponseMessages.Items.GetLength(0),
                "Expected Item Count: {0}, Actual Item Count: {1}",
                1,
                getItemResponse.ResponseMessages.Items.GetLength(0));

            Site.Assert.AreEqual <ResponseCodeType>(
                ResponseCodeType.ErrorItemNotFound,
                getItemResponse.ResponseMessages.Items[0].ResponseCode,
                string.Format(
                    "Get contact item with original item Id should fail! Expected response code: {0}, actual response code: {1}",
                    ResponseCodeType.ErrorItemNotFound,
                    getItemResponse.ResponseMessages.Items[0].ResponseCode));
            #endregion
        }
        public void MSOXWSCONT_S02_TC01_UpdateContactItem()
        {
            #region Step 1:Create the contact item.
            // Create a contact item.
            ContactItemType        item = this.BuildContactItemWithRequiredProperties();
            CreateItemResponseType createItemResponse = this.CallCreateItemOperation(item);

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

            #region Step 2:Update the contact item.
            UpdateItemType updateItemRequest = new UpdateItemType()
            {
                // Configure ItemIds.
                ItemChanges = new ItemChangeType[]
                {
                    new ItemChangeType()
                    {
                        Item = this.ExistContactItems[0],

                        Updates = new ItemChangeDescriptionType[]
                        {
                            new SetItemFieldType()
                            {
                                Item = new PathToUnindexedFieldType()
                                {
                                    FieldURI = UnindexedFieldURIType.contactsFileAs
                                },

                                Item1 = new ContactItemType()
                                {
                                    FileAs = FileAsMappingType.LastFirstCompany.ToString()
                                }
                            }
                        }
                    }
                },

                ConflictResolution = ConflictResolutionType.AlwaysOverwrite
            };

            UpdateItemResponseType updateItemResponse = new UpdateItemResponseType();

            // Invoke UpdateItem operation.
            updateItemResponse = this.CONTAdapter.UpdateItem(updateItemRequest);

            // Check the response.
            Common.CheckOperationSuccess(updateItemResponse, 1, this.Site);
            #endregion

            #region Step 3:Get the contact item.
            // The contact item to get.
            ItemIdType[] itemArray = new ItemIdType[this.ExistContactItems.Count];
            this.ExistContactItems.CopyTo(itemArray, 0);

            GetItemResponseType getItemResponse = this.CallGetItemOperation(itemArray);

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

            ContactItemType[] contacts = Common.GetItemsFromInfoResponse <ContactItemType>(getItemResponse);

            Site.Assert.AreEqual <int>(
                1,
                contacts.Length,
                string.Format(
                    "The count of items from response should be 1, actual: '{0}'.", contacts.Length));

            Site.Assert.AreEqual <string>(
                FileAsMappingType.LastFirstCompany.ToString(),
                contacts[0].FileAs,
                string.Format(
                    "The FileAs property should be updated as set. Expected value: {0}, actual value: {1}", FileAsMappingType.LastFirstCompany.ToString(), contacts[0].FileAs));
            #endregion
        }
Ejemplo n.º 18
0
        public void MSOXWSCORE_S02_TC02_CopyContactItemSuccessfully()
        {
            #region Step 1: Create the contact item.
            ContactItemType item           = new ContactItemType();
            ItemIdType[]    createdItemIds = this.CreateItemWithMinimumElements(item);
            #endregion

            #region Step 2:Copy the contact item
            // Call CopyItem operation.
            CopyItemResponseType copyItemResponse = this.CallCopyItemOperation(DistinguishedFolderIdNameType.drafts, createdItemIds);

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

            ItemIdType[] copiedItemIds = Common.GetItemIdsFromInfoResponse(copyItemResponse);

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

            #region Step 3: Get the first created contact item success.
            // Call the GetItem operation.
            GetItemResponseType getItemResponse = this.CallGetItemOperation(createdItemIds);

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

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

            ContactItemType[] getItems = Common.GetItemsFromInfoResponse <ContactItemType>(getItemResponse);

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

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2018
            this.Site.CaptureRequirementIfAreEqual <string>(
                "IPM.Contact",
                ((ItemInfoResponseMessageType)getItemResponse.ResponseMessages.Items[0]).Items.Items[0].ItemClass,
                2018,
                @"[In t:ItemType Complex Type] This value is ""IPM.Contact"" for contact item.");
            #endregion

            #region Step 4: Get the second copied contact item success.
            // Call the GetItem operation.
            getItemResponse = this.CallGetItemOperation(copiedItemIds);

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

            getItemIds = Common.GetItemIdsFromInfoResponse(getItemResponse);

            // One contact item should be returned.
            Site.Assert.AreEqual <int>(
                1,
                getItemIds.GetLength(0),
                "One contact item should be returned! Expected Item Count: {0}, Actual Item Count: {1}",
                1,
                getItemIds.GetLength(0));
            #endregion
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Capture ContactItemType Complex Type related requirements.
        /// </summary>
        /// <param name="contactItemType">A contact item from the response package of GetItem operation.</param>
        /// <param name="isSchemaValidated">A boolean value indicates the schema validation result. True means the response conforms with the schema, false means not.</param>
        private void VerifyContactItemTypeComplexType(ContactItemType contactItemType, bool isSchemaValidated)
        {
            Site.Assert.IsTrue(isSchemaValidated, "The schema validation result should be true!");

            if (contactItemType != null)
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCONT_R19");

                // Verify MS-OXWSCONT requirement: MS-OXWSCONT_R19
                // If the contactItemType element is not null and schema is validated,
                // the requirement can be validated.
                Site.CaptureRequirement(
                    19,
                    @"[In t: ContactItemType Complex Type] The type[ContactItemType] is defined as follow:
  < xs:complexType name = ""ContactItemType"" >
   < xs:complexContent >
     < xs:extension
       base = ""t: ItemType""
     >
       < xs:sequence >
         < xs:element name = ""FileAs""
           type = ""xs: string""
           minOccurs = ""0""
          />
         < xs:element name = ""FileAsMapping""
           type = ""t: FileAsMappingType""
           minOccurs = ""0""
          />
         < xs:element name = ""DisplayName""
           type = ""xs: string""
           minOccurs = ""0""
          />
         < xs:element name = ""GivenName""
           type = ""xs: string""
           minOccurs = ""0""
          />
         < xs:element name = ""Initials""
           type = ""xs: string""
           minOccurs = ""0""
          />
         < xs:element name = ""MiddleName""
           type = ""xs: string""
           minOccurs = ""0""
          />
         < xs:element name = ""Nickname""
           type = ""xs: string""
           minOccurs = ""0""
          />
         < xs:element name = ""CompleteName""
           type = ""t: CompleteNameType""
           minOccurs = ""0""
          />
         < xs:element name = ""CompanyName""
           type = ""xs: string""
           minOccurs = ""0""
          />
         < xs:element name = ""EmailAddresses""
           type = ""t: EmailAddressDictionaryType""
           minOccurs = ""0""
          />
         < xs:element name = ""AbchEmailAddresses""
           type = ""t: AbchEmailAddressDictionaryType""
           minOccurs = ""0""
          />
         < xs:element name = ""PhysicalAddresses""
           type = ""t: PhysicalAddressDictionaryType""
           minOccurs = ""0""
          />
         < xs:element name = ""PhoneNumbers""
           type = ""t: PhoneNumberDictionaryType""
           minOccurs = ""0""
          />
         < xs:element name = ""AssistantName""
           type = ""xs: string""
           minOccurs = ""0""
          />
         < xs:element name = ""Birthday""
           type = ""xs: dateTime""
           minOccurs = ""0""
          />
         < xs:element name = ""BusinessHomePage""
           type = ""xs: anyURI""
           minOccurs = ""0""
          />
         < xs:element name = ""Children""
           type = ""t: ArrayOfStringsType""
           minOccurs = ""0""
          />
         < xs:element name = ""Companies""
           type = ""t: ArrayOfStringsType""
           minOccurs = ""0""
          />
         < xs:element name = ""ContactSource""
           type = ""t: ContactSourceType""
           minOccurs = ""0""
          />
         < xs:element name = ""Department""
           type = ""xs: string""
           minOccurs = ""0""
          />
         < xs:element name = ""Generation""
           type = ""xs: string""
           minOccurs = ""0""
          />
         < xs:element name = ""ImAddresses""
           type = ""t: ImAddressDictionaryType""
           minOccurs = ""0""
          />
         < xs:element name = ""JobTitle""
           type = ""xs: string""
           minOccurs = ""0""
          />
         < xs:element name = ""Manager""
           type = ""xs: string""
           minOccurs = ""0""
          />
         < xs:element name = ""Mileage""
           type = ""xs: string""
           minOccurs = ""0""
          />
         < xs:element name = ""OfficeLocation""
           type = ""xs: string""
           minOccurs = ""0""
          />
         < xs:element name = ""PostalAddressIndex""
           type = ""t: PhysicalAddressIndexType""
           minOccurs = ""0""
          />
         < xs:element name = ""Profession""
           type = ""xs: string""
           minOccurs = ""0""
          />
         < xs:element name = ""SpouseName""
           type = ""xs: string""
           minOccurs = ""0""
          />
         < xs:element name = ""Surname""
           type = ""xs: string""
           minOccurs = ""0""
          />
         < xs:element name = ""WeddingAnniversary""
           type = ""xs: dateTime""
           minOccurs = ""0""
          />
         < xs:element name = ""HasPicture""
           type = ""xs: boolean""
           minOccurs = ""0""
          />
         < xs:element name = ""PhoneticFullName""
           type = ""xs: string""
           minOccurs = ""0""
         />
         < xs:element name = ""PhoneticFirstName""
           type = ""xs: string""
           minOccurs = ""0""
         />
         < xs:element name = ""PhoneticLastName""
           type = ""xs: string""
           minOccurs = ""0""
         />
         < xs:element name = ""Alias""
           type = ""xs: string""
           minOccurs = ""0""
         />
         < xs:element name = ""Notes""
           type = ""xs: string""
           minOccurs = ""0""
         />
         < xs:element name = ""Photo""
           type = ""xs: base64Binary""
           minOccurs = ""0""
        />
        < xs:element name = ""UserSMIMECertificate""
          type = ""t: ArrayOfBinaryType""
          minOccurs = ""0""
        />
        < xs:element name = ""MSExchangeCertificate""
          type = ""t: ArrayOfBinaryType""
          minOccurs = ""0""
        />
        < xs:element name = ""DirectoryId""
          type = ""xs: string""
          minOccurs = ""0""
        />
        < xs:element name = ""ManagerMailbox""
          type = ""t: SingleRecipientType""
          minOccurs = ""0""
        />
        < xs:element name = ""DirectReports""
          type = ""t: ArrayOfRecipientsType""
          minOccurs = ""0""
        />
        < xs:element name = ""AccountName""
          type = ""xs: string""
          minOccurs = ""0""
        />
        < xs:element name = ""IsAutoUpdateDisabled""
          type = ""xs: boolean""
          minOccurs = ""0""
        />
        < xs:element name = ""IsMessengerEnabled""
          type = ""xs: boolean""
          minOccurs = ""0""
        />
        < xs:element name = ""Comment""
          type = ""xs: string""
          minOccurs = ""0""
        />
        < xs:element name = ""ContactShortId""
          type = ""xs: int""
          minOccurs = ""0""
        />
        < xs:element name = ""ContactType""
          type = ""xs: string""
          minOccurs = ""0""
        />
        < xs:element name = ""Gender""
          type = ""xs: string""
          minOccurs = ""0""
        />
        < xs:element name = ""IsHidden""
          type = ""xs: boolean""
          minOccurs = ""0""
        />
        < xs:element name = ""ObjectId""
          type = ""xs: string""
          minOccurs = ""0""
        />
        < xs:element name = ""PassportId""
          type = ""xs: long""
          minOccurs = ""0""
        />
        < xs:element name = ""PersonId""
          type = ""xs: int""
          minOccurs = ""0""
        />
        < xs:element name = ""IsPrivate""
          type = ""xs: boolean""
          minOccurs = ""0""
        />
        < xs:element name = ""SourceId""
          type = ""xs: string""
          minOccurs = ""0""
        />
");
            }

            if (contactItemType.FileAsMappingSpecified)
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCONT_R128");

                // Verify MS-OXWSCONT requirement: MS-OXWSCONT_R128
                // If the FileAsMapping element is specified and schema is validated,
                // the requirement can be validated.
                Site.CaptureRequirement(
                    128,
                    @"[In t:FileAsMappingType Simple Type] The type [FileAsMappingType] is defined as follow:
                        <xs:simpleType name=""FileAsMappingType"">
                         <xs:restriction
                          base=""xs:string""
                         >
                          <xs:enumeration
                           value=""None""
                           />
                          <xs:enumeration
                           value=""LastCommaFirst""
                           />
                          <xs:enumeration
                           value=""FirstSpaceLast""
                           />
                          <xs:enumeration
                           value=""Company""
                           />
                          <xs:enumeration
                           value=""LastCommaFirstCompany""
                           />
                          <xs:enumeration
                           value=""CompanyLastFirst""
                           />
                          <xs:enumeration
                           value=""LastFirst""
                           />
                          <xs:enumeration
                           value=""LastFirstCompany""
                           />
                          <xs:enumeration
                           value=""CompanyLastCommaFirst""
                           />
                          <xs:enumeration
                           value=""LastFirstSuffix""
                           />
                          <xs:enumeration
                           value=""LastSpaceFirstCompany""
                           />
                          <xs:enumeration
                           value=""CompanyLastSpaceFirst""
                           />
                          <xs:enumeration
                           value=""LastSpaceFirst""
                           />
                          <xs:enumeration
                           value=""DisplayName""
                           />
                          <xs:enumeration
                           value=""FirstName""
                           />
                          <xs:enumeration
                           value=""LastFirstMiddleSuffix""
                           />
                          <xs:enumeration
                           value=""LastName""
                           />
                          <xs:enumeration
                           value=""Empty""
                           />
                         </xs:restriction>
                        </xs:simpleType>");
            }

            if (contactItemType.Companies != null)
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1081");

                // Verify MS-OXWSCDATA requirement: MS-OXWSCDATA_R1081
                // If the Companies element is not null and schema is validated,
                // the requirement can be validated.
                Site.CaptureRequirement(
                    "MS-OXWSCDATA",
                    1081,
                    @"[In t:ArrayOfStringsType Complex Type] The type [ArrayOfStringsType] is defined as follow:
                        <xs:complexType name=""ArrayOfStringsType"">
                          <xs:sequence>
                            <xs:element name=""String"" type=""xs:string"" minOccurs=""0"" maxOccurs=""unbounded""/>
                          </xs:sequence>
                        </xs:complexType>");
            }

            if (contactItemType.PostalAddressIndexSpecified)
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCONT_R178");

                // Verify MS-OXWSCONT requirement: MS-OXWSCONT_R178
                // If the PostalAddressIndex element is specified and schema is validated,
                // the requirement can be validated.
                Site.CaptureRequirement(
                    178,
                    @"[t:PhysicalAddressIndexType Simple Type] The type [PhysicalAddressIndexType] is defined as follow:<xs:simpleType name=""PhysicalAddressIndexType"">
                         <xs:restriction
                          base=""xs:string""
                         >
                          <xs:enumeration
                           value=""None""
                           />
                          <xs:enumeration
                           value=""Business""
                           />
                          <xs:enumeration
                           value=""Home""
                           />
                          <xs:enumeration
                           value=""Other""
                           />
                         </xs:restriction>
                        </xs:simpleType>");
            }

            if (contactItemType.CompleteName != null)
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCONT_R192");

                // Verify MS-OXWSCONT requirement: MS-OXWSCONT_R192
                // If the CompleteName element is not null and schema is validated,
                // the requirement can be validated.
                Site.CaptureRequirement(
                    192,
                    @"[In t:CompleteNameType Complex Type] The type [CompleteNameType] is defined as follow:<xs:complexType name=""CompleteNameType"">
                         <xs:sequence>
                          <xs:element name=""Title""
                           type=""xs:string""
                           minOccurs=""0""
                           />
                          <xs:element name=""FirstName""
                           type=""xs:string""
                           minOccurs=""0""
                           />
                          <xs:element name=""MiddleName""
                           type=""xs:string""
                           minOccurs=""0""
                           />
                          <xs:element name=""LastName""
                           type=""xs:string""
                           minOccurs=""0""
                           />
                          <xs:element name=""Suffix""
                           type=""xs:string""
                           minOccurs=""0""
                           />
                          <xs:element name=""Initials""
                           type=""xs:string""
                           minOccurs=""0""
                           />
                          <xs:element name=""FullName""
                           type=""xs:string""
                           minOccurs=""0""
                           />
                          <xs:element name=""Nickname""
                           type=""xs:string""
                           minOccurs=""0""
                           />
                          <xs:element name=""YomiFirstName""
                           type=""xs:string""
                           minOccurs=""0""
                           />
                          <xs:element name=""YomiLastName""
                           type=""xs:string""
                           minOccurs=""0""
                           />
                         </xs:sequence>
                        </xs:complexType>");
            }

            if (contactItemType.EmailAddresses != null)
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCONT_R236");

                // Verify MS-OXWSCONT requirement: MS-OXWSCONT_R236
                // If the EmailAddresses is not null and schema is validated,
                // the requirement can be validated.
                Site.CaptureRequirement(
                    236,
                    @"[In t:EmailAddressDictionaryType Complex Type] The type [EmailAddressDictionaryType] is defined as follow:<xs:complexType name=""EmailAddressDictionaryType"">
                         <xs:sequence>
                          <xs:element name=""Entry""
                           type=""t:EmailAddressDictionaryEntryType""
                           maxOccurs=""unbounded""
                           />
                         </xs:sequence>
                        </xs:complexType>");

                for (int i = 0; i < contactItemType.EmailAddresses.Length; i++)
                {
                    if (contactItemType.EmailAddresses[i] != null)
                    {
                        // Add the debug information
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCONT_R226");

                        // Verify MS-OXWSCONT requirement: MS-OXWSCONT_R226
                        // If the entry of EmailAddresses is not null and schema is validated,
                        // the requirement can be validated.
                        Site.CaptureRequirement(
                            226,
                            @"[In t: EmailAddressDictionaryEntryType Complex Type] The type[EmailAddressDictionaryEntryType] is defined as follow:
 < xs:complexType name = ""EmailAddressDictionaryEntryType"" >
 < xs:simpleContent >
  < xs:extension
   base = ""xs: string""
  >
   < xs:attribute name = ""Key""
    type = ""t: EmailAddressKeyType""
    use = ""required""
    />
   < xs:attribute name = ""Name""
    type = ""xs: string""
    use = ""optional""
    />
   < xs:attribute name = ""RoutingType""
    type = ""xs: string""
    use = ""optional""
    />
   < xs:attribute name = ""MailboxType""
    type = ""t: MailboxTypeType""
    use = ""optional""
    />
  </ xs:extension >
 </ xs:simpleContent >
</ xs:complexType > ");

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

                        // Verify MS-OXWSCONT requirement: MS-OXWSCONT_R122
                        // The Key element is a required element of EmailAddressDictionaryEntryType, if the entry as EmailAddressDictionaryEntryType is not null,
                        // and the schema is validated, this requirement can be validated.
                        Site.CaptureRequirement(
                            122,
                            @"[In t:EmailAddressKeyType Simple Type] The type [EmailAddressKeyType] is defined as follow:
                                <xs:simpleType name=""EmailAddressKeyType"">
                                 <xs:restriction
                                  base=""xs:string""
                                 >
                                  <xs:enumeration
                                   value=""EmailAddress1""
                                   />
                                  <xs:enumeration
                                   value=""EmailAddress2""
                                   />
                                  <xs:enumeration
                                   value=""EmailAddress3""
                                   />
                                 </xs:restriction>
                                </xs:simpleType>");
                    }
                    else
                    {
                        Site.Assert.Fail("The entry of EmailAddresses should not be null!");
                    }
                }
            }

            if (contactItemType.ImAddresses != null)
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCONT_R244");

                // Verify MS-OXWSCONT requirement: MS-OXWSCONT_R244
                // If the ImAddresses is not null and schema is validated,
                // the requirement can be validated.
                Site.CaptureRequirement(
                    244,
                    @"[In t:ImAddressDictionaryType Complex Type] The type [ImAddressDictionaryType] is defined as follow:<xs:complexType name=""ImAddressDictionaryType"">
                         <xs:sequence>
                          <xs:element name=""Entry""
                           type=""t:ImAddressDictionaryEntryType""
                           maxOccurs=""unbounded""
                           />
                         </xs:sequence>
                        </xs:complexType>");

                for (int i = 0; i < contactItemType.ImAddresses.Length; i++)
                {
                    if (contactItemType.ImAddresses[i] != null)
                    {
                        // Add the debug information
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCONT_R240");

                        // Verify MS-OXWSCONT requirement: MS-OXWSCONT_R240
                        // If the entry of ImAddresses is not null and schema is validated,
                        // the requirement can be validated.
                        Site.CaptureRequirement(
                            240,
                            @"[In t:ImAddressDictionaryEntryType Complex Type] The type [ImAddressDictionaryEntryType] is defined as follow:<xs:complexType name=""ImAddressDictionaryEntryType"">
                                 <xs:simpleContent>
                                  <xs:extension
                                   base=""xs:string""
                                  >
                                   <xs:attribute name=""key""
                                    type=""t:ImAddressKeyType""
                                    use=""required""
                                    />
                                  </xs:extension>
                                 </xs:simpleContent>
                                </xs:complexType>");

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

                        // Verify MS-OXWSCONT requirement: MS-OXWSCONT_R149
                        // The Key element is a required element of ImAddressDictionaryEntryType, if the entry as ImAddressDictionaryEntryType is not null,
                        // and the schema is validated, this requirement can be validated.
                        Site.CaptureRequirement(
                            149,
                            @"[In t:ImAddressKeyType Simple Type] The type [ImAddressKeyType] is defined as follow:
                                <xs:simpleType name=""ImAddressKeyType"">
                                 <xs:restriction
                                  base=""xs:string""
                                 >
                                  <xs:enumeration
                                   value=""ImAddress1""
                                   />
                                  <xs:enumeration
                                   value=""ImAddress2""
                                   />
                                  <xs:enumeration
                                   value=""ImAddress3""
                                   />
                                 </xs:restriction>
                                </xs:simpleType>");
                    }
                    else
                    {
                        Site.Assert.Fail("The entry of ImAddresses should not be null!");
                    }
                }
            }

            if (contactItemType.PhoneNumbers != null)
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCONT_R252");

                // Verify MS-OXWSCONT requirement: MS-OXWSCONT_R252
                // If the PhoneNumbers is not null and schema is validated,
                // the requirement can be validated.
                Site.CaptureRequirement(
                    252,
                    @"[In t:PhoneNumberDictionaryType Complex Type] The type [PhoneNumberDictionaryType] is defined as follow:<xs:complexType name=""PhoneNumberDictionaryType"">
                     <xs:sequence>
                      <xs:element name=""Entry""
                       type=""t:PhoneNumberDictionaryEntryType""
                       maxOccurs=""unbounded""
                       />
                     </xs:sequence>
                    </xs:complexType>");

                for (int i = 0; i < contactItemType.PhoneNumbers.Length; i++)
                {
                    if (contactItemType.PhoneNumbers[i] != null)
                    {
                        // Add the debug information
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCONT_R248");

                        // Verify MS-OXWSCONT requirement: MS-OXWSCONT_R248
                        // If the entry of PhoneNumbers is not null and schema is validated,
                        // the requirement can be validated.
                        Site.CaptureRequirement(
                            248,
                            @"[In t:PhoneNumberDictionaryEntryType Complex Type] The type [PhoneNumberDictionaryEntryType] is defined as follow:<xs:complexType name=""PhoneNumberDictionaryEntryType"">
                                <xs:simpleContent>
                                <xs:extension
                                base=""xs:string""
                                >
                                <xs:attribute name=""Key""
                                type=""t:PhoneNumberKeyType""
                                use=""required""
                                />
                                </xs:extension>
                                </xs:simpleContent>
                            </xs:complexType>");

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

                        // Verify MS-OXWSCONT requirement: MS-OXWSCONT_R155
                        // The Key element is a required element of PhoneNumberDictionaryEntryType, if the entry as PhoneNumberDictionaryEntryType is not null,
                        // and the schema is validated, this requirement can be validated.
                        Site.CaptureRequirement(
                            155,
                            @"[In t: PhoneNumberKeyType Simple Type] The type[PhoneNumberKeyType] is defined as follow:
< xs:simpleType name = ""PhoneNumberKeyType"" >
 < xs:restriction
  base = ""xs: string""
 >
  < xs:enumeration
   value = ""AssistantPhone""
   />
  < xs:enumeration
   value = ""BusinessFax""
   />
  < xs:enumeration
   value = ""BusinessPhone""
   />
  < xs:enumeration
   value = ""BusinessPhone2""
   />
  < xs:enumeration
   value = ""Callback""
   />
  < xs:enumeration
   value = ""CarPhone""
   />
  < xs:enumeration
   value = ""CompanyMainPhone""
   />
  < xs:enumeration
   value = ""HomeFax""
   />
  < xs:enumeration
   value = ""HomePhone""
   />
  < xs:enumeration
   value = ""HomePhone2""
   />
  < xs:enumeration
   value = ""Isdn""
   />
  < xs:enumeration
   value = ""MobilePhone""
   />
  < xs:enumeration
   value = ""OtherFax""
   />
  < xs:enumeration
   value = ""OtherTelephone""
   />
  < xs:enumeration
   value = ""Pager""
   />
  < xs:enumeration
   value = ""PrimaryPhone""
   />
  < xs:enumeration
   value = ""RadioPhone""
   />
  < xs:enumeration
   value = ""Telex""
   />
  < xs:enumeration
   value = ""TtyTddPhone""
   />
   < xs:enumeration
       value = ""BusinessMobile"" />
     < xs:enumeration
       value = ""IPPhone"" />
     < xs:enumeration
       value = ""Mms"" />
     < xs:enumeration
       value = ""Msn"" />

 </ xs:restriction >
</ xs:simpleType > ");
                    }
                    else
                    {
                        Site.Assert.Fail("The entry of PhoneNumbers should not be null!");
                    }
                }
            }

            if (contactItemType.PhysicalAddresses != null)
            {
                // Add the debug information
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCONT_R270");

                // Verify MS-OXWSCONT requirement: MS-OXWSCONT_R270
                // If the PhysicalAddresses is not null and schema is validated,
                // the requirement can be validated.
                Site.CaptureRequirement(
                    270,
                    @"[In t:PhysicalAddressDictionaryType Complex Type] The type [PhysicalAddressDictionaryType] is defined as follow:<xs:complexType name=""PhysicalAddressDictionaryType"">
                         <xs:sequence>
                          <xs:element name=""entry""
                           type=""t:PhysicalAddressDictionaryEntryType""
                           maxOccurs=""unbounded""
                           />
                         </xs:sequence>
                        </xs:complexType>");

                for (int i = 0; i < contactItemType.PhysicalAddresses.Length; i++)
                {
                    if (contactItemType.PhysicalAddresses[i] != null)
                    {
                        // Add the debug information
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCONT_R256");

                        // Verify MS-OXWSCONT requirement: MS-OXWSCONT_R256
                        // If the entry of PhysicalAddresses is not null and schema is validated,
                        // the requirement can be validated.
                        Site.CaptureRequirement(
                            256,
                            @"[In t:PhysicalAddressDictionaryEntryType Complex Type] The type [PhysicalAddressDictionaryEntryType] is defined as follow:<xs:complexType name=""PhysicalAddressDictionaryEntryType"">
                                 <xs:sequence>
                                  <xs:element name=""Street""
                                   type=""xs:string""
                                   minOccurs=""0""
                                   />
                                  <xs:element name=""City""
                                   type=""xs:string""
                                   minOccurs=""0""
                                   />
                                  <xs:element name=""State""
                                   type=""xs:string""
                                   minOccurs=""0""
                                   />
                                  <xs:element name=""CountryOrRegion""
                                   type=""xs:string""
                                   minOccurs=""0""
                                   />
                                  <xs:element name=""PostalCode""
                                   type=""xs:string""
                                   minOccurs=""0""
                                   />
                                 </xs:sequence>
                                 <xs:attribute name=""Key""
                                  type=""t:PhysicalAddressKeyType""
                                  use=""required""
                                  />
                                </xs:complexType>");

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

                        // Verify MS-OXWSCONT requirement: MS-OXWSCONT_R185
                        // The Key element is a required element of PhysicalAddressDictionaryEntryType, if the entry as PhysicalAddressDictionaryEntryType is not null,
                        // and the schema is validated, this requirement can be validated.
                        Site.CaptureRequirement(
                            185,
                            @"[In t:PhysicalAddressKeyType Simple Type] The type [PhysicalAddressKeyType] is defined as follow:<xs:simpleType name=""PhysicalAddressKeyType"">
                                 <xs:restriction
                                  base=""xs:string""
                                 >
                                  <xs:enumeration
                                   value=""Business""
                                   />
                                  <xs:enumeration
                                   value=""Home""
                                   />
                                  <xs:enumeration
                                   value=""Other""
                                   />
                                 </xs:restriction>
                                </xs:simpleType>");
                    }
                    else
                    {
                        Site.Assert.Fail("The entry of PhysicalAddresses should not be null!");
                    }
                }
            }
        }
Ejemplo n.º 20
0
        public void MSOXWSCORE_S02_TC06_UpdateContactItemFailed()
        {
            ContactItemType item = new ContactItemType();

            this.TestSteps_VerifyUpdateItemFailedResponse(item);
        }
Ejemplo n.º 21
0
        public void MSOXWSCORE_S02_TC01_CreateGetDeleteContactItemSuccessfully()
        {
            ContactItemType item = new ContactItemType();

            this.TestSteps_VerifyCreateGetDeleteItem(item);
        }
Ejemplo n.º 22
0
        public void MSOXWSCORE_S02_TC03_MoveContactItemSuccessfully()
        {
            #region Step 1: Create the contact item.
            ContactItemType item           = new ContactItemType();
            ItemIdType[]    createdItemIds = this.CreateItemWithMinimumElements(item);
            #endregion

            #region Step 2: Move the contact item.
            // Clear ExistItemIds for MoveItem.
            this.InitializeCollection();

            // Call MoveItem operation.
            MoveItemResponseType moveItemResponse = this.CallMoveItemOperation(DistinguishedFolderIdNameType.inbox, createdItemIds);

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

            ItemIdType[] movedItemIds = Common.GetItemIdsFromInfoResponse(moveItemResponse);

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

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

            Site.Assert.AreEqual <int>(
                1,
                getItemResponse.ResponseMessages.Items.GetLength(0),
                "Expected Item Count: {0}, Actual Item Count: {1}",
                1,
                getItemResponse.ResponseMessages.Items.GetLength(0));

            Site.Assert.AreEqual <ResponseClassType>(
                ResponseClassType.Error,
                getItemResponse.ResponseMessages.Items[0].ResponseClass,
                string.Format(
                    "Get contact item operation should be failed with error! Actual response code: {0}",
                    getItemResponse.ResponseMessages.Items[0].ResponseCode));
            #endregion

            #region Step 4: Get the moved contact item.
            // Call the GetItem operation.
            getItemResponse = this.CallGetItemOperation(movedItemIds);

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

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

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

            #endregion
        }
Ejemplo n.º 23
0
 public void MSOXWSCORE_S02_TC09_OperateMultipleContactItemsSuccessfully()
 {
     ContactItemType[] items = new ContactItemType[] { new ContactItemType(), new ContactItemType() };
     this.TestSteps_VerifyOperateMultipleItems(items);
 }
Ejemplo n.º 24
0
        public void MSOXWSCORE_S02_TC14_GetContactItemWithDefaultShapeNamesTypeEnum()
        {
            ContactItemType item = new ContactItemType();

            this.TestSteps_VerifyGetItemWithItemResponseShapeType_DefaultShapeNamesTypeEnum(item);
        }
Ejemplo n.º 25
0
        public void MSOXWSCORE_S02_TC16_CreateContactItemWithInvalidItemClass()
        {
            #region Step 1: Create the contact item with ItemClass set to IPM.Appointment.
            CreateItemType createItemRequest = new CreateItemType();
            createItemRequest.Items = new NonEmptyArrayOfAllItemsType();
            ContactItemType item = new ContactItemType();
            createItemRequest.Items.Items              = new ItemType[] { item };
            createItemRequest.Items.Items[0].Subject   = Common.GenerateResourceName(this.Site, TestSuiteHelper.SubjectForCreateItem, 1);
            createItemRequest.Items.Items[0].ItemClass = "IPM.Appointment";
            CreateItemResponseType createItemResponse = this.COREAdapter.CreateItem(createItemRequest);
            Site.Assert.AreEqual <ResponseCodeType>(
                ResponseCodeType.ErrorObjectTypeChanged,
                createItemResponse.ResponseMessages.Items[0].ResponseCode,
                "ErrorObjectTypeChanged should be returned if create a contact item with ItemClass IPM.Appointment.");
            #endregion

            #region Step 2: Create the contact item with ItemClass set to IPM.Post.
            createItemRequest.Items.Items[0].Subject   = Common.GenerateResourceName(this.Site, TestSuiteHelper.SubjectForCreateItem, 2);
            createItemRequest.Items.Items[0].ItemClass = "IPM.Post";
            createItemResponse = this.COREAdapter.CreateItem(createItemRequest);
            Site.Assert.AreEqual <ResponseCodeType>(
                ResponseCodeType.ErrorObjectTypeChanged,
                createItemResponse.ResponseMessages.Items[0].ResponseCode,
                "ErrorObjectTypeChanged should be returned if create a contact item with ItemClass IPM.Post.");
            #endregion

            #region Step 3: Create the contact item with ItemClass set to IPM.Task.
            createItemRequest.Items.Items[0].Subject   = Common.GenerateResourceName(this.Site, TestSuiteHelper.SubjectForCreateItem, 3);
            createItemRequest.Items.Items[0].ItemClass = "IPM.Task";
            createItemResponse = this.COREAdapter.CreateItem(createItemRequest);
            Site.Assert.AreEqual <ResponseCodeType>(
                ResponseCodeType.ErrorObjectTypeChanged,
                createItemResponse.ResponseMessages.Items[0].ResponseCode,
                "ErrorObjectTypeChanged should be returned if create a contact item with ItemClass IPM.Task.");
            #endregion

            #region Step 4: Create the contact item with ItemClass set to IPM.DistList.
            createItemRequest.Items.Items[0].Subject   = Common.GenerateResourceName(this.Site, TestSuiteHelper.SubjectForCreateItem, 4);
            createItemRequest.Items.Items[0].ItemClass = "IPM.DistList";
            createItemResponse = this.COREAdapter.CreateItem(createItemRequest);
            Site.Assert.AreEqual <ResponseCodeType>(
                ResponseCodeType.ErrorObjectTypeChanged,
                createItemResponse.ResponseMessages.Items[0].ResponseCode,
                "ErrorObjectTypeChanged should be returned if create a contact item with ItemClass IPM.DistList.");
            #endregion

            #region Step 5: Create the contact item with ItemClass set to random string.
            createItemRequest.Items.Items[0].Subject   = Common.GenerateResourceName(this.Site, TestSuiteHelper.SubjectForCreateItem, 5);
            createItemRequest.Items.Items[0].ItemClass = Common.GenerateResourceName(this.Site, "ItemClass");
            createItemResponse = this.COREAdapter.CreateItem(createItemRequest);
            Site.Assert.AreEqual <ResponseCodeType>(
                ResponseCodeType.ErrorObjectTypeChanged,
                createItemResponse.ResponseMessages.Items[0].ResponseCode,
                "ErrorObjectTypeChanged should be returned if create a contact item with ItemClass is set to a random string.");
            #endregion

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

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2023
            this.Site.CaptureRequirement(
                2023,
                @"[In t:ItemType Complex Type] If invalid values are set for these items in the CreateItem request, an ErrorObjectTypeChanged ([MS-OXWSCDATA] section 2.2.5.24) response code will be returned in the CreateItem response.");
        }
Ejemplo n.º 26
0
        public void MSOXWSCONT_S06_TC01_OperateContactItemWithoutOptionalElements()
        {
            #region Step 1:Create the contact item.
            // Create a contact item without optional elements.
            ContactItemType        item = this.BuildContactItemWithRequiredProperties();
            CreateItemResponseType createItemResponse = this.CallCreateItemOperation(item);

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

            #region Step 2:Update the contact item.
            UpdateItemType updateItemRequest = new UpdateItemType()
            {
                // Configure ItemIds.
                ItemChanges = new ItemChangeType[]
                {
                    new ItemChangeType()
                    {
                        Item = this.ExistContactItems[0],

                        Updates = new ItemChangeDescriptionType[]
                        {
                            new SetItemFieldType()
                            {
                                Item = new PathToUnindexedFieldType()
                                {
                                    FieldURI = UnindexedFieldURIType.contactsFileAs
                                },

                                Item1 = new ContactItemType()
                                {
                                    FileAs = FileAsMappingType.LastFirstCompany.ToString()
                                }
                            }
                        }
                    }
                },

                ConflictResolution = ConflictResolutionType.AlwaysOverwrite
            };

            // Clear existContactItems for MoveItem.
            this.InitializeCollection();

            UpdateItemResponseType updateItemResponse = new UpdateItemResponseType();

            // Invoke UpdateItem operation.
            updateItemResponse = this.CONTAdapter.UpdateItem(updateItemRequest);

            // Check the response.
            Common.CheckOperationSuccess(updateItemResponse, 1, this.Site);
            #endregion

            #region Step 3:Move the contact item.
            MoveItemType         moveItemRequest  = new MoveItemType();
            MoveItemResponseType moveItemResponse = new MoveItemResponseType();

            // Configure ItemIds.
            moveItemRequest.ItemIds    = new BaseItemIdType[1];
            moveItemRequest.ItemIds[0] = this.ExistContactItems[0];

            // Clear existContactItems for MoveItem.
            this.InitializeCollection();

            // Configure move Distinguished Folder.
            DistinguishedFolderIdType distinguishedFolderId = new DistinguishedFolderIdType();
            distinguishedFolderId.Id        = DistinguishedFolderIdNameType.drafts;
            moveItemRequest.ToFolderId      = new TargetFolderIdType();
            moveItemRequest.ToFolderId.Item = distinguishedFolderId;

            moveItemResponse = this.CONTAdapter.MoveItem(moveItemRequest);

            // Check the response.
            Common.CheckOperationSuccess(moveItemResponse, 1, this.Site);
            #endregion

            #region Step 4:Get the contact item.
            // The contact item to get.
            ItemIdType[] itemArray = new ItemIdType[this.ExistContactItems.Count];
            this.ExistContactItems.CopyTo(itemArray, 0);

            GetItemResponseType getItemResponse = this.CallGetItemOperation(itemArray);

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

            #region Step 5:Copy the contact item.
            CopyItemType         copyItemRequest  = new CopyItemType();
            CopyItemResponseType copyItemResponse = new CopyItemResponseType();

            // Configure ItemIds.
            copyItemRequest.ItemIds    = new BaseItemIdType[1];
            copyItemRequest.ItemIds[0] = this.ExistContactItems[0];

            // Configure the copy Distinguished Folder.
            DistinguishedFolderIdType distinguishedFolderIdForCopyItem = new DistinguishedFolderIdType();
            distinguishedFolderIdForCopyItem.Id = DistinguishedFolderIdNameType.drafts;
            copyItemRequest.ToFolderId          = new TargetFolderIdType();
            copyItemRequest.ToFolderId.Item     = distinguishedFolderIdForCopyItem;

            copyItemResponse = this.CONTAdapter.CopyItem(copyItemRequest);

            // Check the response.
            Common.CheckOperationSuccess(copyItemResponse, 1, this.Site);
            #endregion
        }