public override string Execute() { if (this.CommandParameters.Count != 3) { throw new ArgumentException("Parameters count is not valid!"); } var currBoardItems = Commons.currentBoard.WorkItems; var teamBugs = currBoardItems.Where(b => b.GetType().Name == "Bug"); var bugToModify = teamBugs.FirstOrDefault(b => b.Title == this.CommandParameters[0]) as Bug; if (this.CommandParameters[1] == "priority") { bugToModify.Priority = ValidateEnums.ValidatePriority(this.CommandParameters[2]); } else if (this.CommandParameters[1] == "severity") { bugToModify.Severity = ValidateEnums.ValidateSeverity(this.CommandParameters[2]); } else if (this.CommandParameters[1] == "status") { bugToModify.Status = ValidateEnums.ValidateStatusBug(this.CommandParameters[2]); } else { throw new ArgumentException("Invalid parameter to modify." + Environment.NewLine + "You can modify priority, status or severity."); } bugToModify.History.Add($"{bugToModify.Title}'s {this.CommandParameters[1]} was modified to {this.CommandParameters[2]}"); return($"{bugToModify.Title} bug's {this.CommandParameters[1]} was modified to {this.CommandParameters[2]} in {Commons.currentBoard.Name} board!"); }
public override string Execute() { var builder = new StringBuilder(); var allItems = this.WorkItemProvider.WorkItems; if (CommandParameters.Count == 0) { throw new ArgumentException("You must provide bug status to filter by."); } var bugs = allItems.Where(b => b.GetType().Name == "Bug").Select(c => c as Bug); if (bugs.Count() == 0) { throw new ArgumentException("No bugs available!"); } var bugStts = ValidateEnums.ValidateStatusBug(this.CommandParameters[0]); { foreach (var bug in bugs) { if (bug.Status == bugStts) { builder.AppendLine(bug.ToString()); } } } return(builder.ToString().TrimEnd()); }