CompareStringArray() публичный статический Метод

Compare two string array to verify whether their value are equal.
public static CompareStringArray ( string arrayFirst, string arraySecond ) : bool
arrayFirst string The first string array
arraySecond string The second string array
Результат bool
Пример #1
0
        public void MSOXWSTASK_S06_TC02_OperateTaskItemWithOptionalElements()
        {
            #region Client calls CreateItem operation to create a task item with optional elements.

            // All the optional elements in task item are set in this method.
            string   subject      = Common.GenerateResourceName(this.Site, "This is a task");
            TaskType sentTaskItem = TestSuiteHelper.DefineTaskItem(subject, TaskStatusType.Completed);

            // Save the ItemId of task item got from the createItem response.
            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 call GetItem operation to get the task item.
            TaskType[] retrievedTaskItems = this.GetTasks(createItemId);
            Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This get response status should be success!", null);
            TaskType retrievedTaskItem = retrievedTaskItems[0];
            #endregion

            #region Verify the related requirements about sub-elements of TaskType
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSTASK_R42");

            // Verify MS-OXWSTASK requirement: MS-OXWSTASK_R42
            this.Site.CaptureRequirementIfAreEqual <int>(
                sentTaskItem.ActualWork,
                retrievedTaskItem.ActualWork,
                42,
                @"[In t:TaskType Complex Type] ActualWork: Specifies an integer value that specifies the actual amount of time that is spent on a task.");

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

            // Verify MS-OXWSTASK requirement: MS-OXWSTASK_R44
            this.Site.CaptureRequirementIfAreEqual <string>(
                sentTaskItem.BillingInformation,
                retrievedTaskItem.BillingInformation,
                44,
                @"[In t:TaskType Complex Type] BillingInformation: Specifies a string value that contains billing information for a task.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSTASK_R47, Expected value:" + sentTaskItem.Companies[0].ToString() + " " + sentTaskItem.Companies[1].ToString() + "Actual value:" + retrievedTaskItem.Companies[0].ToString() + " " + retrievedTaskItem.Companies[1].ToString());

            // Verify MS-OXWSTASK requirement: MS-OXWSTASK_R47
            bool isVerifiedR47 = TestSuiteHelper.CompareStringArray(retrievedTaskItem.Companies, sentTaskItem.Companies);

            this.Site.CaptureRequirementIfIsTrue(
                isVerifiedR47,
                47,
                @"[In t:TaskType Complex Type] Companies: Specifies an instance of an array of type string that represents a collection of companies that are associated with a task.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSTASK_R49, Expected value" + sentTaskItem.Contacts[0].ToString() + " " + sentTaskItem.Contacts[1].ToString() + "Actual value:" + retrievedTaskItem.Contacts[0].ToString() + " " + retrievedTaskItem.Contacts[1].ToString());

            // Verify MS-OXWSTASK requirement: MS-OXWSTASK_R49
            bool isVerifiedR49 = TestSuiteHelper.CompareStringArray(retrievedTaskItem.Contacts, sentTaskItem.Contacts);

            this.Site.CaptureRequirementIfIsTrue(
                isVerifiedR49,
                49,
                @"[In t:TaskType Complex Type] Contacts: Specifies an instance of an array of type string that contains a list of contacts that are associated with a task.");

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

            // Verify MS-OXWSTASK requirement: MS-OXWSTASK_R53
            this.Site.CaptureRequirementIfAreEqual <DateTime>(
                sentTaskItem.DueDate.Date,
                retrievedTaskItem.DueDate.Date,
                53,
                @"[In t:TaskType Complex Type] DueDate: Specifies an instance of the DateTime structure that represents the date when a task is due.");

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

            // Verify MS-OXWSTASK requirement: MS-OXWSTASK_R58
            this.Site.CaptureRequirementIfAreEqual <string>(
                sentTaskItem.Mileage,
                retrievedTaskItem.Mileage,
                58,
                @"[In t:TaskType Complex Type] Mileage: Specifies a string value that represents the mileage for a task.");

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

            // Verify MS-OXWSTASK requirement: MS-OXWSTASK_R63
            this.Site.CaptureRequirementIfAreEqual <DateTime>(
                sentTaskItem.StartDate.Date,
                retrievedTaskItem.StartDate.Date,
                63,
                @"[In t:TaskType Complex Type] StartDate: Specifies an instance of the DateTime structure that represents the start date of a task.");

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

            // Verify MS-OXWSTASK requirement: MS-OXWSTASK_R65
            this.Site.CaptureRequirementIfAreEqual <TaskStatusType>(
                sentTaskItem.Status,
                retrievedTaskItem.Status,
                65,
                @"[In t:TaskType Complex Type] Status: Specifies one of the valid TaskStatusType simple type enumeration values that represent the status of a task.");

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

            // Verify MS-OXWSTASK requirement: MS-OXWSTASK_R67
            this.Site.CaptureRequirementIfAreEqual <int>(
                sentTaskItem.TotalWork,
                retrievedTaskItem.TotalWork,
                67,
                @"[In t:TaskType Complex Type] TotalWork: Specifies an integer value that represents the total amount of work that is associated with a task.");

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

            // Verify MS-OXWSTASK requirement: MS-OXWSTASK_R45
            this.Site.CaptureRequirementIfAreEqual <int>(
                sentTaskItem.ChangeCount + 1,
                retrievedTaskItem.ChangeCount,
                45,
                @"[In t:TaskType Complex Type] ChangeCount: Specifies an integer value that specifies the number of times the task has changed since it was created.");

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

            // Verify MS-OXWSTASK requirement: MS-OXWSTASK_R48
            this.Site.CaptureRequirementIfAreEqual <DateTime>(
                sentTaskItem.CompleteDate.Date,
                retrievedTaskItem.CompleteDate.Date,
                48,
                @"[In t:TaskType Complex Type] CompleteDate: Specifies an instance of the DateTime structure that represents the date on which a task was completed.");

            #endregion

            #region Client calls UpdateItem operation to update the value of taskCompanies 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 CopyItem operation to copy the created task item.
            ItemIdType[] copyItemIds = this.CopyTasks(updateItemId);
            Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This copy response status should be success!", null);
            ItemIdType copyItemId = copyItemIds[0];
            #endregion

            #region Client calls MoveItem operation to move the task item.
            ItemIdType[] moveItemIds = this.MoveTasks(updateItemId);
            Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This move response status should be success!", null);
            ItemIdType moveItemId = moveItemIds[0];
            #endregion

            #region Client calls DeleteItem to delete the task items created in the previous steps.
            this.DeleteTasks(copyItemId, moveItemId);
            Site.Assert.AreEqual <ResponseClassType>(ResponseClassType.Success, (ResponseClassType)this.ResponseClass[0], "This delete response status should be success!", null);
            #endregion
        }
Пример #2
0
        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
        }