public void RedmineUser_CreateUser_ShouldReturnInvalidEntity() { User redmineUser = new User(); try { redmineManager.CreateObject <User>(redmineUser); } catch (RedmineException exc) { StringAssert.Contains(exc.Message, "invalid or missing attribute parameters"); return; } Assert.Fail("No exception was thrown."); }
public void RedmineProjects_ShouldCreateProject() { Project project = new Project(); project.Name = "Project created using API"; project.Identifier = "redmine-net-testxyz"; project.Description = "Test project description"; project.HomePage = "http://RedmineTests.ro"; project.IsPublic = true; project.Parent = new IdentifiableName { Id = 9 }; project.InheritMembers = true; project.Trackers = new List <ProjectTracker> { new ProjectTracker { Id = 3 } }; project.EnabledModules = new List <ProjectEnabledModule>(); project.EnabledModules.Add(new ProjectEnabledModule { Name = "news" }); project.EnabledModules.Add(new ProjectEnabledModule { Name = "issue_tracking" }); Project savedProject = redmineManager.CreateObject <Project>(project); Assert.AreEqual(project.Name, savedProject.Name); }
public void Should_Create_Time_Entry() { TimeEntry timeEntry = new TimeEntry(); timeEntry.Issue = new IdentifiableName { Id = NEW_TIME_ENTRY_ISSUE_ID }; timeEntry.Project = new IdentifiableName { Id = NEW_TIME_ENTRY_PROJECT_ID }; timeEntry.SpentOn = NEW_TIME_ENTRY_DATE; timeEntry.Hours = NEW_TIME_ENTRY_HOURS; timeEntry.Activity = new IdentifiableName { Id = NEW_TIME_ENTRY_ACTIVITY_ID }; timeEntry.Comments = NEW_TIME_ENTRY_COMMENTS; TimeEntry savedTimeEntry = redmineManager.CreateObject <TimeEntry>(timeEntry); Assert.IsNotNull(savedTimeEntry, "Create time entry returned null."); Assert.IsNotNull(savedTimeEntry.Issue, "Saved time entry issue is null."); Assert.AreEqual(savedTimeEntry.Issue.Id, NEW_TIME_ENTRY_ISSUE_ID, "Issue id is invalid."); Assert.IsNotNull(savedTimeEntry.Project, "Saved time entry project is null."); Assert.AreEqual(savedTimeEntry.Project.Id, NEW_TIME_ENTRY_PROJECT_ID, "Project id is invalid."); Assert.IsNotNull(savedTimeEntry.SpentOn, "Saved time entry date is null."); Assert.AreEqual(savedTimeEntry.SpentOn.Value.Date, NEW_TIME_ENTRY_DATE.Date, "Date is invalid."); Assert.IsNotNull(savedTimeEntry.Hours, "Saved time entry hours is null."); Assert.AreEqual(savedTimeEntry.Hours, NEW_TIME_ENTRY_HOURS, "Hours value is not valid."); Assert.IsNotNull(savedTimeEntry.Activity, "Saved time entry activity is null."); Assert.AreEqual(savedTimeEntry.Activity.Id, NEW_TIME_ENTRY_ACTIVITY_ID, "Activity id is invalid."); Assert.IsNotNull(savedTimeEntry.Comments, "Saved time entry comment is null."); Assert.AreEqual(savedTimeEntry.Comments, NEW_TIME_ENTRY_COMMENTS, "Coments value is invalid."); }
public void RedmineProjects_ShouldCreateProject() { Project project = new Project(); project.Name = newProjectName; project.Identifier = newProjectIdentifier; project.Description = newProjectDescription; project.HomePage = newProjectHomePage; project.IsPublic = newProjectIsPublic; project.Parent = new IdentifiableName { Id = newProjectParentId }; project.InheritMembers = newProjectInheritMembers; project.Trackers = new List <ProjectTracker> { new ProjectTracker { Id = newProjectTrackerId } }; project.EnabledModules = new List <ProjectEnabledModule>(); project.EnabledModules.Add(new ProjectEnabledModule { Name = newProjectEnableModuleName }); Project savedProject = redmineManager.CreateObject <Project>(project); Assert.AreEqual(project.Name, savedProject.Name); }
public void RedmineGroups_ShouldAddGroup() { Group group = new Group(); group.Name = "Developers"; group.Users = new List <GroupUser>(); group.Users.Add(new GroupUser { Id = 8 }); Group savedGroup = null; try { savedGroup = redmineManager.CreateObject <Group>(group); } catch (RedmineException) { Assert.Fail("Create group failed."); return; } Assert.IsNotNull(savedGroup); Assert.AreEqual(group.Name, savedGroup.Name); }
public void Should_Add_Group() { Group group = new Group(); group.Name = NEW_GROUP_NAME; group.Users = new List <GroupUser>(); group.Users.Add(new GroupUser { Id = NEW_GROUP_USER_ID }); Group savedGroup = null; try { savedGroup = redmineManager.CreateObject <Group>(group); } catch (RedmineException) { Assert.Fail("Create group failed."); return; } Assert.IsNotNull(savedGroup, "Create group returned null."); Assert.AreEqual(group.Name, savedGroup.Name, "Saved group name is not valid."); }
public bool Create() { try { RedmineManager manager = new RedmineManager(Configuration.RedmineHost, Configuration.RedmineUser, Configuration.RedminePassword); //Create a issue. var newIssue = new Issue { Subject = Title, Description = Description, Project = new IdentifiableName() { Id = ProjectId }, Tracker = new IdentifiableName() { Id = TrackerId } }; User thisuser = (from u in manager.GetObjectList<User>(new System.Collections.Specialized.NameValueCollection()) where u.Login == Configuration.RedmineUser select u).FirstOrDefault(); if (thisuser != null) newIssue.AssignedTo = new IdentifiableName() { Id = thisuser.Id }; manager.CreateObject(newIssue); } catch { return false; } return true; }
public void submitTime(TimeEvent te) { _timeevents.Add(te); /*if(te.Issue.SpentHours != null) * { * te.Issue.SpentHours = te.Issue.SpentHours + (float)Math.Round((decimal)te.Timespan.TotalHours, 2); * } else * { * te.Issue.SpentHours = (float)Math.Round((float)te.Timespan.TotalHours, 2); * } */ TimeEntry timeentry = new TimeEntry(); timeentry.Hours = Math.Round((decimal)te.Timespan.TotalHours, 2); timeentry.Project = new IdentifiableName { Id = te.Issue.Project.Id }; timeentry.Activity = new IdentifiableName { Id = te.Activity }; timeentry.Comments = te.Comment; timeentry.Issue = new IdentifiableName { Id = te.Issue.Id }; //manager. try { manager.CreateObject(timeentry); //manager.UpdateObject(timeentry.Id.ToString(), (TimeEntry)timeentry); } catch (RedmineException e) { Console.WriteLine(e.Message); } }
public void Should_Create_Projects() { Project project = new Project(); project.Name = NEW_PROJECT_NAME; project.Identifier = NEW_PROJECT_IDENTIFIER; project.Description = NEW_PROJECT_DESCRIPTION; project.HomePage = NEW_PROJECT_HOMEPAGE; project.IsPublic = NEW_PROJECT_ISPUBLIC; project.Parent = new IdentifiableName { Id = NEW_PROJECT_PARENT_ID }; project.InheritMembers = NEW_PROJECT_INHERIT_MEMBERS; project.Trackers = new List <ProjectTracker> { new ProjectTracker { Id = NEW_PROJECT_TRACKER_ID } }; project.EnabledModules = new List <ProjectEnabledModule>(); project.EnabledModules.Add(new ProjectEnabledModule { Name = NEW_PROJECT_ENABLED_MODULE_NAME }); Project savedProject = redmineManager.CreateObject <Project>(project); Assert.IsNotNull(savedProject, "Create project returned null."); Assert.AreEqual(savedProject.Identifier, NEW_PROJECT_IDENTIFIER, "Project identifier is invalid."); }
public void RedmineIssues_ShouldCreateIssue() { Issue issue = new Issue(); issue.Project = new Project { Id = 10 }; issue.Tracker = new IdentifiableName { Id = 4 }; issue.Status = new IdentifiableName { Id = 5 }; issue.Priority = new IdentifiableName { Id = 8 }; issue.Subject = "Issue created using Rest API"; issue.Description = "Issue description..."; issue.Category = new IdentifiableName { Id = 11 }; issue.FixedVersion = new IdentifiableName { Id = 9 }; issue.AssignedTo = new IdentifiableName { Id = 8 }; issue.ParentIssue = new IdentifiableName { Id = 19 }; issue.CustomFields = new List <IssueCustomField>(); issue.CustomFields.Add(new IssueCustomField { Id = 13, Values = new List <CustomFieldValue> { new CustomFieldValue { Info = "Issue custom field completed" } } }); issue.IsPrivate = true; issue.EstimatedHours = 12; issue.StartDate = DateTime.Now; issue.DueDate = DateTime.Now.AddMonths(1); issue.Watchers = new List <Watcher>(); issue.Watchers.Add(new Watcher { Id = 8 }); issue.Watchers.Add(new Watcher { Id = 2 }); Issue savedIssue = redmineManager.CreateObject <Issue>(issue); Assert.AreEqual(issue.Subject, savedIssue.Subject); }
public void RedmineIssues_ShouldCreateIssue() { Issue issue = new Issue(); issue.Project = new Project { Id = newIssueProjectId }; issue.Tracker = new IdentifiableName { Id = newIssueTrackerId }; issue.Status = new IdentifiableName { Id = newIssueStatusId }; issue.Priority = new IdentifiableName { Id = newIssuePriorityId }; issue.Subject = newIssueSubject; issue.Description = newIssueDescription; issue.Category = new IdentifiableName { Id = newIssueCategoryId }; issue.FixedVersion = new IdentifiableName { Id = newIssueFixedVersionId }; issue.AssignedTo = new IdentifiableName { Id = newIssueAssignedToId }; issue.ParentIssue = new IdentifiableName { Id = newIssueParentIssueId }; issue.CustomFields = new List <IssueCustomField>(); issue.CustomFields.Add(new IssueCustomField { Id = newIssueCustomFieldId, Values = new List <CustomFieldValue> { new CustomFieldValue { Info = newIssueCustomFieldValue } } }); issue.IsPrivate = newIssueIsPrivate; issue.EstimatedHours = newIssueEstimatedHours; issue.StartDate = newIssueStartDate; issue.DueDate = newIssueDueDate; issue.Watchers = new List <Watcher>(); issue.Watchers.Add(new Watcher { Id = newIssueFirstWatcherId }); issue.Watchers.Add(new Watcher { Id = newIssueSecondWatcherId }); Issue savedIssue = redmineManager.CreateObject <Issue>(issue); Assert.AreEqual(issue.Subject, savedIssue.Subject); }
private static void OpenTicket(string dump, DumpData res, Configuration configuration) { OwnershipData ownershipData = configuration.Owners.FirstOrDefault(o => o.Filter == res.FilterOfInterest); Owner assignee = configuration.DefaultOwner; if (ownershipData != null) { assignee = ownershipData.Owner; } var author = new IdentifiableName { Id = _redmineManager.GetCurrentUser().Id }; IdentifiableName assignedTo = _projectMembers.SingleOrDefault(pm => pm != null && pm.Name == assignee.Name) ?? _projectMembers.SingleOrDefault(pm => pm != null && pm.Name == configuration.DefaultOwner.Name); if (assignedTo == null) { // TODO: do something about this? } string subject = "Unexpected exception occurred"; string description = string.Format("Please investigate a dump located at {0}.{1}{2}Here's the beginning of the call stack for the last event:{3}{4}", dump, Environment.NewLine, Environment.NewLine, Environment.NewLine, string.Join(Environment.NewLine, res.CallStack.Take(Math.Min(res.CallStack.Count, 30)))); if (res.FrameOfInterest != null) { subject = string.Format("A problem occurred in {0}.{1}: {2}", res.FrameOfInterest.ModuleName, res.FrameOfInterest.MethodName, res.LastEvent.Description); description = string.Format("There was a problem in {0}: {1}.{2}Please investigate a dump located at {3}.{4}{5}Here's the call stack for the last event:{6}{7}", res.FrameOfInterest.ModuleName, res.LastEvent, Environment.NewLine, dump, Environment.NewLine, Environment.NewLine, Environment.NewLine, string.Join(Environment.NewLine, res.CallStack.Take(Math.Min(res.CallStack.Count, 30)))); } var issue = new Issue { Subject = subject.Substring(0, Math.Min(subject.Length, 255)), Description = description, AssignedTo = assignedTo, Author = author, Project = new IdentifiableName { Id = _project.Id }, }; _redmineManager.CreateObject(issue); }
public void RedmineIssueRelation_ShouldAddRelation() { IssueRelation relation = new IssueRelation(); relation.IssueToId = relatedIssueId; relation.Type = relationType; relation.Delay = relationDelay; IssueRelation savedRelation = redmineManager.CreateObject <IssueRelation>(relation, issueId); Assert.Inconclusive(); }
public void RedmineIssueRelation_ShouldAddRelation() { IssueRelation relation = new IssueRelation(); relation.IssueToId = 18; relation.Type = IssueRelationType.follows; relation.Delay = 2; IssueRelation savedRelation = redmineManager.CreateObject <IssueRelation>(relation, "19"); Assert.Inconclusive(); }
public void RedmineIssueCategories_ShouldCreateIssueCategory() { IssueCategory issueCategory = new IssueCategory(); issueCategory.Name = "Feature"; issueCategory.AsignTo = new IdentifiableName { Id = 8 }; IssueCategory savedIssueCategory = redmineManager.CreateObject <IssueCategory>(issueCategory, "9"); Assert.AreEqual(issueCategory.Name, savedIssueCategory.Name); }
public void RedmineProjectVersion_ShouldCreateNewVersion() { Redmine.Net.Api.Types.Version version = new Redmine.Net.Api.Types.Version(); version.Name = "Test version"; version.Status = VersionStatus.locked; version.Sharing = VersionSharing.hierarchy; version.DueDate = DateTime.Now.AddDays(7); version.Description = "Version description"; Redmine.Net.Api.Types.Version savedVersion = redmineManager.CreateObject <Redmine.Net.Api.Types.Version>(version, "6"); Assert.AreEqual(version.Name, savedVersion.Name); }
public void RedmineProjectVersion_ShouldCreateNewVersion() { Redmine.Net.Api.Types.Version version = new Redmine.Net.Api.Types.Version(); version.Name = newVersionName; version.Status = newVersionStatus; version.Sharing = newVersionSharing; version.DueDate = newVersionDueDate; version.Description = newVersionDescription; Redmine.Net.Api.Types.Version savedVersion = redmineManager.CreateObject <Redmine.Net.Api.Types.Version>(version, projectId); Assert.AreEqual(version.Name, savedVersion.Name); }
private void btnAddTask_Click(object sender, EventArgs e) { var newIssue = new Issue { Subject = "Добавление из моей формы", Project = new IdentifiableName { Id = 1 }, Description = "srgsrg" }; manager.CreateObject(newIssue); }
public void RedmineIssueCategories_ShouldCreateIssueCategory() { IssueCategory issueCategory = new IssueCategory(); issueCategory.Name = newIssueCategoryName; issueCategory.AsignTo = new IdentifiableName { Id = newIssueCategoryAsigneeId }; IssueCategory savedIssueCategory = redmineManager.CreateObject <IssueCategory>(issueCategory, projectId); Assert.AreEqual(issueCategory.Name, savedIssueCategory.Name); }
static void Main() { //Application.EnableVisualStyles(); //Application.SetCompatibleTextRenderingDefault(false); //Application.Run(new FormTest()); string host = "http://redmine.binhanh.com.vn:89/redmine"; string apiKey = "buVJbgHAfzFtfDpyQVuo"; var manager = new RedmineManager(host, "admin", "admin^CMt3,$Dq>%:@GN/"); var parameters = new NameValueCollection { { "status_id", "*" } }; foreach (var issue in manager.GetObjectList <Issue>(parameters)) { Console.WriteLine("#{0}: {1}", issue.Id, issue.Subject); } var parameters_custom_fields = new NameValueCollection { { "custom_field", "*" } }; foreach (var issue in manager.GetObjectList <CustomField>(parameters_custom_fields)) { Console.WriteLine("#{0}: {1}", issue.Id, issue.Values); } //List customFieldsList = mgr.getIssues(projectKey, queryId).get(0).getCustomFields(); //for (CustomField customField in manager.) //{ // System.out.println(customField.getName()); // if (customField.getName().equalsIgnoreCase("MyDate")) // { // customField.setValue("2012-08-02"); // } //} // CustomField ThuocNhom = new CustomField(); //ThuocNhom. //Create a issue. var newIssue = new Issue { Subject = "test", Project = new IdentifiableName { Id = 1 } }; manager.CreateObject(newIssue); }
public void Should_Create_IssueCategory() { IssueCategory issueCategory = new IssueCategory(); issueCategory.Name = NEW_ISSUE_CATEGORY_NAME; issueCategory.AsignTo = new IdentifiableName { Id = NEW_ISSUE_CATEGORY_ASIGNEE_ID }; IssueCategory savedIssueCategory = redmineManager.CreateObject <IssueCategory>(issueCategory, PROJECT_ID); Assert.IsNotNull(savedIssueCategory, "Create issue category returned null."); Assert.AreEqual(savedIssueCategory.Name, NEW_ISSUE_CATEGORY_NAME, "Saved issue category name is invalid."); }
public static void CommitTime(int Id, string CommentText, int Activity, DateTime SpentOn, DataStructureClass.DataStructure IssueData) { Console.WriteLine(DateTime.Now + ": ServerClass.CommitTime"); TimeEntry entry = new TimeEntry() { Comments = CommentText, Activity = new IdentifiableName { Id = Activity }, Hours = (decimal)IssueData._notCommittedWorkingTime / 3600, SpentOn = SpentOn, Issue = new IdentifiableName { Id = IssueData._id }, Project = new IdentifiableName { Id = IssueData._projectId }, User = new IdentifiableName { Id = IssueData._assignedToId } }; redmine.CreateObject(entry); }
public void Should_Add_Issue_Relation() { IssueRelation relation = new IssueRelation(); relation.IssueToId = RELATED_ISSUE_ID; relation.Type = RELATION_TYPE; relation.Delay = RELATION_DELAY; IssueRelation savedRelation = redmineManager.CreateObject <IssueRelation>(relation, ISSUE_ID); Assert.IsNotNull(savedRelation, "Create issue relation returned null."); Assert.AreEqual(savedRelation.IssueId, RELATED_ISSUE_ID, "Related issue id is not valid."); Assert.AreEqual(savedRelation.IssueToId.ToString(), ISSUE_ID, "Issue id is not valid."); Assert.AreEqual(savedRelation.Delay, RELATION_DELAY, "Delay is not valid."); Assert.AreEqual(savedRelation.Type, OPPOSED_RELATION_TYPE, "Relation type is not valid."); }
public void RedmineProjectMembership_ShouldAdd() { ProjectMembership pm = new ProjectMembership(); pm.User = new IdentifiableName { Id = 17 }; pm.Roles = new List <MembershipRole>(); pm.Roles.Add(new MembershipRole { Id = 4 }); ProjectMembership updatedPM = redmineManager.CreateObject <ProjectMembership>(pm, "9"); Assert.IsNotNull(updatedPM); }
internal void AddTask() { try { Outlook.TaskItem newTaskItem = (Outlook.TaskItem) this.Application.CreateItem(Outlook.OlItemType.olTaskItem); newTaskItem.StartDate = DateTime.Now.AddHours(2); newTaskItem.Body = "Try to create a task"; //Create a issue. newTaskItem.Save(); newTaskItem.Display("True"); var newIssue = new Issue { Subject = newTaskItem.Subject, Project = new IdentifiableName { Id = 1 }, Description = newTaskItem.Body, StartDate = newTaskItem.StartDate, DueDate = newTaskItem.DueDate, }; manager.CreateObject(newIssue); string str = string.Empty; manager.GetObjectList <Issue>(new NameValueCollection()); foreach (var item in manager.GetObjectList <Issue>(new NameValueCollection())) { str += item.Description + $"{Environment.NewLine}"; } string task_list = string.Empty; MessageBox.Show(manager.ToString() + $"{Environment.NewLine}" + str); } catch (System.Exception ex) { MessageBox.Show("The following error occurred: " + ex.Message); throw; } }
public void Should_Add_Project_Membership() { ProjectMembership pm = new ProjectMembership(); pm.User = new IdentifiableName { Id = NEW_PROJECT_MEMBERSHIP_USER_ID }; pm.Roles = new List <MembershipRole>(); pm.Roles.Add(new MembershipRole { Id = NEW_PROJECT_MEMBERSHIP_ROLE_ID }); ProjectMembership createdPM = redmineManager.CreateObject <ProjectMembership>(pm, PROJECT_IDENTIFIER); Assert.IsNotNull(createdPM, "Project membership is null."); Assert.AreEqual(createdPM.User.Id, NEW_PROJECT_MEMBERSHIP_USER_ID, "User is invalid."); Assert.IsNotNull(createdPM.Roles, "Project membership roles list is null."); Assert.IsTrue(createdPM.Roles.Exists(r => r.Id == NEW_PROJECT_MEMBERSHIP_ROLE_ID), string.Format("Role id {0} does not exist.", NEW_PROJECT_MEMBERSHIP_ROLE_ID)); }
public void Should_Upload_Attachment() { //read document from specified path byte[] documentData = File.ReadAllBytes(ATTACHMENT_LOCAL_PATH); //upload attachment to redmine Upload attachment = redmineManager.UploadFile(documentData); //set attachment properties attachment.FileName = ATTACHMENT_NAME; attachment.Description = ATTACHMENT_DESCRIPTION; attachment.ContentType = ATTACHMENT_CONTENT_TYPE; //create list of attachments to be added to issue IList <Upload> attachments = new List <Upload>(); attachments.Add(attachment); Issue issue = new Issue(); issue.Project = new Project { Id = PROJECT_ID }; issue.Subject = ISSUE_SUBJECT; issue.Uploads = attachments; //create issue and attach document Issue issueWithAttachment = redmineManager.CreateObject <Issue>(issue); issue = redmineManager.GetObject <Issue>(issueWithAttachment.Id.ToString(), new NameValueCollection { { RedmineKeys.INCLUDE, RedmineKeys.ATTACHMENTS } }); Assert.IsNotNull(issue, "Get created issue returned null."); Assert.IsNotNull(issue.Attachments, "Attachments list is null."); CollectionAssert.AllItemsAreNotNull(issue.Attachments.ToList(), "Attachments list contains null items."); CollectionAssert.AllItemsAreInstancesOfType(issue.Attachments.ToList(), typeof(Attachment), "Attachments contains items of unexpected type."); Assert.IsTrue(issue.Attachments.Count == 1, "Number of attachments != 1"); Assert.IsTrue(issue.Attachments[0].FileName == ATTACHMENT_NAME, "Attachment name is not correct."); Assert.IsTrue(issue.Attachments[0].Description == ATTACHMENT_DESCRIPTION, "Attachment description is not correct."); Assert.IsTrue(issue.Attachments[0].ContentType == ATTACHMENT_CONTENT_TYPE, "Attachment content type is not correct."); }
public void Should_Create_Version() { Redmine.Net.Api.Types.Version version = new Redmine.Net.Api.Types.Version(); version.Name = NEW_VERSION_NAME; version.Status = NEW_VERSION_STATUS; version.Sharing = NEW_VERSION_SHARING; version.DueDate = NEW_VERSION_DUE_DATE; version.Description = NEW_VERSION_DESCRIPTION; Redmine.Net.Api.Types.Version savedVersion = redmineManager.CreateObject <Redmine.Net.Api.Types.Version>(version, PROJECT_ID); Assert.IsNotNull(savedVersion, "Create version returned null."); Assert.IsNotNull(savedVersion.Project, "Project is null."); Assert.AreEqual(savedVersion.Name, NEW_VERSION_NAME, "Version name is invalid."); Assert.AreEqual(savedVersion.Status, NEW_VERSION_STATUS, "Version status is invalid."); Assert.AreEqual(savedVersion.Sharing, NEW_VERSION_SHARING, "Version sharing is invalid."); Assert.IsNotNull(savedVersion.DueDate, "Due date is null."); Assert.AreEqual(savedVersion.DueDate.Value.Date, NEW_VERSION_DUE_DATE.Date, "Version due date is invalid."); Assert.AreEqual(savedVersion.Description, NEW_VERSION_DESCRIPTION, "Version description is invalid."); }
public void RedmineTimeEntries_ShouldAdd() { TimeEntry timeEntry = new TimeEntry(); timeEntry.Issue = new IdentifiableName { Id = newTimeEntryIssueId }; timeEntry.Project = new IdentifiableName { Id = newTimeEntryProjectId }; timeEntry.SpentOn = newTimeEntryDate; timeEntry.Hours = newTimeEntryHours; timeEntry.Activity = new IdentifiableName { Id = newTimeEntryActivityId }; timeEntry.Comments = newTimeEntryComments; TimeEntry savedTimeEntry = redmineManager.CreateObject <TimeEntry>(timeEntry); Assert.AreEqual(timeEntry.Comments, savedTimeEntry.Comments); }
public void RedmineTimeEntries_ShouldAdd() { TimeEntry timeEntry = new TimeEntry(); timeEntry.Issue = new IdentifiableName { Id = 19 }; timeEntry.Project = new IdentifiableName { Id = 10 }; timeEntry.SpentOn = DateTime.Now; timeEntry.Hours = 1; timeEntry.Activity = new IdentifiableName { Id = 16 }; timeEntry.Comments = "Added time entry on project"; TimeEntry savedTimeEntry = redmineManager.CreateObject <TimeEntry>(timeEntry); Assert.AreEqual(timeEntry.Comments, savedTimeEntry.Comments); }
public bool Create() { try { RedmineManager manager = new RedmineManager(Configuration.RedmineHost, Configuration.RedmineUser, Configuration.RedminePassword); //Create a issue. var newIssue = new Issue { Subject = Title, Description = Description, Project = new IdentifiableName() { Id = ProjectId }, Tracker = new IdentifiableName() { Id = TrackerId } }; User thisuser = (from u in manager.GetObjectList <User>(new System.Collections.Specialized.NameValueCollection()) where u.Login == Configuration.RedmineUser select u).FirstOrDefault(); if (thisuser != null) { newIssue.AssignedTo = new IdentifiableName() { Id = thisuser.Id } } ; manager.CreateObject(newIssue); } catch { return(false); } return(true); }