public string Execute(IList <string> inputParameters) { //Assign Values From List Of Parameters string statusToFilterBugFor = inputParameters[0]; //Validations var statusTypeForChecking = "Status"; inputValidator.IsNullOrEmpty(statusToFilterBugFor, statusTypeForChecking); businessLogicValidator.ValidateIfAnyWorkItemsExist(allTeams); businessLogicValidator.ValidateIfAnyBugsExist(allTeams); //Operations var isPriorityEnumConvertable = Enum.TryParse(statusToFilterBugFor, out BugStatus bugStatusToCheckFor); inputValidator.IsEnumConvertable(isPriorityEnumConvertable, "Status"); var filteredBugsByStatus = allTeams.AllTeamsList.Values .SelectMany(x => x.Boards) .SelectMany(x => x.WorkItems) .Where(x => x.GetType() == typeof(Bug)) .Select(workItem => (Bug)workItem) .Where(bug => bug.BugStatus == bugStatusToCheckFor) .ToList(); StringBuilder sb = new StringBuilder(); long workItemCounter = 1; if (filteredBugsByStatus.Count == 0) { sb.AppendLine($"There are no Bugs with: {statusToFilterBugFor} Status in the app yet!"); } else { sb.AppendLine($"----ALL BUGS WITH {statusToFilterBugFor} STATUS IN APPLICAITION----"); foreach (var item in filteredBugsByStatus) { sb.AppendLine($"{workItemCounter}. {item.GetType().Name} with name: {item.Title} "); workItemCounter++; } sb.AppendLine("---------------------------------"); } var resultedAllItems = sb.ToString().Trim(); return(string.Format(resultedAllItems)); }
public string Execute(IList <string> inputParameters) { //Assign Values From List Of Parameters string priorityToFilterStoryFor = inputParameters[0]; //Validations var priorityTypeForChecking = "Priority"; inputValidator.IsNullOrEmpty(priorityToFilterStoryFor, priorityTypeForChecking); businessLogicValidator.ValidateIfAnyWorkItemsExist(allTeams); businessLogicValidator.ValidateIfAnyStoriesExist(allTeams); //Operations var isStatusEnumConvertable = Enum.TryParse(priorityToFilterStoryFor, out Priority priorityToCheckFor); inputValidator.IsEnumConvertable(isStatusEnumConvertable, "Priority"); var filteredStoriesByPriority = allTeams.AllTeamsList.Values .SelectMany(x => x.Boards) .SelectMany(x => x.WorkItems) .Where(x => x.GetType() == typeof(Story)) .Select(workItem => (Story)workItem) .Where(story => story.Priority == priorityToCheckFor) .ToList(); StringBuilder sb = new StringBuilder(); long workItemCounter = 1; if (filteredStoriesByPriority.Count == 0) { sb.AppendLine($"There are no Stories with: {priorityToFilterStoryFor} Status in the app yet!"); } else { sb.AppendLine($"----ALL STORIES WITH {priorityToFilterStoryFor} PRIORITY IN APPLICAITION----"); foreach (var item in filteredStoriesByPriority) { sb.AppendLine($"{workItemCounter}. {item.GetType().Name} with name: {item.Title} "); workItemCounter++; } sb.AppendLine("---------------------------------"); } var resultedAllItems = sb.ToString().Trim(); return(string.Format(resultedAllItems)); }
public string Execute(IList <string> inputParameters) { //Assign Values string feedbackTitle = inputParameters[0]; string teamToAddFeedbackFor = inputParameters[1]; string boardToAddFeedbackFor = inputParameters[2]; string feedbackRaiting = inputParameters[3]; string feedbackStatus = inputParameters[4]; var feedbackDescription = descriptionBuilder.BuildDescription(inputParameters, 5); //Validations var feedbackTypeForChecking = "Feedback Title"; inputValidator.IsNullOrEmpty(feedbackTitle, feedbackTypeForChecking); var teamTypeForChecking = "Team Name"; inputValidator.IsNullOrEmpty(teamToAddFeedbackFor, teamTypeForChecking); var boardTypeForChecking = "Board Name"; inputValidator.IsNullOrEmpty(boardToAddFeedbackFor, boardTypeForChecking); inputValidator.ValdateItemTitleLength(feedbackTitle); inputValidator.ValdateItemDescriptionLength(feedbackDescription); businessLogicValidator.ValidateTeamExistance(allTeams, teamToAddFeedbackFor); businessLogicValidator.ValidateBoardExistanceInTeam(allTeams, boardToAddFeedbackFor, teamToAddFeedbackFor); businessLogicValidator.ValidateFeedbackExistanceInBoard(allTeams, boardToAddFeedbackFor, teamToAddFeedbackFor, feedbackTitle); var intFeedbackRating = inputValidator.ValidateRatingConversion(feedbackRaiting); //Operations var isEnumConvertable = Enum.TryParse(feedbackStatus, out FeedbackStatus feedbackStatusEnum); inputValidator.IsEnumConvertable(isEnumConvertable, "FeedbackStatus"); IFeedback feedbackToAddToCollection = this.factory.CreateFeedback(feedbackTitle, feedbackDescription, intFeedbackRating, feedbackStatusEnum); var indexOfBoardInSelectedTeam = allTeams.AllTeamsList[teamToAddFeedbackFor].Boards.FindIndex(boardIndex => boardIndex.Name == boardToAddFeedbackFor); boardOperations.AddWorkitemToBoard(allTeams.AllTeamsList[teamToAddFeedbackFor].Boards[indexOfBoardInSelectedTeam], feedbackToAddToCollection); boardOperations.AddActivityHistoryToBoard(allTeams.AllTeamsList[teamToAddFeedbackFor].Boards[indexOfBoardInSelectedTeam], feedbackToAddToCollection); return(string.Format(FeedbackCreated, feedbackTitle)); }
public string Execute(IList <string> inputParameters) { string teamToChangeBugSeverityFor = inputParameters[0]; string boardToChangeBugSeverityFor = inputParameters[1]; string bugToChangeSeverityFor = inputParameters[2]; string newSeverity = inputParameters[3]; string authorOfBugSeverityChange = inputParameters[4]; //Validations var bugTypeForChecking = "Bug Title"; inputValidator.IsNullOrEmpty(bugToChangeSeverityFor, bugTypeForChecking); var teamTypeForChecking = "Team Name"; inputValidator.IsNullOrEmpty(teamToChangeBugSeverityFor, teamTypeForChecking); var boardTypeForChecking = "Board Name"; inputValidator.IsNullOrEmpty(boardToChangeBugSeverityFor, boardTypeForChecking); var severityTypeForChecking = "Severity"; inputValidator.IsNullOrEmpty(newSeverity, severityTypeForChecking); var authorTypeForChecking = "Author"; inputValidator.IsNullOrEmpty(authorOfBugSeverityChange, authorTypeForChecking); businessLogicValidator.ValidateTeamExistance(allTeams, teamToChangeBugSeverityFor); businessLogicValidator.ValidateBoardExistanceInTeam(allTeams, boardToChangeBugSeverityFor, teamToChangeBugSeverityFor); businessLogicValidator.ValidateNoSuchBugInBoard(allTeams, boardToChangeBugSeverityFor, teamToChangeBugSeverityFor, bugToChangeSeverityFor); //Operations var itemType = "Bug"; var isEnumConvertable = Enum.TryParse(newSeverity, out Severity newSeverityEnum); inputValidator.IsEnumConvertable(isEnumConvertable, "Severity"); var castedBugForPriorityChange = allTeams.FindBugAndCast(teamToChangeBugSeverityFor, boardToChangeBugSeverityFor, bugToChangeSeverityFor); bugOperations.ChangeBugSeverity(castedBugForPriorityChange, newSeverityEnum); var memberToAddActivityFor = allTeams.FindMemberInTeam(teamToChangeBugSeverityFor, authorOfBugSeverityChange); var teamToAddActivityFor = allTeams.AllTeamsList[teamToChangeBugSeverityFor]; var bugToAddActivityFor = allTeams.FindWorkItem(teamToChangeBugSeverityFor, itemType, boardToChangeBugSeverityFor, bugToChangeSeverityFor); var teamToFindIn = allTeams.AllTeamsList[teamToChangeBugSeverityFor]; var boardToAddActivityFor = allTeams.FindBoardInTeam(teamToChangeBugSeverityFor, boardToChangeBugSeverityFor); boardOperations.AddActivityHistoryToBoard(boardToAddActivityFor, memberToAddActivityFor, bugToAddActivityFor, newSeverity); memberOpertaions.AddActivityHistoryToMember(memberToAddActivityFor, bugToAddActivityFor, teamToFindIn, boardToAddActivityFor, newSeverity); bugOperations.AddActivityHistoryToWorkItem(bugToAddActivityFor, memberToAddActivityFor, newSeverity); return(string.Format(BugSeverityChanged, bugToChangeSeverityFor, newSeverityEnum)); }
public string Execute(IList <string> inputParameters) { string storyTitle = inputParameters[0]; string teamToAddStoryFor = inputParameters[1]; string boardToAddStoryFor = inputParameters[2]; string storyPriority = inputParameters[3]; string storySize = inputParameters[4]; string storyStatus = inputParameters[5]; string storyAssignee = inputParameters[6]; var storyDescription = descriptionBuilder.BuildDescription(inputParameters, 7); //Validations var storyTypeForChecking = "Story Title"; inputValidator.IsNullOrEmpty(storyTitle, storyTypeForChecking); var teamTypeForChecking = "Team Name"; inputValidator.IsNullOrEmpty(teamToAddStoryFor, teamTypeForChecking); var boardTypeForChecking = "Board Name"; inputValidator.IsNullOrEmpty(boardToAddStoryFor, boardTypeForChecking); inputValidator.ValdateItemTitleLength(storyTitle); inputValidator.ValdateItemDescriptionLength(storyDescription); businessLogicValidator.ValidateTeamExistance(allTeams, teamToAddStoryFor); businessLogicValidator.ValidateMemberExistance(allMembers, storyAssignee); businessLogicValidator.ValidateIfMemberNotInTeam(allTeams, teamToAddStoryFor, storyAssignee); businessLogicValidator.ValidateBoardExistanceInTeam(allTeams, boardToAddStoryFor, teamToAddStoryFor); businessLogicValidator.ValidateStoryExistanceInBoard(allTeams, boardToAddStoryFor, teamToAddStoryFor, storyTitle); //Operations var isPriorityEnumConvertable = Enum.TryParse(storyPriority, out Priority storyPriorityEnum); inputValidator.IsEnumConvertable(isPriorityEnumConvertable, "Priority"); var isSizeEnumConvertable = Enum.TryParse(storySize, out Size storySizeEnum); inputValidator.IsEnumConvertable(isSizeEnumConvertable, "Size"); var isStatusEnumConvertable = Enum.TryParse(storyStatus, out StoryStatus storyStatusEnum); inputValidator.IsEnumConvertable(isStatusEnumConvertable, "Status"); IStory storyToAddToCollection = this.factory.CreateStory(storyTitle, storyDescription, storyPriorityEnum, storySizeEnum, storyStatusEnum, allMembers.AllMembersList[storyAssignee]); var indexOfBoardInSelectedTeam = allTeams.AllTeamsList[teamToAddStoryFor].Boards.FindIndex(boardIndex => boardIndex.Name == boardToAddStoryFor); boardOperations.AddWorkitemToBoard(allTeams.AllTeamsList[teamToAddStoryFor].Boards[indexOfBoardInSelectedTeam], storyToAddToCollection); var memberToPutHistoryFor = allTeams.AllTeamsList[teamToAddStoryFor].Members.First(member => member.Name == storyAssignee); memberOpertaions.AddWorkItemIdToMember(memberToPutHistoryFor, storyToAddToCollection.Id); var boardToPutHistoryFor = allTeams.AllTeamsList[teamToAddStoryFor].Boards[indexOfBoardInSelectedTeam]; var teamToPutHistoryFor = allTeams.AllTeamsList[teamToAddStoryFor]; boardOperations.AddActivityHistoryToBoard(allTeams.AllTeamsList[teamToAddStoryFor].Boards[indexOfBoardInSelectedTeam], memberToPutHistoryFor, storyToAddToCollection); memberOpertaions.AddActivityHistoryToMember(memberToPutHistoryFor, storyToAddToCollection, teamToPutHistoryFor, boardToPutHistoryFor); return(string.Format(StoryCreated, storyTitle)); }
public string Execute(IList <string> inputParameters) { string teamToChangeStoryStatusFor = inputParameters[0]; string boardToChangeStoryStatusFor = inputParameters[1]; string storyToChangeStatusFor = inputParameters[2]; string newStoryStatus = inputParameters[3]; string authorOfStoryStatusChange = inputParameters[4]; //Validations var storyTypeForChecking = "Story Title"; inputValidator.IsNullOrEmpty(storyToChangeStatusFor, storyTypeForChecking); var teamTypeForChecking = "Team Name"; inputValidator.IsNullOrEmpty(teamToChangeStoryStatusFor, teamTypeForChecking); var boardTypeForChecking = "Board Name"; inputValidator.IsNullOrEmpty(boardToChangeStoryStatusFor, boardTypeForChecking); var statusTypeForChecking = "Status"; inputValidator.IsNullOrEmpty(newStoryStatus, statusTypeForChecking); var authorTypeForChecking = "Author"; inputValidator.IsNullOrEmpty(authorOfStoryStatusChange, authorTypeForChecking); businessLogicValidator.ValidateTeamExistance(allTeams, teamToChangeStoryStatusFor); businessLogicValidator.ValidateBoardExistanceInTeam(allTeams, boardToChangeStoryStatusFor, teamToChangeStoryStatusFor); businessLogicValidator.ValidateNoSuchStoryInBoard(allTeams, boardToChangeStoryStatusFor, teamToChangeStoryStatusFor, storyToChangeStatusFor); //Operations var itemType = "Story"; var isEnumConvertable = Enum.TryParse(newStoryStatus, out StoryStatus newStatusEnum); inputValidator.IsEnumConvertable(isEnumConvertable, "Status"); var castedStoryForStatusChange = allTeams.FindStoryAndCast(teamToChangeStoryStatusFor, boardToChangeStoryStatusFor, storyToChangeStatusFor); storyOperations.ChangeStoryStatus(castedStoryForStatusChange, newStatusEnum); var memberToAddActivityFor = allTeams.FindMemberInTeam(teamToChangeStoryStatusFor, authorOfStoryStatusChange); var teamToAddActivityFor = allTeams.AllTeamsList[teamToChangeStoryStatusFor]; var storyToAddActivityFor = allTeams.FindWorkItem(teamToChangeStoryStatusFor, itemType, boardToChangeStoryStatusFor, storyToChangeStatusFor); var teamToFindIn = allTeams.AllTeamsList[teamToChangeStoryStatusFor]; var boardToAddActivityFor = allTeams.FindBoardInTeam(teamToChangeStoryStatusFor, boardToChangeStoryStatusFor); boardOperations.AddActivityHistoryToBoard(boardToAddActivityFor, memberToAddActivityFor, storyToAddActivityFor, newStoryStatus); memberOpertaions.AddActivityHistoryToMember(memberToAddActivityFor, storyToAddActivityFor, teamToFindIn, boardToAddActivityFor, newStoryStatus); storyOperations.AddActivityHistoryToWorkItem(storyToAddActivityFor, memberToAddActivityFor, newStoryStatus); return(string.Format(StoryStatusChanged, storyToChangeStatusFor, newStatusEnum)); }
public string Execute(IList <string> inputParameters) { string bugTitle = inputParameters[0]; string teamToAddBugFor = inputParameters[1]; string boardToAddBugFor = inputParameters[2]; string bugPriority = inputParameters[3]; string bugSeverity = inputParameters[4]; string bugAssignee = inputParameters[5]; IList <string> bugStepsToReproduce = stepsToReproduceBuilder.BuildStepsToReproduce(inputParameters, "!Steps"); var bugDescription = descriptionBuilder.BuildDescription(inputParameters, "!Steps"); //Validations var bugTypeForChecking = "Bug Title"; inputValidator.IsNullOrEmpty(bugTitle, bugTypeForChecking); var teamTypeForChecking = "Team Name"; inputValidator.IsNullOrEmpty(teamToAddBugFor, teamTypeForChecking); var boardTypeForChecking = "Board Name"; inputValidator.IsNullOrEmpty(boardToAddBugFor, boardTypeForChecking); inputValidator.ValdateItemTitleLength(bugTitle); inputValidator.ValdateItemDescriptionLength(bugDescription); businessLogicValidator.ValidateTeamExistance(allTeams, teamToAddBugFor); businessLogicValidator.ValidateMemberExistance(allMembers, bugAssignee); businessLogicValidator.ValidateIfMemberNotInTeam(allTeams, teamToAddBugFor, bugAssignee); businessLogicValidator.ValidateBugExistanceInBoard(allTeams, boardToAddBugFor, teamToAddBugFor, bugTitle); //Operations var isPriorityEnumConvertable = Enum.TryParse(bugPriority, out Priority bugPriorityEnum); inputValidator.IsEnumConvertable(isPriorityEnumConvertable, "Priority"); var isSeverityEnumConvertable = Enum.TryParse(bugSeverity, out Severity bugSeverityEnum); inputValidator.IsEnumConvertable(isSeverityEnumConvertable, "Severity"); IBug bugToAddToCollection = this.factory.CreateBug(bugTitle, bugPriorityEnum, bugSeverityEnum, allMembers.AllMembersList[bugAssignee], bugStepsToReproduce, bugDescription); var indexOfBoardInSelectedTeam = allTeams.AllTeamsList[teamToAddBugFor].Boards.FindIndex(boardIndex => boardIndex.Name == boardToAddBugFor); boardOperations.AddWorkitemToBoard(allTeams.AllTeamsList[teamToAddBugFor].Boards[indexOfBoardInSelectedTeam], bugToAddToCollection); var memberToTrackActivityFor = allTeams.AllTeamsList[teamToAddBugFor].Members.First(member => member.Name == bugAssignee); memberOpertaions.AddWorkItemIdToMember(memberToTrackActivityFor, bugToAddToCollection.Id); var boardToPutHistoryFor = allTeams.AllTeamsList[teamToAddBugFor].Boards[indexOfBoardInSelectedTeam]; var teamToPutHistoryFor = allTeams.AllTeamsList[teamToAddBugFor]; boardOperations.AddActivityHistoryToBoard(allTeams.AllTeamsList[teamToAddBugFor].Boards[indexOfBoardInSelectedTeam], memberToTrackActivityFor, bugToAddToCollection); memberOpertaions.AddActivityHistoryToMember(memberToTrackActivityFor, bugToAddToCollection, teamToPutHistoryFor, boardToPutHistoryFor); return(string.Format(BugCreated, bugTitle)); }