public string Execute(IList <string> inputParameters)
        {
            //Validations
            businessLogicValidator.ValidateIfAnyWorkItemsExist(allTeams);

            businessLogicValidator.ValidateIfAnyStoriesExist(allTeams);

            //Operations
            var AllWorkItems = allTeams.AllTeamsList.Values
                               .SelectMany(x => x.Boards)
                               .SelectMany(x => x.WorkItems)
                               .Where(x => x.GetType() == typeof(Story))
                               .ToList();

            StringBuilder sb = new StringBuilder();

            sb.AppendLine("----ALL STORIES IN APPLICAITION----");
            long workItemCounter = 1;

            foreach (var item in AllWorkItems)
            {
                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 statusToFilterStoryFor = inputParameters[0];

            //Validations
            var statusTypeForChecking = "Status";

            inputValidator.IsNullOrEmpty(statusToFilterStoryFor, statusTypeForChecking);

            businessLogicValidator.ValidateIfAnyWorkItemsExist(allTeams);

            businessLogicValidator.ValidateIfAnyStoriesExist(allTeams);

            //Operations
            var isStatusEnumConvertable = Enum.TryParse(statusToFilterStoryFor, out StoryStatus storyStatusToCheckFor);

            inputValidator.IsEnumConvertable(isStatusEnumConvertable, "Status");

            var filteredStoriesbyStatus = allTeams.AllTeamsList.Values
                                          .SelectMany(x => x.Boards)
                                          .SelectMany(x => x.WorkItems)
                                          .Where(x => x.GetType() == typeof(Story))
                                          .Select(workItem => (Story)workItem)
                                          .Where(story => story.StoryStatus == storyStatusToCheckFor)
                                          .ToList();


            StringBuilder sb = new StringBuilder();
            long          workItemCounter = 1;

            if (filteredStoriesbyStatus.Count == 0)
            {
                sb.AppendLine($"There are no Stories with: {statusToFilterStoryFor} Status in the app yet!");
            }
            else
            {
                sb.AppendLine($"----ALL STORIES WITH {statusToFilterStoryFor} STATUS IN APPLICAITION----");
                foreach (var item in filteredStoriesbyStatus)
                {
                    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 assigneeToFilterStoryFor = inputParameters[0];

            //Validations
            var assigneeTypeForChecking = "Assignee";

            inputValidator.IsNullOrEmpty(assigneeToFilterStoryFor, assigneeTypeForChecking);

            businessLogicValidator.ValidateIfAnyWorkItemsExist(allTeams);

            businessLogicValidator.ValidateIfAnyStoriesExist(allTeams);

            //Operations
            var filteredStoriesByAssignee = allTeams.AllTeamsList.Values
                                            .SelectMany(x => x.Boards)
                                            .SelectMany(x => x.WorkItems)
                                            .Where(x => x.GetType() == typeof(Story))
                                            .Select(workItem => (Story)workItem)
                                            .Where(story => story.Assignee.Name == assigneeToFilterStoryFor)
                                            .ToList();


            StringBuilder sb = new StringBuilder();
            long          workItemCounter = 1;

            if (filteredStoriesByAssignee.Count == 0)
            {
                sb.AppendLine($"There are no Stories with: {assigneeToFilterStoryFor} Assignee in the app yet!");
            }
            else
            {
                sb.AppendLine($"----ALL STORIES ASSIGNED TO MEMBER: {assigneeToFilterStoryFor} IN APPLICAITION----");
                foreach (var item in filteredStoriesByAssignee)
                {
                    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 factorToSortBy = inputParameters[0];

            //Validations
            var factorTypeForChecking = $"{factorToSortBy}";

            inputValidator.IsNullOrEmpty(factorToSortBy, factorTypeForChecking);

            businessLogicValidator.ValidateIfAnyWorkItemsExist(allTeams);

            businessLogicValidator.ValidateIfAnyStoriesExist(allTeams);

            //Operations
            var filteredStories = new List <Story>();

            if (factorToSortBy.ToLower() == "title")
            {
                filteredStories = allTeams.AllTeamsList.Values
                                  .SelectMany(x => x.Boards)
                                  .SelectMany(x => x.WorkItems)
                                  .Where(x => x.GetType() == typeof(Story))
                                  .Select(workItem => (Story)workItem)
                                  .OrderBy(storyToOrder => storyToOrder.Title)
                                  .ToList();
            }
            else if (factorToSortBy.ToLower() == "priority")
            {
                filteredStories = allTeams.AllTeamsList.Values
                                  .SelectMany(x => x.Boards)
                                  .SelectMany(x => x.WorkItems)
                                  .Where(x => x.GetType() == typeof(Story))
                                  .Select(workItem => (Story)workItem)
                                  .OrderBy(storyToOrder => storyToOrder.Priority)
                                  .ToList();
            }
            else if (factorToSortBy.ToLower() == "status")
            {
                filteredStories = allTeams.AllTeamsList.Values
                                  .SelectMany(x => x.Boards)
                                  .SelectMany(x => x.WorkItems)
                                  .Where(x => x.GetType() == typeof(Story))
                                  .Select(workItem => (Story)workItem)
                                  .OrderBy(storyToOrder => storyToOrder.StoryStatus)
                                  .ToList();
            }
            else if (factorToSortBy.ToLower() == "size")
            {
                filteredStories = allTeams.AllTeamsList.Values
                                  .SelectMany(x => x.Boards)
                                  .SelectMany(x => x.WorkItems)
                                  .Where(x => x.GetType() == typeof(Story))
                                  .Select(workItem => (Story)workItem)
                                  .OrderBy(storyToOrder => storyToOrder.Size)
                                  .ToList();
            }
            StringBuilder sb = new StringBuilder();

            sb.AppendLine($"----ALL STORIES IN APPLICAITION SORTED BY {factorToSortBy}----");
            long workItemCounter = 1;

            foreach (var item in filteredStories)
            {
                sb.AppendLine($"{workItemCounter}. {item.GetType().Name} with name: {item.Title} ");
                workItemCounter++;
            }
            sb.AppendLine("---------------------------------");

            var resultedAllItems = sb.ToString().Trim();

            return(string.Format(resultedAllItems));
        }