コード例 #1
0
        /// <summary>
        /// This method is used to set value for contact properties.
        /// </summary>
        /// <param name="picture">The picture of the contact item.</param>
        /// <returns>The value for contact properties.</returns>
        protected Dictionary<Request.ItemsChoiceType8, object> SetContactProperties(string picture)
        {
            Request.Body contactBody = new Request.Body { Type = 1, Data = Common.GenerateResourceName(this.Site, "Body") };
            List<string> categories = new List<string> { this.Site.DefaultProtocolDocShortName + "Category" };
            Request.Categories1 contactCategories = new Request.Categories1 { Category = categories.ToArray() };
            List<string> children = new List<string> { Common.GenerateResourceName(this.Site, "Child") };
            Request.Children contactChildren = new Request.Children { Child = children.ToArray() };

            Dictionary<Request.ItemsChoiceType8, object> contactProperties = new Dictionary<Request.ItemsChoiceType8, object>
            {
                {
                    Request.ItemsChoiceType8.FileAs, Common.GenerateResourceName(this.Site, "Contact")
                },
                {
                    Request.ItemsChoiceType8.AccountName, "Contact1"
                },
                {
                    Request.ItemsChoiceType8.Anniversary, DateTime.Parse("2012-10-01")
                },
                {
                    Request.ItemsChoiceType8.AssistantName, "Assistant"
                },
                {
                    Request.ItemsChoiceType8.AssistantPhoneNumber, "54689733"
                },
                {
                    Request.ItemsChoiceType8.Birthday, DateTime.Parse("1980-04-12")
                },
                {
                    Request.ItemsChoiceType8.Body, contactBody
                },
                {
                    Request.ItemsChoiceType8.BusinessPhoneNumber, "987654321"
                },
                {
                    Request.ItemsChoiceType8.Business2PhoneNumber, "123456789"
                },
                {
                    Request.ItemsChoiceType8.BusinessAddressCity, "Beijing"
                },
                {
                    Request.ItemsChoiceType8.BusinessAddressCountry, "China"
                },
                {
                    Request.ItemsChoiceType8.BusinessAddressPostalCode, "100080"
                },
                {
                    Request.ItemsChoiceType8.BusinessAddressState, "Haidian"
                },
                {
                    Request.ItemsChoiceType8.BusinessAddressStreet, "Danling"
                },
                {
                    Request.ItemsChoiceType8.BusinessFaxNumber, "0123456"
                },
                {
                    Request.ItemsChoiceType8.CarPhoneNumber, "123456789"
                },
                {
                    Request.ItemsChoiceType8.Categories1, contactCategories
                },
                {
                    Request.ItemsChoiceType8.Children, contactChildren
                },
                {
                    Request.ItemsChoiceType8.CompanyMainPhone, "23456987"
                },
                {
                    Request.ItemsChoiceType8.CompanyName, "Microsoft"
                },
                {
                    Request.ItemsChoiceType8.CustomerId, "Customer1"
                },
                {
                    Request.ItemsChoiceType8.Department, "Testing"
                },

                // Domain name "contoso.com" is just a sample domain name. It does not have any relationship to the domain name configured in common ptfconfig file.
                {
                    Request.ItemsChoiceType8.Email1Address, "*****@*****.**"
                },
                {
                    Request.ItemsChoiceType8.Email2Address, "*****@*****.**"
                },
                {
                    Request.ItemsChoiceType8.Email3Address, "*****@*****.**"
                },
                {
                    Request.ItemsChoiceType8.FirstName, "Aaron"
                },
                {
                    Request.ItemsChoiceType8.GovernmentId, "99910819810809502X"
                },
                {
                    Request.ItemsChoiceType8.Home2PhoneNumber, "1234568742"
                },
                {
                    Request.ItemsChoiceType8.HomeAddressCity, "Princeton"
                },
                {
                    Request.ItemsChoiceType8.HomeAddressCountry, "United States"
                },
                {
                    Request.ItemsChoiceType8.HomeAddressPostalCode, "08989"
                },
                {
                    Request.ItemsChoiceType8.HomeAddressState, "New Jersey"
                },
                {
                    Request.ItemsChoiceType8.HomeAddressStreet, "Nassauy"
                },
                {
                    Request.ItemsChoiceType8.HomeFaxNumber, "012345678"
                },
                {
                    Request.ItemsChoiceType8.HomePhoneNumber, "014578932"
                },
                {
                    Request.ItemsChoiceType8.IMAddress, "InstantIMAddress"
                },
                {
                    Request.ItemsChoiceType8.IMAddress2, "AlternativeIMAddress"
                },
                {
                    Request.ItemsChoiceType8.IMAddress3, "TertiaryIMAddress"
                },
                {
                    Request.ItemsChoiceType8.JobTitle, "Tester"
                },
                {
                    Request.ItemsChoiceType8.LastName, "Clinton"
                },
                {
                    Request.ItemsChoiceType8.ManagerName, "Jodge"
                },
                {
                    Request.ItemsChoiceType8.MiddleName, "Jafferson"
                },
                {
                    Request.ItemsChoiceType8.MMS, "mms://enmms.chinabroadcast.cn"
                },
                {
                    Request.ItemsChoiceType8.MobilePhoneNumber, "12345678932"
                },
                {
                    Request.ItemsChoiceType8.NickName, "Ara"
                },
                {
                    Request.ItemsChoiceType8.OfficeLocation, "Beijing"
                },
                {
                    Request.ItemsChoiceType8.OtherAddressCity, "Toronto"
                },
                {
                    Request.ItemsChoiceType8.OtherAddressCountry, "Canada"
                },
                {
                    Request.ItemsChoiceType8.OtherAddressPostalCode, "K1N5H3"
                },
                {
                    Request.ItemsChoiceType8.OtherAddressState, "Ontario"
                },
                {
                    Request.ItemsChoiceType8.OtherAddressStreet, "Avenue"
                },
                {
                    Request.ItemsChoiceType8.PagerNumber, "1"
                },
                {
                    Request.ItemsChoiceType8.RadioPhoneNumber, "1234562589"
                },
                {
                    Request.ItemsChoiceType8.Spouse, "Emily"
                },
                {
                    Request.ItemsChoiceType8.Suffix, "CL."
                },
                {
                    Request.ItemsChoiceType8.Title, "Test"
                },
                {
                    Request.ItemsChoiceType8.WebPage, "http://Test.html"
                },
                {
                    Request.ItemsChoiceType8.YomiCompanyName, "Sony"
                },
                {
                    Request.ItemsChoiceType8.YomiFirstName, "Hanasaki"
                },
                {
                    Request.ItemsChoiceType8.YomiLastName, "Tsuki"
                }
            };

            if (picture != null)
            {
                contactProperties.Add(Request.ItemsChoiceType8.Picture, Convert.ToBase64String(File.ReadAllBytes(picture)));
            }

            return contactProperties;
        }
