/// <summary> /// Define the task item via setting different kind of taskRecurrence value. /// </summary> /// <param name="subject">The subject of the task.</param> /// <param name="taskRecurrence">Recurrence element value of the task.</param> /// <returns>The task object.</returns> public static TaskType DefineTaskItem(string subject, TaskRecurrenceType taskRecurrence) { #region Define Task item TaskType taskItem = new TaskType { // The subject of a task. Subject = subject, // The actual amount of time that is spent on a task. ActualWork = 5, ActualWorkSpecified = true, // The total amount of time that is associated with a task. TotalWork = 10, TotalWorkSpecified = true, // The billing information for a task. BillingInformation = "Discount: 10 dollars", // The collection of companies that are associated with a task. Companies = new string[] { "CompanyFirst", "CompanySecond" }, // The collection of contacts that are associated with a task. Contacts = new string[] { "Alice", "Bob" }, // The start date of a task. The start date cannot occur after due date. StartDate = DateTime.Parse("2011-8-4"), StartDateSpecified = true, // The due date of a task. The due date cannot occur before start date. DueDate = DateTime.Parse("2011-8-10"), DueDateSpecified = true, // The mileage for a task. Mileage = "15 km.", // The completion percentage of a task. PercentComplete = 50, PercentCompleteSpecified = true }; // The recurrence of a task. if (taskRecurrence != null) { taskItem.Recurrence = taskRecurrence; } #endregion return(taskItem); }
public void MSOXWSTASK_S06_TC04_OperateTaskItemWithIsRecurringElement() { #region Client calls CreateItem operation to create a task item, which is a recurring task. // Configure the DailyRegeneratingPatternType. TaskRecurrenceType taskRecurrence = TestSuiteHelper.GenerateTaskRecurrence(TestSuiteHelper.GenerateDailyRegeneratingPattern, TestSuiteHelper.GenerateNumberedRecurrenceRange); // Save the ItemId of task item got from the createItem response. string subject = Common.GenerateResourceName(this.Site, "This is a task"); ItemIdType[] createItemIdsFirst = this.CreateTasks(TestSuiteHelper.DefineTaskItem(subject, taskRecurrence)); Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This create response status should be success!", null); ItemIdType createItemIdFirst = createItemIdsFirst[0]; #endregion #region Client call GetItem operation to get the task item. TaskType[] retrievedTaskItemsFirst = this.GetTasks(createItemIdFirst); Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This get response status should be success!", null); TaskType retrievedTaskItemFirst = retrievedTaskItemsFirst[0]; #endregion #region Verify the IsRecurring element value // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSTASK_R5666"); // Verify MS-OXWSTASK requirement: MS-OXWSTASK_R5666 this.Site.CaptureRequirementIfIsTrue( retrievedTaskItemFirst.IsRecurring, 5666, @"[In t:TaskType Complex Type] [IsRecurring is] True, indicates a task is part of a recurring task."); #endregion #region Client calls CreateItem operation to create a task item, which is not a recurring task. // Save the ItemId of task item got from the createItem response. subject = Common.GenerateResourceName(this.Site, "This is a task"); ItemIdType[] createItemIdsSecond = this.CreateTasks(TestSuiteHelper.DefineTaskItem(subject, null)); Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This create response status should be success!", null); ItemIdType createItemIdSecond = createItemIdsSecond[0]; #endregion #region Client call GetItem operation to get the task item. TaskType[] retrievedTaskItemsSecond = this.GetTasks(createItemIdSecond); Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This get response status should be success!", null); TaskType retrievedTaskItemSecond = retrievedTaskItemsSecond[0]; #endregion #region Verify the IsRecurring element value // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSTASK_R5667"); // Verify MS-OXWSTASK requirement: MS-OXWSTASK_R5667 this.Site.CaptureRequirementIfIsFalse( retrievedTaskItemSecond.IsRecurring, 5667, @"[In t:TaskType Complex Type] [IsRecurring is] False, indicates a task is not part of a recurring task."); #endregion #region Client calls DeleteItem to delete the task items created in the previous steps. this.DeleteTasks(createItemIdFirst, createItemIdSecond); Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This delete response status should be success!", null); #endregion }
public void MSOXWSTASK_S02_TC01_VerifyAffectedTaskOccurrencesType() { #region Client calls CreateItem to create a task item that contains the Recurrence element, which includes the DailyRecurrencePatternType. // Configure the DailyRecurrencePatternType. TaskRecurrenceType taskRecurrence = TestSuiteHelper.GenerateTaskRecurrence(TestSuiteHelper.GenerateDailyRecurrencePattern, TestSuiteHelper.GenerateNumberedRecurrenceRange); // Define a task item. string subject = Common.GenerateResourceName(this.Site, "This is a task"); TaskType sentTaskItem = TestSuiteHelper.DefineTaskItem(subject, taskRecurrence); ItemIdType[] createItemIds = this.CreateTasks(sentTaskItem); Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This create response status should be success!", null); ItemIdType createItemId = createItemIds[0]; #endregion #region Client calls UpdateItem to update the value of "companies" element of task item. ItemIdType[] updateItemIds = this.UpdateTasks(createItemId); Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This update response status should be success!", null); ItemIdType updateItemId = updateItemIds[0]; #endregion #region Client calls GetItem to check whether the task item' "companies" element is updated. TaskType[] taskItemsAfterUpdate = this.GetTasks(updateItemId); Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This get response status should be success!", null); TaskType taskItemAfterUpdate = taskItemsAfterUpdate[0]; bool isEqual = TestSuiteHelper.CompareStringArray(taskItemAfterUpdate.Companies, new string[] { "Company3", "Company4" }); Site.Assert.IsTrue(isEqual, "After updated, the task companies names should be Company3, Company4", null); #endregion #region Client calls DeleteItem to delete only the current occurrence of a task. this.DeleteTasks(AffectedTaskOccurrencesType.SpecifiedOccurrenceOnly, updateItemId); Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This delete response status should be success!", null); #endregion #region Client calls GetItem to check whether only current occurrence of task item is deleted. TaskType[] taskItemsAfterDelete = GetTasks(updateItemId); Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This get response status should be success!", null); TaskType taskItemAfterDelete = taskItemsAfterDelete[0]; // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSTASK_R175"); // Verify MS-OXWSTASK requirement: MS-OXWSTASK_R175 // After deleting the current occurrence of a task item, the start time of task item is changed to next occurrence. Site.CaptureRequirementIfAreEqual <string>( ExtractStartTimeOfNextOccurrence(taskItemAfterUpdate), taskItemAfterDelete.StartDate.ToShortTimeString(), 175, @"[In t:AffectedTaskOccurrencesType Simple Type] SpecifiedOccurrenceOnly: Specifies that a DeleteItem operation request, as specified in [MS-OXWSCORE] section 3.1.4.3, deletes only the current occurrence of a task."); #endregion #region Client calls DeleteItem to delete all recurring tasks. this.DeleteTasks(updateItemId); Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This delete response status should be success!", null); #endregion #region Client calls GetItem to check whether all recurring tasks is deleted. this.GetTasks(updateItemId); Site.Assert.AreNotEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This get response status should not be success!", null); Site.Assert.AreEqual <ResponseCodeType>(ResponseCodeType.ErrorItemNotFound, (ResponseCodeType)this.ResponseCode[0], "This get response status information should be ErrorItemNotFound!", null); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSTASK_R174"); // Verify MS-OXWSTASK requirement: MS-OXWSTASK_R174 // After deleting all recurring tasks with the AffectedTaskOccurrences element setting to AllOccurrences, // the operation of getting task will return code ErrorItemNotFound. If getting this response code, the following // requirement will be captured directly. Site.CaptureRequirement( 174, @"[In t:AffectedTaskOccurrencesType Simple Type] AllOccurrences: Specifies that a DeleteItem operation request, as specified in [MS-OXWSCORE] section 3.1.4.3, deletes the master task and all recurring tasks that are associated with the master task."); #endregion }