Microsoft.Protocols.TestSuites.MS_ASTASK.S01_SyncCommand.MSASTASK_S01_TC19_CreateTaskItemCategoriesWithoutChildElements C# (CSharp) Method

MSASTASK_S01_TC19_CreateTaskItemCategoriesWithoutChildElements() private method

        public void MSASTASK_S01_TC19_CreateTaskItemCategoriesWithoutChildElements()
        {
            #region Call Sync command to create task item with categories not containing any child elements.

            Dictionary<Request.ItemsChoiceType8, object> taskItem = new Dictionary<Request.ItemsChoiceType8, object>();
            string subject = Common.GenerateResourceName(Site, "subject");

            taskItem.Add(Request.ItemsChoiceType8.Subject2, subject);

            // Set Categories element without any child elements.
            Request.Categories4 categories = new Request.Categories4();
            taskItem.Add(Request.ItemsChoiceType8.Categories3, categories);

            SyncStore syncResponse = this.SyncAddTask(taskItem);

            Site.Assert.AreEqual<int>(1, int.Parse(syncResponse.AddResponses[0].Status), "Task item should be created successfully.");

            ItemsNeedToDelete.Add(subject);

            #endregion

            #region Call Sync command to get the task item.

            SyncItem syncedTaskItem = this.GetChangeItem(this.UserInformation.TasksCollectionId, subject);
            Site.Assert.IsNotNull(syncedTaskItem.Task, "The task which subject is {0} should exist in server.", subject);

            #endregion

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

            // Verify MS-ASTASK requirement: MS-ASTASK_R436
            // If Categories element is not returned from server, this element has been removed.
            Site.CaptureRequirementIfIsNull(
                syncedTaskItem.Task.Categories,
                436,
                @"[In Categories] If a Categories element contains no Category child elements in a request [or response], then the categories for the specified task will be removed.");
        }