private void FormBug(ProjectDTO project) { bugDTO = new BugDTO { Name = textBoxBugName.Text, Description = textBoxBugDescription.Text.Replace("\r\n", "<br/>"), ProjectID = project.ID }; var severity = GetByName(severities, comboBoxSeverity.SelectedItemText); if (severity != null) { bugDTO.SeverityID = severity.ID; } var priority = GetByName(priorities, comboBoxPriority.SelectedItemText); if (priority != null) { bugDTO.PriorityID = priority.ID; } var story = GetByName(Stories, comboBoxUserStory.SelectedItemText); if (story != null) { bugDTO.UserStoryID = story.ID; } bugDTO.Effort = 0; }
public HttpResponseMessage Post(BugDTO dto, string comments = null) { Bug bug; if (dto.Id != 0) { bug = _bugsRepository.Get(dto.Id); if (bug == null) { return(new HttpResponseMessage(HttpStatusCode.NotFound)); } bug.Approve(); return(Request.CreateResponse(HttpStatusCode.OK, BugModel.Collection(GetBacklogBugDtos()))); } bug = Mapper.Map <BugDTO, Bug>(dto); bug.Approve(); _bugsRepository.Add(bug); var response = Request.CreateResponse(HttpStatusCode.Created, BugModel.Collection(GetBacklogBugDtos())); //i still don't like this because it's fragmenting management of my links response.Headers.Location = new Uri(HostUriFromRequest(Request), bug.Id.ToString(CultureInfo.InvariantCulture)); return(response); }
public HttpResponseMessage <IEnumerable <BugDTO> > Post(BugDTO dto, string comments) { Bug bug; if (dto.Id != 0) { bug = _bugsRepository.Get(dto.Id); if (bug == null) { throw new HttpResponseException(HttpStatusCode.NotFound); } bug.Approve(); return(new HttpResponseMessage <IEnumerable <BugDTO> >(GetBacklogBugDtos())); } bug = Mapper.Map <BugDTO, Bug>(dto); bug.Approve(); _bugsRepository.Add(bug); var response = new HttpResponseMessage <IEnumerable <BugDTO> >(GetBacklogBugDtos(), HttpStatusCode.Created); //i still don't like this because it's fragmenting management of my links response.Headers.Location = new Uri(HostUriFromRequest(Request), bug.Id.ToString()); return(response); }
public void AssignDeveloper(string userLogin, string bugName) { BugDTO bug = Context.TpBugs.Single(b => b.Name == bugName); RoleDTO developerRole = Context.Roles.Single(r => r.Name == "Developer"); UserDTO user = Context.Users.Single(u => u.Login == userLogin); var existingDeveloperTeam = Context.TpTeams.Where(t => t.AssignableID == bug.ID) .Where(t => t.RoleID == developerRole.ID) .Single(); TransportMock.HandleMessageFromTp(new TeamCreatedMessage { Dto = new TeamDTO { ID = Context.GetNextId(), AssignableID = bug.ID, RoleID = developerRole.ID, RoleName = developerRole.Name, UserID = user.ID } }); existingDeveloperTeam.RoleName = developerRole.Name; TransportMock.HandleMessageFromTp(new TeamDeletedMessage { Dto = existingDeveloperTeam }); }
public override void Update() { BugDTO bug = BugService.GetByID(this.BugId); bug.Name = this.EntityName; bug.ProjectID = this.ProjectId; if (IsDescriptionSet) { bug.Description = this.Description; } if (!String.IsNullOrEmpty(this.UserStory) || IsUserStoryIdSet) { bug.UserStoryID = this.UserStoryId; } if (!String.IsNullOrEmpty(this.State)) { bug.EntityStateID = this.StateId; } BugService.Update(bug); foreach (TargetProcessUser user in this.UsersToAssign) { BugService.AssignUser(bug.BugID.Value, user.GetId()); } }
public override void Create() { BugDTO bug = new BugDTO { Name = this.EntityName, ProjectID = this.ProjectId }; if (!String.IsNullOrEmpty(this.UserStory) || IsUserStoryIdSet) { bug.UserStoryID = this.UserStoryId; } if (IsDescriptionSet) { bug.Description = this.Description; } if (!String.IsNullOrEmpty(this.State)) { bug.EntityStateID = this.StateId; } int taskId = BugService.Create(bug); foreach (TargetProcessUser user in this.UsersToAssign) { BugService.AssignUser(taskId, user.GetId()); } }
public void ShouldConvertToCreateMessageCorrectly() { var bugDto = new BugDTO { Name = "Name" }; ObjectFactory.GetInstance <ITpBus>().Send(new CreateBugCommand(bugDto)); ObjectFactory.GetInstance <IBus>().AssertWasCalled( x => x.Send(Arg <CreateCommand[]> .Matches(y => y.Length == 1 && (((BugDTO)y[0].Dto).Name).Equals(bugDto.Name)))); }
public void ShouldConvertToUpdateMessageCorrectly() { var bugDto = new BugDTO { Name = "Name" }; ObjectFactory.GetInstance <ITpBus>().Send(new UpdateBugCommand(bugDto, new Enum[] { BugField.Name })); ObjectFactory.GetInstance <IBus>().AssertWasCalled( x => x.Send( Arg <UpdateCommand[]> .Matches( y => y.Length == 1 && ((BugDTO)y[0].Dto).Name.Equals(bugDto.Name) && y[0].ChangedFields.ToArray().Contains(BugField.Name.ToString())))); }
public void ReassignDeveloper(string bugName) { BugDTO bug = Context.TpBugs.Single(b => b.Name == bugName); RoleDTO developerRole = Context.Roles.Single(r => r.Name == "Developer"); var existingDeveloperTeam = Context.TpTeams.Where(t => t.AssignableID == bug.ID) .Where(t => t.RoleID == developerRole.ID) .Single(); existingDeveloperTeam.RoleName = developerRole.Name; TransportMock.HandleMessageFromTp(new TeamDeletedMessage { Dto = existingDeveloperTeam }); }
public string GetMappedBugzillaStatus(BugDTO bug) { var stateId = bug.EntityStateID.GetValueOrDefault(); var mappedStates = Map.Where(x => x.Value.Id == stateId).Select(x => x.Key).ToList(); if (mappedStates.Count() > 1) { _logger.WarnFormat("State mapping is ambiguous. Bugzilla state is not changed. Entity State: {0}", bug.EntityStateName); return(null); } var mappedValue = mappedStates.SingleOrDefault(); var bugStatus = mappedValue ?? GetDtoStorage().Single(s => s.EntityStateID == stateId).Name; var statuses = _bugzillaService.GetStatuses(); return(statuses.Find(s => s.Equals(bugStatus, StringComparison.InvariantCultureIgnoreCase))); }
public ConvertedBug() { BugDto = new BugDTO(); ChangedFields = new List <Enum>(); }
public IBugzillaQuery GetChangeStatusAction(BugDTO tpBug, string bugzillaBugId, string status) { return(new BugzillaChangeStatusAction(bugzillaBugId, status, tpBug.CommentOnChangingState)); }