コード例 #2
0
        public void MSASCNTC_S01_TC06_Sync_AddContact_300CategoryElements()
        {
            #region Call Sync command with 300 Category elements per Categories element to add a contact to the server
            string fileAs = Common.GenerateResourceName(Site, "Contact");
            Dictionary<Request.ItemsChoiceType8, object> contactProperties = new Dictionary<Request.ItemsChoiceType8, object>();
            Collection<string> categories = new Collection<string>();

            for (int i = 1; i <= 300; i++)
            {
                string category = "Category" + i;
                categories.Add(category);
            }

            Request.Categories1 contactCategories = new Request.Categories1 { Category = new string[categories.Count] };
            categories.CopyTo(contactCategories.Category, 0);
            contactProperties.Add(Request.ItemsChoiceType8.Categories1, contactCategories);
            contactProperties.Add(Request.ItemsChoiceType8.FileAs, fileAs);

            this.AddContact(this.User1Information.ContactsCollectionId, contactProperties);

            this.RecordCaseRelativeItems(this.User1Information.UserName, this.User1Information.ContactsCollectionId, fileAs);
            #endregion

            #region Call Sync command to synchronize the contact added in previous step
            // Get the new added contact
            Sync newAddedItem = this.GetSyncAddResult(fileAs, this.User1Information.ContactsCollectionId, null, null);
            #endregion

            #region Verify requirement
            // If the Sync Add operation is successful and the count of Category is 300, it means the contact can have 300 Category elements, then requirement MS-ASCNTC_R183 can be captured.
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCNTC_R183.");

            // Verify MS-ASCNTC requirement: MS-ASCNTC_R183
            Site.CaptureRequirementIfAreEqual<int>(
                300,
                newAddedItem.Contact.Categories.Category.Length,
                183,
                @"[In Category] It[Categories] can have up to 300 elements[Category] per Categories element.");
            #endregion
        }