public void Add_New_Membership_To_Group() { var group = redmineManager.GetObject <Group>("9", new NameValueCollection() { { "include", "memberships" } }); var mbs = new Membership(); mbs.Roles = new List <MembershipRole>(); mbs.Roles.Add(new MembershipRole() { Inherited = true, Name = "role de test" }); group.Memberships.Add(mbs); redmineManager.UpdateObject("9", group); var updatedGroup = redmineManager.GetObject <Group>("9", new NameValueCollection() { { "include", "memberships" } }); }
public static void EditIssue(DataStructureClass.DataStructure EditedData) { Console.WriteLine(DateTime.Now + ": ServerClass.EditIssue"); IssueUpdate.Project = new IdentifiableName { Id = EditedData._projectId }; IssueUpdate.Subject = EditedData._subjectName; IssueUpdate.DoneRatio = EditedData._percentDone; IssueUpdate.Priority = new IdentifiableName { Id = EditedData._priorityId }; IssueUpdate.AssignedTo = new IdentifiableName { Id = EditedData._assignedToId }; IssueUpdate.Description = EditedData._description; IssueUpdate.Status = new IdentifiableName { Id = EditedData._statusId }; IssueUpdate.Tracker = new IdentifiableName { Id = EditedData._trackerId }; if (EditedData._startDateCh) { IssueUpdate.StartDate = EditedData._startDate; } if (EditedData._dueDateCh) { IssueUpdate.DueDate = EditedData._dueDate; } IssueUpdate.EstimatedHours = EditedData._estimHours; redmine.UpdateObject(Convert.ToString(EditedData._id), IssueUpdate); }
public void Should_Update_Group() { Group group = redmineManager.GetObject <Group>(UPDATED_GROUP_ID, new NameValueCollection { { RedmineKeys.INCLUDE, RedmineKeys.USERS } }); group.Name = UPDATED_GROUP_NAME; group.Users.Add(new GroupUser { Id = UPDATED_GROUP_USER_ID }); redmineManager.UpdateObject <Group>(UPDATED_GROUP_ID, group); Group updatedGroup = redmineManager.GetObject <Group>(UPDATED_GROUP_ID, new NameValueCollection { { RedmineKeys.INCLUDE, RedmineKeys.USERS } }); Assert.IsNotNull(updatedGroup, "Get group returned null."); Assert.AreEqual(updatedGroup.Name, UPDATED_GROUP_NAME, "Group name was not updated."); Assert.IsNotNull(updatedGroup.Users, "Group users list is null."); CollectionAssert.AllItemsAreInstancesOfType(updatedGroup.Users.ToList(), typeof(GroupUser), "Not all items are of type GroupUser."); CollectionAssert.AllItemsAreNotNull(updatedGroup.Users.ToList(), "Users contains null items."); CollectionAssert.AllItemsAreUnique(updatedGroup.Users.ToList(), "Users items are not unique."); Assert.IsTrue(updatedGroup.Users.Find(u => u.Id == UPDATED_GROUP_USER_ID) != null, "User was not added to group."); }
public void RedmineUser_ShouldUpdateUser() { User user = redmineManager.GetObject <User>(userIdToModify, null); user.FirstName = userFirstNameUpdate; redmineManager.UpdateObject <User>(userIdToModify, user); User updatedUser = redmineManager.GetObject <User>(userIdToModify, null); Assert.AreEqual(user.FirstName, updatedUser.FirstName); }
public void Should_Update_User() { User user = redmineManager.GetObject <User>(USER_ID_TO_UPDATE, null); user.FirstName = USER_FIRST_NAME_UPDATED; redmineManager.UpdateObject <User>(USER_ID_TO_UPDATE, user); User updatedUser = redmineManager.GetObject <User>(USER_ID_TO_UPDATE, null); Assert.IsNotNull(updatedUser, "Updated user is null."); Assert.AreEqual(user.FirstName, updatedUser.FirstName, "User first name was not updated."); }
public void RedmineUser_ShouldUpdateUser() { var id = 14; User user = redmineManager.GetObject <User>(id.ToString(), null); user.FirstName = "Ioana M."; redmineManager.UpdateObject <User>(id.ToString(), user); User updatedUser = redmineManager.GetObject <User>(id.ToString(), null); Assert.AreEqual(user.FirstName, updatedUser.FirstName); }
public void RedmineProjectMembership_ShouldUpdate() { var pm = redmineManager.GetObject <ProjectMembership>(updatedPMId, null); pm.Roles.Add(new MembershipRole { Id = updatedPMRoleId }); redmineManager.UpdateObject <ProjectMembership>(updatedPMId, pm); var updatedPM = redmineManager.GetObject <ProjectMembership>(updatedPMId, null); Assert.IsTrue(updatedPM.Roles.Find(r => r.Id == updatedPMRoleId) != null); }
public void RedmineProjectVersion_ShouldUpdateVersion() { Redmine.Net.Api.Types.Version version = redmineManager.GetObject <Redmine.Net.Api.Types.Version>(updatedVersionId, null); version.Name = updatedVersionName; version.Status = updatedVersionStatus; version.Sharing = updatedVersionSharing; version.DueDate = updatedVersionDueDate; version.Description = updatedVersionDescription; redmineManager.UpdateObject <Redmine.Net.Api.Types.Version>(updatedVersionId, version); Redmine.Net.Api.Types.Version updatedVersion = redmineManager.GetObject <Redmine.Net.Api.Types.Version>(updatedVersionId, null); Assert.AreEqual(version.Name, updatedVersion.Name); }
public void RedmineIssueCategories_ShouldUpdateIssueCategory() { IssueCategory issueCategory = redmineManager.GetObject <IssueCategory>(issueCategoryIdToUpdate, null); issueCategory.Name = issueCategoryNameToUpdate; issueCategory.AsignTo = new IdentifiableName { Id = issueCategoryAsigneeIdToUpdate }; redmineManager.UpdateObject <IssueCategory>(issueCategoryIdToUpdate, issueCategory); IssueCategory updatedIssueCategory = redmineManager.GetObject <IssueCategory>(issueCategoryIdToUpdate, null); Assert.AreEqual(issueCategory.Name, updatedIssueCategory.Name); }
public void Should_Update_Version() { Redmine.Net.Api.Types.Version version = redmineManager.GetObject <Redmine.Net.Api.Types.Version>(UPDATED_VERSION_ID, null); version.Name = UPDATED_VERSION_NAME; version.Status = UPDATED_VERSION_STATUS; version.Sharing = UPDATED_VERSION_SHARING; version.DueDate = UPDATED_VERSION_DUE_DATE; version.Description = UPDATED_VERSION_DESCRIPTION; redmineManager.UpdateObject <Redmine.Net.Api.Types.Version>(UPDATED_VERSION_ID, version); Redmine.Net.Api.Types.Version updatedVersion = redmineManager.GetObject <Redmine.Net.Api.Types.Version>(UPDATED_VERSION_ID, null); Assert.IsNotNull(updatedVersion, "Updated version is null."); Assert.AreEqual <Redmine.Net.Api.Types.Version>(version, updatedVersion, "Version was not properly updated."); }
public void RedmineTimeEntries_ShouldUpdate() { var timeEntry = redmineManager.GetObject <TimeEntry>(updatedTimeEntryId, null); timeEntry.Project.Id = updatedTimeEntryProjectId; timeEntry.Issue.Id = updatedTimeEntryIssueId; timeEntry.SpentOn = updatedTimeEntryDate; timeEntry.Hours = updatedTimeEntryHours; timeEntry.Comments = updatedTimeEntryComments; timeEntry.Activity.Id = updatedTimeEntryActivityId; redmineManager.UpdateObject <TimeEntry>(updatedTimeEntryId, timeEntry); var updatedTimeEntry = redmineManager.GetObject <TimeEntry>(updatedTimeEntryId, null); Assert.AreEqual <TimeEntry>(timeEntry, updatedTimeEntry); }
public void RedmineIssueCategories_ShouldUpdateIssueCategory() { var issueCategoryId = "12"; IssueCategory issueCategory = redmineManager.GetObject <IssueCategory>(issueCategoryId, null); issueCategory.Name = "Feature updated"; issueCategory.AsignTo = new IdentifiableName { Id = 2 }; redmineManager.UpdateObject <IssueCategory>(issueCategoryId, issueCategory); IssueCategory updatedIssueCategory = redmineManager.GetObject <IssueCategory>(issueCategoryId, null); Assert.AreEqual(issueCategory.Name, updatedIssueCategory.Name); }
public void RedmineProjectVersion_ShouldUpdateVersion() { var versionId = "12"; Redmine.Net.Api.Types.Version version = redmineManager.GetObject <Redmine.Net.Api.Types.Version>(versionId, null); version.Name = "Updated version"; version.Status = VersionStatus.closed; version.Sharing = VersionSharing.system; version.DueDate = DateTime.Now.AddMonths(1); version.Description = "Updated description"; redmineManager.UpdateObject <Redmine.Net.Api.Types.Version>(versionId, version); Redmine.Net.Api.Types.Version updatedVersion = redmineManager.GetObject <Redmine.Net.Api.Types.Version>(versionId, null); Assert.AreEqual(version.Name, updatedVersion.Name); }
public void Should_Update_IssueCategory() { IssueCategory issueCategory = redmineManager.GetObject <IssueCategory>(ISSUE_CATEGORY_ID_TO_UPDATE, null); issueCategory.Name = ISSUE_CATEGORY_NAME_TO_UPDATE; issueCategory.AsignTo = new IdentifiableName { Id = ISSUE_CATEGORY_ASIGNEE_ID_TO_UPDATE }; redmineManager.UpdateObject <IssueCategory>(ISSUE_CATEGORY_ID_TO_UPDATE, issueCategory); IssueCategory updatedIssueCategory = redmineManager.GetObject <IssueCategory>(ISSUE_CATEGORY_ID_TO_UPDATE, null); Assert.IsNotNull(updatedIssueCategory, "Get updated issue category returned null."); Assert.AreEqual(updatedIssueCategory.Name, ISSUE_CATEGORY_NAME_TO_UPDATE, "Issue category name was not updated."); Assert.IsNotNull(updatedIssueCategory.AsignTo, "Issue category assignee is null."); Assert.AreEqual(updatedIssueCategory.AsignTo.Id, ISSUE_CATEGORY_ASIGNEE_ID_TO_UPDATE, "Issue category asignee was not updated."); }
public void RedmineGroups_ShouldUpdateGroup() { Group group = redmineManager.GetObject <Group>(updatedGroupId, new NameValueCollection { { "include", "users" } }); group.Name = updatedGroupName; group.Users.Add(new GroupUser { Id = updatedGroupUserId }); redmineManager.UpdateObject <Group>(updatedGroupId, group); Group updatedGroup = redmineManager.GetObject <Group>(updatedGroupId, new NameValueCollection { { "include", "users" } }); Assert.IsTrue(updatedGroup.Users.Find(u => u.Id == 2) != null); Assert.AreEqual(group.Name, updatedGroup.Name); }
public void SaveDateToRedmineEmailIssue() { string note = ""; if (EmailSaveIssue != null) { listEmailMessage.Sort(); foreach (EmailMessage emailMessage in listEmailMessage) { note += "*" + emailMessage.Title + "*"; note += "\n"; note += emailMessage.Message; } EmailSaveIssue.Notes = note; redmineManager.UpdateObject(EmailSaveIssue.Id.ToString(), EmailSaveIssue); } }
public void RedmineTimeEntries_ShouldUpdate() { var timeEntryId = "26"; var timeEntry = redmineManager.GetObject <TimeEntry>(timeEntryId, null); timeEntry.Project.Id = 10; timeEntry.Issue.Id = 20; timeEntry.SpentOn = DateTime.Now.AddDays(-2); timeEntry.Hours = 3; timeEntry.Comments = "Time entry updated"; timeEntry.Activity.Id = 17; redmineManager.UpdateObject <TimeEntry>(timeEntryId, timeEntry); var updatedTimeEntry = redmineManager.GetObject <TimeEntry>(timeEntryId, null); Assert.AreEqual <TimeEntry>(timeEntry, updatedTimeEntry); }
public void Should_Update_Project_Membership() { var pm = redmineManager.GetObject <ProjectMembership>(UPDATED_PROJECT_MEMBERSHIP_ID, null); pm.Roles.Add(new MembershipRole { Id = UPDATED_PROJECT_MEMBERSHIP_ROLE_ID }); redmineManager.UpdateObject <ProjectMembership>(UPDATED_PROJECT_MEMBERSHIP_ID, pm); var updatedPM = redmineManager.GetObject <ProjectMembership>(UPDATED_PROJECT_MEMBERSHIP_ID, null); Assert.IsNotNull(updatedPM, "Get updated project membership returned null."); Assert.IsNotNull(updatedPM.Roles, "Project membership roles list is null."); CollectionAssert.AllItemsAreNotNull(updatedPM.Roles, "Project membership roles list contains null items."); CollectionAssert.AllItemsAreUnique(updatedPM.Roles, "Project membership roles items are not unique."); CollectionAssert.AllItemsAreInstancesOfType(updatedPM.Roles, typeof(MembershipRole), "Not all items are of type MembershipRole."); Assert.IsTrue(updatedPM.Roles.Find(r => r.Id == UPDATED_PROJECT_MEMBERSHIP_ROLE_ID) != null, string.Format("Role with id {0} was not found in roles list.", UPDATED_PROJECT_MEMBERSHIP_ROLE_ID)); }
public void Should_Update_Issue() { var issue = redmineManager.GetObject <Issue>(UPDATED_ISSUE_ID, new NameValueCollection { { "include", "children,attachments,relations,changesets,journals,watchers" } }); issue.Subject = UPDATED_ISSUE_SUBJECT; issue.Description = UPDATED_ISSUE_DESCRIPTION; issue.StartDate = updatedIssueStartDate; issue.DueDate = updatedIssueDueDate; issue.Project.Id = UPDATED_ISSUE_PROJECT_ID; issue.Tracker.Id = UPDATED_ISSUE_TRACKER_ID; issue.Priority.Id = UPDATED_ISSUE_PRIORITY_ID; issue.Category.Id = UPDATED_ISSUE_CATEGORY_ID; issue.AssignedTo.Id = UPDATED_ISSUE_ASSIGNED_TO_ID; issue.ParentIssue.Id = UPDATED_ISSUE_PARENT_ISSUE_ID; if (issue.CustomFields != null) { issue.CustomFields.Add(new IssueCustomField { Id = UPDATED_ISSUE_CUSTOM_FIELD_ID, Values = new List <CustomFieldValue> { new CustomFieldValue { Info = UPDATED_ISSUE_CUSTOM_FIELD_VALUE } } }); } issue.EstimatedHours = UPDATED_ISSUE_ESTIMATED_HOURS; issue.Notes = UPDATED_ISSUE_NOTES; issue.PrivateNotes = UPDATED_ISSUE_PRIVATE_NOTES; redmineManager.UpdateObject(UPDATED_ISSUE_ID, issue); var updatedIssue = redmineManager.GetObject <Issue>(UPDATED_ISSUE_ID, new NameValueCollection { { "include", "children,attachments,relations,changesets,journals,watchers" } }); Assert.IsNotNull(updatedIssue, "Updated issue is null."); Assert.AreEqual(issue.Subject, updatedIssue.Subject, "Issue subject is invalid."); }
public void RedmineProjects_ShouldUpdateProject() { var project = redmineManager.GetObject <Project>(updatedProjectIdentifier, new NameValueCollection { { "include", "trackers,issue_categories,enabled_modules" } }); project.Name = updatedProjectName; project.Description = updatedProjectDescription; project.HomePage = updatedProjectHomePage; project.IsPublic = updatedProjectIsPublic; project.Parent = updatedProjectParent; project.InheritMembers = updatedProjectInheritMembers; project.Trackers = updatedProjectTrackers; redmineManager.UpdateObject <Project>(updatedProjectIdentifier, project); var updatedProject = redmineManager.GetObject <Project>(updatedProjectIdentifier, new NameValueCollection { { "include", "trackers,issue_categories,enabled_modules" } }); Assert.AreEqual(project.Name, updatedProject.Name); }
public void RedmineIssues_ShouldUpdateIssue() { var issueId = "75"; var issue = redmineManager.GetObject <Issue>(issueId, new NameValueCollection { { "include", "children,attachments,relations,changesets,journals,watchers" } }); issue.Subject = "Issue updated subject"; issue.Description = null; issue.StartDate = null; issue.DueDate = DateTime.Now.AddDays(10); issue.Project.Id = 10; issue.Tracker.Id = 3; issue.Priority.Id = 9; issue.Category.Id = 10; issue.AssignedTo.Id = 2; issue.ParentIssue.Id = 20; issue.CustomFields.Add(new IssueCustomField { Id = 13, Values = new List <CustomFieldValue> { new CustomFieldValue { Info = "Another custom field completed" } } }); issue.EstimatedHours = 22; issue.Notes = "A lot is changed"; issue.PrivateNotes = true; redmineManager.UpdateObject <Issue>(issueId, issue); var updatedIssue = redmineManager.GetObject <Issue>(issueId, new NameValueCollection { { "include", "children,attachments,relations,changesets,journals,watchers" } }); Assert.AreEqual(issue.Subject, issue.Subject); }
public void Should_Update_Project() { var project = redmineManager.GetObject <Project>(UPDATED_PROJECT_IDENTIFIER, new NameValueCollection { { RedmineKeys.INCLUDE, RedmineKeys.TRACKERS + "," + RedmineKeys.ISSUE_CATEGORIES + "," + RedmineKeys.ENABLED_MODULES } }); project.Name = UPDATED_PROJECT_NAME; project.Description = UPDATED_PROJECT_DESCRIPTION; project.HomePage = UPDATED_PROJECT_HOMEPAGE; project.IsPublic = UPDATED_PROJECT_ISPUBLIC; project.Parent = UPDATED_PROJECT_PARENT; project.InheritMembers = UPDATED_PROJECT_INHERIT_MEMBERS; project.Trackers = UPDATED_PROJECT_TRACKERS; redmineManager.UpdateObject <Project>(UPDATED_PROJECT_IDENTIFIER, project); var updatedProject = redmineManager.GetObject <Project>(UPDATED_PROJECT_IDENTIFIER, new NameValueCollection { { RedmineKeys.INCLUDE, RedmineKeys.TRACKERS + "," + RedmineKeys.ISSUE_CATEGORIES + "," + RedmineKeys.ENABLED_MODULES } }); Assert.IsNotNull(updatedProject, "Updated project is null."); Assert.AreEqual(updatedProject.Name, UPDATED_PROJECT_NAME, "Project name was not updated."); }
public void Should_Update_Time_Entry() { var timeEntry = redmineManager.GetObject <TimeEntry>(UPDATED_TIME_ENTRY_ID, null); timeEntry.Project.Id = UPDATED_TIME_ENTRY_PROJECT_ID; timeEntry.Issue.Id = UPDATED_TIME_ENTRY_ISSUE_ID; timeEntry.SpentOn = UPDATED_TIME_ENTRY_DATE; timeEntry.Hours = UPDATED_TIME_ENTRY_HOURS; timeEntry.Comments = UPDATED_TIME_ENTRY_COMMENTS; if (timeEntry.Activity == null) { timeEntry.Activity = new IdentifiableName(); } timeEntry.Activity.Id = UPDATED_TIME_ENTRY_ACTIVITY_ID; redmineManager.UpdateObject <TimeEntry>(UPDATED_TIME_ENTRY_ID, timeEntry); var updatedTimeEntry = redmineManager.GetObject <TimeEntry>(UPDATED_TIME_ENTRY_ID, null); Assert.IsNotNull(updatedTimeEntry, "Updated time entry is null."); Assert.AreEqual <TimeEntry>(timeEntry, updatedTimeEntry, "Time entry was not properly updated."); }
public void RedmineIssues_ShouldUpdateIssue() { var issue = redmineManager.GetObject <Issue>(updatedIssueId, new NameValueCollection { { "include", "children,attachments,relations,changesets,journals,watchers" } }); issue.Subject = updatedIssueSubject; issue.Description = updatedIssueDescription; issue.StartDate = updatedIssueStartDate; issue.DueDate = updatedIssueDueDate; issue.Project.Id = updatedIssueProjectId; issue.Tracker.Id = updatedIssueTrackerId; issue.Priority.Id = updatedIssuePriorityId; issue.Category.Id = updatedIssueCategoryId; issue.AssignedTo.Id = updatedIssueAssignedToId; issue.ParentIssue.Id = updatedIssueParentIssueId; issue.CustomFields.Add(new IssueCustomField { Id = updatedIssueCustomFieldId, Values = new List <CustomFieldValue> { new CustomFieldValue { Info = updatedIssueCustomFieldValue } } }); issue.EstimatedHours = updatedIssueEstimatedHours; issue.Notes = updatedIssueNotes; issue.PrivateNotes = updatedIssuePrivateNotes; redmineManager.UpdateObject <Issue>(updatedIssueId, issue); var updatedIssue = redmineManager.GetObject <Issue>(updatedIssueId, new NameValueCollection { { "include", "children,attachments,relations,changesets,journals,watchers" } }); Assert.AreEqual(issue.Subject, updatedIssue.Subject); }
public void RedmineProjects_ShouldUpdateProject() { var projectId = "redmine-net-testxyz"; var project = redmineManager.GetObject <Project>(projectId, new NameValueCollection { { "include", "trackers,issue_categories,enabled_modules" } }); project.Name = "Project created using API updated"; project.Description = "Test project description updated"; project.HomePage = "http://redmineTestsUpdated.ro"; project.IsPublic = true; project.Parent = null; project.InheritMembers = false; project.Trackers = null; redmineManager.UpdateObject <Project>(projectId, project); var updatedProject = redmineManager.GetObject <Project>(projectId, new NameValueCollection { { "include", "trackers,issue_categories,enabled_modules" } }); Assert.AreEqual(project.Name, updatedProject.Name); }
/// <summary> /// Updates the object asynchronous. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="redmineManager">The redmine manager.</param> /// <param name="id">The identifier.</param> /// <param name="entity">The object.</param> /// <param name="projectId">The project identifier.</param> /// <returns></returns> public static Task UpdateObjectAsync <T>(this RedmineManager redmineManager, string id, T entity, string projectId = null) where T : class, new() { return(Task.Factory.StartNew(() => redmineManager.UpdateObject(id, entity, projectId), CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default)); }
/// <summary> /// Updates the object asynchronous. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="redmineManager">The redmine manager.</param> /// <param name="id">The identifier.</param> /// <param name="entity">The object.</param> /// <param name="projectId">The project identifier.</param> /// <returns></returns> public static Task UpdateObjectAsync <T>(this RedmineManager redmineManager, string id, T entity, string projectId = null) where T : class, new() { return(delegate { redmineManager.UpdateObject(id, entity, projectId); }); }
/// <summary> /// Updates the object asynchronous. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="redmineManager">The redmine manager.</param> /// <param name="id">The identifier.</param> /// <param name="obj">The object.</param> /// <param name="projectId">The project identifier.</param> /// <returns></returns> public static Task UpdateObjectAsync <T>(this RedmineManager redmineManager, string id, T obj, string projectId = null) where T : class, new() { return(Task.Factory.StartNew(() => redmineManager.UpdateObject(id, obj, projectId), TaskCreationOptions.LongRunning)); }