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

MSASTASK_S01_TC09_CreateTaskItemWithInvalidImportanceElement() private method

        public void MSASTASK_S01_TC09_CreateTaskItemWithInvalidImportanceElement()
        {
            #region Call Sync command to create task item with an invalid Importance value.

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

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

            // The valid value for importance is 0,1,2
            taskItem.Add(Request.ItemsChoiceType8.Importance1, (byte)3);
            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

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

            // Verify MS-ASTASK requirement: MS-ASTASK_R187
            // If the Importance in the request is not in {0,1,2} and the response Status is 1(Success),the requirement can be covered.
            Site.CaptureRequirementIfAreEqual<int>(
                1,
                int.Parse(syncResponse.AddResponses[0].Status),
                187,
                @"[In Importance] If the Importance element is set to a value other than 0 (zero), 1, or 2 in a command request, the server will process the request successfully (that is, will not return an error code in the response) [and return the same value that is set in the request].");

            SyncItem syncedTaskItem = this.GetChangeItem(this.UserInformation.TasksCollectionId, subject);

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

            // Verify MS-ASTASK requirement: MS-ASTASK_R550
            Site.CaptureRequirementIfAreEqual<byte?>(
                3,
                syncedTaskItem.Task.Importance,
                550,
                @"[In Importance] If the Importance element is set to a value other than 0 (zero), 1, or 2 in a command request, the server will [process the request successfully (that is, will not return an error code in the response) and] return the same value that is set in the request.");
        }