Exemple #1
0
        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!");
        }
Exemple #2
0
        public override string Execute()
        {
            if (this.CommandParameters.Count != 4)
            {
                throw new ArgumentException("Parameters count is not valid!");
            }
            var title = this.CommandParameters[0];
            var description = this.CommandParameters[1];
            var priority = ValidateEnums.ValidatePriority(CommandParameters[2]);
            var severity = ValidateEnums.ValidateSeverity(CommandParameters[3]);


            var currBoardItems = Commons.CurrBoardValid().WorkItems;

            var findBug = this.WorkItemProvider.Find(title);
            if (findBug != null)
            {
                throw new ArgumentException("Bug already exists!");

            }

            var newBug = this.Factory.CreateBug(title, description, priority, severity);

            Commons.AddToWIHistory(newBug);
            this.WorkItemProvider.Add(newBug);
            currBoardItems.Add(newBug);

            return $"{newBug.Title} bug added to {Commons.currentBoard.Name} board!" + Commons.CreateBugText();

        }
Exemple #3
0
        public override string Execute()
        {
            //overrite parameters with step by step user input

            if (this.CommandParameters.Count != 4)
            {
                throw new ArgumentException("Parameters count is not valid!");
            }
            var title       = this.CommandParameters[0];
            var description = this.CommandParameters[1];
            var priority    = ValidateEnums.ValidatePriority(CommandParameters[2]);
            var size        = ValidateEnums.ValidateStorySize(CommandParameters[3]);


            var currBoardItems = Commons.CurrBoardValid().WorkItems;

            var findStory = this.WorkItemProvider.Find(title);

            if (findStory != null)
            {
                throw new ArgumentException("Story already exists!");
            }

            var newStory = this.Factory.CreateStory(title, description, priority, size);


            Commons.AddToWIHistory(newStory);
            this.WorkItemProvider.Add(newStory);
            currBoardItems.Add(newStory);

            return($"{newStory.Title} story added to {Commons.currentBoard.Name} board!" + Commons.CreateStoryText());
        }