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 teamStories    = currBoardItems.Where(b => b.GetType().Name == "Story");
            var storyToModify  = teamStories.FirstOrDefault(b => b.Title == this.CommandParameters[0]) as Story;

            if (this.CommandParameters[1].ToLower() == "priority")
            {
                storyToModify.Priority = ValidateEnums.ValidatePriority(this.CommandParameters[2]);
            }
            else if (this.CommandParameters[1].ToLower() == "size")
            {
                storyToModify.Size = ValidateEnums.ValidateStorySize(this.CommandParameters[2]);
            }
            else if (this.CommandParameters[1].ToLower() == "status")
            {
                storyToModify.Status = ValidateEnums.ValidateStatusStory(this.CommandParameters[2]);
            }
            else
            {
                throw new ArgumentException("Invalid parameter to modify." + Environment.NewLine + "You can modify priority, status or size.");
            }


            storyToModify.History.Add($"{storyToModify.Title}'s {this.CommandParameters[1]} was modified to {this.CommandParameters[2]}");
            return($"{storyToModify.Title} story's {this.CommandParameters[1]} was modified to {this.CommandParameters[2]} in {Commons.currentBoard.Name} board!");
        }
Exemple #2
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());
        }