Exemplo n.º 1
0
        public void DisplayProjectDetails_Should_Set_Bug_Count_From_BugService()
        {
            MockRepository repo           = new MockRepository();
            IBugListView   mockBugView    = repo.StrictMock <IBugListView>();
            IBugService    mockBugService = repo.StrictMock <IBugService>();
            IProject       mockProject    = repo.StrictMock <IProject>();

            IBug[]      mockBugsArray = new IBug[] { repo.StrictMock <IBug>(), repo.StrictMock <IBug>() };
            List <IBug> mockBugs      = new List <IBug>(mockBugsArray);

            mockBugView.Expect(view => view.SelectedProject).Return(mockProject).Repeat.Twice();
            mockBugService.Expect(svc => svc.GetBugCountForProject(mockProject)).Return(200);
            mockBugView.Expect(view => view.TotalBugs).SetPropertyWithArgument(200);
            mockBugView.Expect(view => view.FilterQuery).Return(string.Empty).Repeat.Any();
            mockBugView.Expect(view => view.IsBusy).Return(false).Repeat.Any();
            mockBugView.Expect(view => view.IsBusy).SetPropertyAndIgnoreArgument().Repeat.Any();

            repo.ReplayAll();

            IBugListViewPresenter pres = new BugListViewPresenter(mockBugView, mockBugService);

            pres.DisplayProjectDetails();

            mockBugService.VerifyAllExpectations();
            mockBugView.VerifyAllExpectations();
        }
        public void DisplayProjectDetails_Should_Set_Bug_Count_From_BugService()
        {
            MockRepository repo = new MockRepository();
            IBugListView mockBugView = repo.StrictMock<IBugListView>();
            IBugService mockBugService = repo.StrictMock<IBugService>();
            IProject mockProject = repo.StrictMock<IProject>();
            IBug[] mockBugsArray = new IBug[] { repo.StrictMock<IBug>(), repo.StrictMock<IBug>() };
            List<IBug> mockBugs = new List<IBug>(mockBugsArray);

            mockBugView.Expect(view => view.SelectedProject).Return(mockProject).Repeat.Twice();
            mockBugService.Expect(svc => svc.GetBugCountForProject(mockProject)).Return(200);
            mockBugView.Expect(view => view.TotalBugs).SetPropertyWithArgument(200);
            mockBugView.Expect(view => view.FilterBy).Return(string.Empty).Repeat.Any();
            mockBugView.Expect(view => view.FilterValue).Return(string.Empty).Repeat.Any();
            mockBugView.Expect(view => view.IsBusy).Return(false).Repeat.Any();
            mockBugView.Expect(view => view.IsBusy).SetPropertyAndIgnoreArgument().Repeat.Any();

            repo.ReplayAll();

            IBugListViewPresenter pres = new BugListViewPresenter(mockBugView, mockBugService);
            pres.DisplayProjectDetails();

            mockBugService.VerifyAllExpectations();
            mockBugView.VerifyAllExpectations();
        }
Exemplo n.º 3
0
        public void when_calling_get_bug_it_should_return_a_bug()
        {
            int  ID  = 7;
            IBug bug = _client.GetBug(ID);

            Assert.IsNotNull(bug);
        }
Exemplo n.º 4
0
 public SubmissionController(IBug bug,
                             UserManager <ApplicationUser> userManager,
                             IUserBug userBug)
 {
     _bug         = bug;
     _userManager = userManager;
     _userBug     = userBug;
 }
Exemplo n.º 5
0
 public BugController(IBug bugs,
                      UserManager <ApplicationUser> userManager,
                      IUserBug userBug)
 {
     _bugs        = bugs;
     _userManager = userManager;
     _userBug     = userBug;
 }
Exemplo n.º 6
0
 public ProjectController(
     UserManager <ApplicationUser> userManager,
     IBug bug, IUserBug userBug)
 {
     _userManager = userManager;
     _bug         = bug;
     _userBug     = userBug;
 }
Exemplo n.º 7
0
 public void ReportBug(IBug details, IUser reporter, DateTime dueBy, IssueStatus issueStatus = IssueStatus.Open, Severity severity = Severity.Undefined)
 {
     if (string.IsNullOrWhiteSpace(details?.Description))
     {
         _logger.Warning("Issue details missing from bug.");
         return;
     }
     AddIssue(new Issue(GetNextIssueId(), details, reporter, null, dueBy, issueStatus, severity));
 }
Exemplo n.º 8
0
 public ManagementController(
     UserManager <ApplicationUser> userManager,
     RoleManager <IdentityRole <Guid> > roleManager,
     IUser user, IBug bug, IUserBug userBug)
 {
     _userManager = userManager;
     _roleManager = roleManager;
     _user        = user;
     _bug         = bug;
     _userBug     = userBug;
 }
Exemplo n.º 9
0
        public void when_calling_accept_bug_the_status_changes()
        {
            int    ID     = 7;
            string status = "IN_PROGRESS";

            _client.AcceptBug(ID, status);

            IBug bug = _client.GetBug(ID);

            Assert.AreEqual(bug.Status, status);
        }
        public void Setup()
        {
            var representativeResponseFromBugzillaRestAPIForGettingABug = JObject.Parse("{\"bugs\":[{\"summary\":\"This one has a depencancy\",\"creator_detail\":{\"email\":\"[email protected]\",\"name\":\"[email protected]\",\"id\":1,\"real_name\":\"Terry Densmore\"},\"priority\":\"---\",\"deadline\":null,\"status\":\"CONFIRMED\",\"depends_on\":[128],\"groups\":[],\"cf_upper\":null,\"classification\":\"Unclassified\",\"id\":127,\"keywords\":[],\"last_change_time\":\"2016-11-10T15:01:07Z\",\"assigned_to\":\"[email protected]\",\"url\":\"\",\"product\":\"TestProduct\",\"creator\":\"[email protected]\",\"cf_versiononeurl\":\"\",\"resolution\":\"\",\"flags\":[],\"cf_versiononestate\":\"---\",\"version\":\"unspecified\",\"cf_upperurl\":\"\",\"component\":\"TestComponent\",\"qa_contact\":\"\",\"see_also\":[],\"creation_time\":\"2016-11-10T14:54:38Z\",\"cc\":[],\"platform\":\"PC\",\"assigned_to_detail\":{\"email\":\"[email protected]\",\"name\":\"[email protected]\",\"id\":1,\"real_name\":\"Terry Densmore\"},\"target_milestone\":\"---\",\"blocks\":[],\"is_open\":true,\"cc_detail\":[],\"whiteboard\":\"\",\"severity\":\"enhancement\",\"op_sys\":\"Windows\",\"alias\":[],\"is_creator_accessible\":true,\"is_cc_accessible\":true,\"dupe_of\":null,\"is_confirmed\":true}],\"faults\":[]}");
            var representativeBugData = representativeResponseFromBugzillaRestAPIForGettingABug["bugs"].First;
            
            _commentWhenCreated = "This bug is for a test";

            _bug = new Bug(representativeBugData, _commentWhenCreated);

            _expectedReassignToPayload = "{\r\n  \"assigned_to\": \"[email protected]\",\r\n  \"status\": \"CONFIRMED\",\r\n  \"token\": \"[email protected]\"\r\n}";
        }
        public void Setup()
        {
            var representativeResponseFromBugzillaRestAPIForGettingABug = JObject.Parse("{\"bugs\":[{\"summary\":\"This one has a depencancy\",\"creator_detail\":{\"email\":\"[email protected]\",\"name\":\"[email protected]\",\"id\":1,\"real_name\":\"Terry Densmore\"},\"priority\":\"---\",\"deadline\":null,\"status\":\"CONFIRMED\",\"depends_on\":[128],\"groups\":[],\"cf_upper\":null,\"classification\":\"Unclassified\",\"id\":127,\"keywords\":[],\"last_change_time\":\"2016-11-10T15:01:07Z\",\"assigned_to\":\"[email protected]\",\"url\":\"\",\"product\":\"TestProduct\",\"creator\":\"[email protected]\",\"cf_versiononeurl\":\"\",\"resolution\":\"\",\"flags\":[],\"cf_versiononestate\":\"---\",\"version\":\"unspecified\",\"cf_upperurl\":\"\",\"component\":\"TestComponent\",\"qa_contact\":\"\",\"see_also\":[],\"creation_time\":\"2016-11-10T14:54:38Z\",\"cc\":[],\"platform\":\"PC\",\"assigned_to_detail\":{\"email\":\"[email protected]\",\"name\":\"[email protected]\",\"id\":1,\"real_name\":\"Terry Densmore\"},\"target_milestone\":\"---\",\"blocks\":[],\"is_open\":true,\"cc_detail\":[],\"whiteboard\":\"\",\"severity\":\"enhancement\",\"op_sys\":\"Windows\",\"alias\":[],\"is_creator_accessible\":true,\"is_cc_accessible\":true,\"dupe_of\":null,\"is_confirmed\":true}],\"faults\":[]}");
            var representativeBugData = representativeResponseFromBugzillaRestAPIForGettingABug["bugs"].First;

            _commentWhenCreated = "This bug is for a test";

            _bug = new Bug(representativeBugData, _commentWhenCreated);

            _expectedReassignToPayload = "{\r\n  \"assigned_to\": \"[email protected]\",\r\n  \"status\": \"CONFIRMED\",\r\n  \"token\": \"[email protected]\"\r\n}";
        }
Exemplo n.º 12
0
        public void when_calling_reassign_bug_it_should_change_the_assigned_bug()
        {
            int ID = 7;

            var AssignedToUser = "******";

            _client.ReassignBug(ID, AssignedToUser);

            IBug bug = _client.GetBug(ID);

            Assert.AreEqual(bug.AssignedTo, AssignedToUser);
        }
Exemplo n.º 13
0
        public void when_calling_resolve_bug_the_bug_status_should_change()
        {
            int    ID         = 7;
            string status     = "RESOLVED";
            string resolution = "FIXED";
            IBug   bug        = _client.GetBug(ID);

            _client.ResolveBug(Int32.Parse(bug.ID), resolution);

            bug = _client.GetBug(ID);

            Assert.AreEqual(bug.Status, status);
        }
        /// <summary>
        /// Returns an IBug by given id from a collection of type IBug.
        /// </summary>
        /// <param name="id">int</param>
        /// <param name="collection">IList<IBug></param>
        /// <returns>IBug</returns>
        public static IBug ReturnExisting(int id, IList <IBug> collection)
        {
            IBug result = default;

            foreach (var item in collection)
            {
                if (id == item.ID)
                {
                    result = item;
                    break;
                }
            }
            return(result);
        }
Exemplo n.º 15
0
        private void CreateComment(IBug bug, string comment)
        {
            var req = new RestRequest("bug/" + bug.ID + "/comment", Method.POST);

            req.AddParameter("token", _integrationUserToken);
            req.AddParameter("comment", comment);

            var result = Client.Post(req);

            if (result.StatusCode != HttpStatusCode.Created)
            {
                var response = JObject.Parse(result.Content);
                LogAndThrow($"Error when trying to create comment for bug {bug.ID}: ", response["message"].ToString());
            }
        }
Exemplo n.º 16
0
        public string ReturnMemberWorkItemsByStatusToString(string workItemStatus)
        {
            var sb = new StringBuilder();

            foreach (var workItem in listOfMemberWorkItems)
            {
                if (workItem is IBug)
                {
                    IBug bug = (IBug)workItem;

                    if (workItemStatus.ToLower() == "active" || workItemStatus.ToLower() == "fixed")
                    {
                        if (bug.StatusType == EnumHelper.GetStatusType(workItemStatus))
                        {
                            sb.AppendLine(workItem.ToString());
                        }
                    }
                }
                else if (workItem is IStory)
                {
                    IStory story = (IStory)workItem;

                    if (workItemStatus.ToLower() == "notdone" || workItemStatus.ToLower() == "inprogress" || workItemStatus.ToLower() == "done")
                    {
                        if (story.StatusType == EnumHelper.GetStoryStatusType(workItemStatus))
                        {
                            sb.AppendLine(workItem.ToString());
                        }
                    }
                }
                else if (workItem is IFeedback)
                {
                    IFeedback feedback = (IFeedback)workItem;

                    if (workItemStatus.ToLower() == "new" || workItemStatus.ToLower() == "unscheduled" ||
                        workItemStatus.ToLower() == "scheduled" || workItemStatus.ToLower() == "done")

                    {
                        if (feedback.StatusType == EnumHelper.GetFeedbackStatusType(workItemStatus))
                        {
                            sb.AppendLine(workItem.ToString());
                        }
                    }
                }
            }

            return(sb.ToString().TrimEnd());
        }
Exemplo n.º 17
0
        public void ShowBug_Sets_BugProperty_On_View()
        {
            MockRepository repo        = new MockRepository();
            ISingleBugView mockBugView = repo.StrictMock <ISingleBugView>();
            IBug           mockBug     = repo.StrictMock <IBug>();

            mockBugView.Expect(view => view.Bug).SetPropertyWithArgument(mockBug);

            repo.ReplayAll();

            ISingleBugViewPresenter pres = new SingleBugViewPresenter(mockBugView);

            pres.ShowBug(mockBug);

            mockBugView.VerifyAllExpectations();
        }
Exemplo n.º 18
0
        private void ChangeStatus(IBug bug, string status)
        {
            if (StatusExists(status))
            {
                var req = new RestRequest("bug/" + bug.ID, Method.PUT);

                req.AddParameter("status", status);
                req.AddParameter("token", _integrationUserToken);

                var result = Client.Put(req);

                if (result.StatusCode != HttpStatusCode.OK)
                {
                    var response = JObject.Parse(result.Content);
                    LogAndThrow($"Error when trying to change status for bug {bug.ID}: ", response["message"].ToString());
                }
            }
        }
Exemplo n.º 19
0
        public string SubmitBug(IBug bug)
#endif
        {
            string error;

            JiraComm jiraComm = new JiraComm(activeJiraConnection.ServerName, activeJiraConnection.User, activeJiraConnection.Password);
            string   bugID    = jiraComm.SubmitBug(activeJiraConnection.SelectedProject.key, bug.Title, bug.Description, bug.Priority,
                                                   bug.CreatedDate, bug.Author, bug.AssignedTo, bug.Attachments, out error);

            this.ErrorMessage = error;
#if Use2014_1_421
            // JIRA returns something like TSCB-14.
            // Return only the integer portion (until Test Studio is changed to take a string).
            return(int.Parse(bugID.Substring(bugID.IndexOf('-'))));
#else
            return(bugID);
#endif
        }
Exemplo n.º 20
0
        public void SendBug(IBug bug)
        {
            HttpClient httpClient = this.GetHttpClient();

            httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic",
                                                                                           Convert.ToBase64String(
                                                                                               Encoding.ASCII.GetBytes(
                                                                                                   string.Format("{0}:{1}", this._username, this._password))));
            var method  = new HttpMethod("PATCH");
            var request = new HttpRequestMessage(method, this._requestUrl)
            {
                Content = new StringContent(bug.Deserialize(), Encoding.UTF8, "application/json-patch+json")
            };
            HttpResponseMessage hrm = httpClient.SendAsync(request).Result;

            Response = hrm.Content;
        }
Exemplo n.º 21
0
        /// <summary>
        /// Creates a new Bug in a Board, based on user input.
        /// </summary>
        /// <param name="parameter">The name of the Bug.</param>
        /// <returns>A string that reflects if the command was successful.</returns>
        public override string Execute(string parameter)
        {
            string        title;
            string        description;
            List <string> stepsToReproduce = new List <string>();
            Priority      priority;
            Severity      severity;
            BugStatus     status;
            string        boardName;

            try
            {
                title = this._validator.ValidateTitle(parameter);
                Console.Write("Board: ");
                boardName = Console.ReadLine().Trim();
                var board = _validator.ValidateExists(this._engine.Boards, boardName);
                board = _validator.ValidateMoreThanOne(this._engine.Boards, boardName);
                Console.Write("Bug Description(Single line.): ");
                description = _validator.ValidateDescription(Console.ReadLine().Trim());
                Console.WriteLine("Steps to reproduce(Reads until it reaches an empty line.):");
                string input = Console.ReadLine().Trim();
                while (input != string.Empty)
                {
                    stepsToReproduce.Add(input);
                    input = Console.ReadLine().Trim();
                }
                Console.Write("Bug Priority(High/Medium/Low): ");
                priority = this._validator.ValidatePriority(Console.ReadLine().Trim());
                Console.Write("Bug Severity(Critical/Major/Minor): ");
                severity = this._validator.ValidateSeverity(Console.ReadLine().Trim());
                Console.Write("Bug Status(Active/Fixed): ");
                status = this._validator.ValidateBugStatus(Console.ReadLine().Trim());
                IBug bug = this._factory.CreateBug(title, description, stepsToReproduce, priority, severity, status);
                this._engine.WorkItems.Add(bug);
                board.AddWorkItem(bug);
                return($"Bug with ID {this._engine.WorkItems.Count - 1}, Title {bug.Title} was created.");
            }
            catch (ArgumentException ex)
            {
                throw new ArgumentException($"{ex.Message} Unable to create bug.");
            }
        }
Exemplo n.º 22
0
        void bindingSourceBugs_DataSourceChanged(object sender, EventArgs e)
        {
            foreach (DataGridViewRow row in dataGridViewBugs.Rows)
            {
                IBug bug = row.DataBoundItem as IBug;
                if (bug == null)
                {
                    continue;
                }

                //Set the check state to true if bug has been selected
                if (SelectedBugs.Contains((IBug)row.DataBoundItem))
                {
                    row.Cells[0].Value = true;
                }

                if (!bug.IsResolved)
                {
                    continue;
                }

                //Set the font style for resolved bugs to be FontStyle.Strikeout
                foreach (DataGridViewCell cell in row.Cells)
                {
                    if (cell.OwningColumn.GetType() != typeof(DataGridViewTextBoxColumn))
                    {
                        continue;
                    }

                    if (cell.Style.Font == null)
                    {
                        cell.Style.Font = new Font(dataGridViewBugs.DefaultCellStyle.Font, FontStyle.Strikeout);
                    }
                    else
                    {
                        cell.Style.Font = new Font(row.Cells[1].Style.Font, FontStyle.Strikeout);
                    }
                }        //end foreach
            }            //end foreach
        }
Exemplo n.º 23
0
        private void ChangeStatusAndResolve(IBug bug, string status, string resolution)
        {
            if (StatusExists(status))
            {
                var req = new RestRequest("bug/" + bug.ID, Method.PUT);

                req.AddParameter("remaining_time", 0);
                req.AddParameter("resolution", resolution);
                req.AddParameter("status", status);
                req.AddParameter("token", _integrationUserToken);

                var result = Client.Put(req);

                if (result.StatusCode != HttpStatusCode.OK)
                {
                    var response = JObject.Parse(result.Content);
                    LogAndThrow($"Error when trying to change status and resolve bug {bug.ID}: ", response["message"].ToString());
                }

                var comment = $"Resolution has changed to {resolution} by VersionOne";
                CreateComment(bug, comment);
            }
        }
Exemplo n.º 24
0
 public void ShowBug(IBug bug)
 {
     _singleBugView.Bug = bug;
 }
        public string Execute()
        {
            Console.WriteLine("Please enter the name of the team responsible for the workitem whose severity you want to change:");
            Console.WriteLine("List of teams:" + Environment.NewLine + HelperMethods.ListTeams(this.engine.Teams));
            string teamName     = Console.ReadLine();
            bool   ifTeamExists = HelperMethods.IfExists(teamName, engine.Teams);

            if (ifTeamExists == false)
            {
                return("Team with such name does not exist.");
            }
            ITeam team = HelperMethods.ReturnExisting(teamName, engine.Teams);

            Console.Clear();
            Console.WriteLine("Please enter board where the workitem features:");
            Console.WriteLine("List of boards:" + Environment.NewLine + HelperMethods.ListBoards(team.Boards));
            string boardName     = Console.ReadLine();
            bool   ifBoardExists = HelperMethods.IfExists(boardName, team.Boards);

            if (ifBoardExists == false)
            {
                return($"Board with name {boardName} does not exist in team {team.Name}.");
            }
            IBoard board = HelperMethods.ReturnExisting(boardName, team.Boards);

            Console.Clear();
            Console.WriteLine("Please enter the id of the workitem that you wish to change:");
            Console.WriteLine($"List of workitems in team {board.Name}:" + Environment.NewLine + HelperMethods.ListWorkItems(board.WorkItems));
            int  workItemID       = int.Parse(Console.ReadLine());
            bool ifWorkItemExists = HelperMethods.IfExists(workItemID, board.WorkItems);

            if (ifWorkItemExists == false)
            {
                return($"WorkItem with id {workItemID} does not exist in board {board.Name}.");
            }
            IWorkItem workItem = HelperMethods.ReturnExisting(workItemID, board.WorkItems);

            if (workItem is IBug == false)
            {
                return($"The selected WorkItem is not of type bug. Only bugs have severity.");
            }
            IBug bug = workItem as IBug;

            Console.WriteLine($"Please choose the new severity of the bug:{Environment.NewLine}" +
                              $"Type 1 for Critical.{Environment.NewLine}" +
                              $"Type 2 for Major.{Environment.NewLine}" +
                              $"Type 3 for Minor.{Environment.NewLine}");
            Console.WriteLine($"The current severity of {bug.Title} is: {bug.Severity}");
            string   severityUserInput = Console.ReadLine();
            Severity severity;

            switch (severityUserInput)
            {
            case "1": severity = Severity.Critical; break;

            case "2": severity = Severity.Major; break;

            case "3": severity = Severity.Minor; break;

            default: return("invalid command");
            }
            if (severity == bug.Severity)
            {
                return($"The selected WorkItem is already classified with severity {severity}.");
            }
            string result = HelperMethods.TimeStamp() + $"WorkItem with id {bug.ID} changed it's severity to {severity}.";

            bug.Severity = severity;
            bug.History.Add(result);
            board.History.Add(result);
            team.History.Add(result);
            foreach (var item in team.Members)
            {
                if (item.WorkItems.Contains(workItem))
                {
                    item.History.Add(result);
                    break;
                }
            }
            return(result);
        }
Exemplo n.º 26
0
 public BugViewModel(IBug bug) : base(bug)
 {
     _bug = bug;
 }
        /// <summary>
        /// Submits a bug to the bug tracking tool.
        /// Return an int that represents the newly created bug ID.
        /// </summary>
        /// <param name="bug">The bug from Test Studio to be created.</param>
        /// <returns>The newly created bug ID. Unfortunately Test Studio only accepts an int while
        /// JIRA bug ID's are something like TSCB-13.</returns>
#if Use2014_1_421
        public int SubmitBug(IBug bug)
Exemplo n.º 28
0
 private bool HasOpenDependencies(IBug bug)
 {
     return(bug.DependesOn.Select(bugId => GetBug(bugId)).Any(dependantBug => dependantBug.IsOpen));
 }
Exemplo n.º 29
0
        public void ReportBug_IfBugOrBugDescriptionIsNull_LogsIssueAndDoesNotAddIssue(IBug bug)
        {
            var project = CreateProject();

            project.ReportBug(bug, new FakeUser(), DateTime.Now, IssueStatus.Open, Severity.Minor);

            Assert.That(!string.IsNullOrWhiteSpace(_logger.LastLog));
            Assert.That(!project.Issues.Any());
        }
Exemplo n.º 30
0
 public BugViewModel(IBug bug)
     : base(bug)
 {
     _bug = bug;
 }
 public void ShowBug(IBug bug)
 {
     _singleBugView.Bug = bug;
 }
Exemplo n.º 32
0
        public string Execute()
        {
            Console.WriteLine("Please enter the name of the team responsible for the workitem whose steps to reproduce you want to change:");
            Console.WriteLine("List of teams:" + Environment.NewLine + HelperMethods.ListTeams(this.engine.Teams));
            string teamName     = Console.ReadLine();
            bool   ifTeamExists = HelperMethods.IfExists(teamName, engine.Teams);

            if (ifTeamExists == false)
            {
                return("Team with such name does not exist.");
            }
            ITeam team = HelperMethods.ReturnExisting(teamName, engine.Teams);

            Console.Clear();
            Console.WriteLine("Please enter board where the workitem features:");
            Console.WriteLine("List of boards:" + Environment.NewLine + HelperMethods.ListBoards(team.Boards));
            string boardName     = Console.ReadLine();
            bool   ifBoardExists = HelperMethods.IfExists(boardName, team.Boards);

            if (ifBoardExists == false)
            {
                return($"Board with name {boardName} does not exist in team {team.Name}.");
            }
            IBoard board = HelperMethods.ReturnExisting(boardName, team.Boards);

            Console.Clear();
            Console.WriteLine("Please enter the id of the workitem that you wish to change:");
            Console.WriteLine($"List of workitems in board {board.Name}:" + Environment.NewLine + HelperMethods.ListWorkItems(board.WorkItems));
            int  workItemID       = int.Parse(Console.ReadLine());
            bool ifWorkItemExists = HelperMethods.IfExists(workItemID, board.WorkItems);

            if (ifWorkItemExists == false)
            {
                return($"WorkItem with id {workItemID} does not exist in board {board.Name}.");
            }
            IWorkItem workItem = HelperMethods.ReturnExisting(workItemID, board.WorkItems);

            if (workItem is IBug == false)
            {
                return($"The selected WorkItem is not of type bug. Only bugs have steps to reproduce.");
            }
            IBug bug = workItem as IBug;

            Console.Clear();
            Console.WriteLine("Please enter the new steps to reproduce of the bug that you wish to change:");
            string oldSteps = string.Join(", ", bug.Steps);

            Console.WriteLine($"The current steps to reproduce of {bug.Title} are: {oldSteps}");
            List <string> steps  = Console.ReadLine().Split().ToList();
            string        result = HelperMethods.TimeStamp() + $"WorkItem with id {bug.ID} changed it's description.";

            bug.Steps = steps;
            bug.History.Add(result);
            board.History.Add(result);
            team.History.Add(result);
            foreach (var item in team.Members)
            {
                if (item.WorkItems.Contains(workItem))
                {
                    item.History.Add(result);
                    break;
                }
            }
            return(result);
        }
        public string SubmitBug(IBug bug)
#endif
        {
            string error;

            JiraComm jiraComm = new JiraComm(activeJiraConnection.ServerName, activeJiraConnection.User, activeJiraConnection.Password);
            string bugID = jiraComm.SubmitBug(activeJiraConnection.SelectedProject.key, bug.Title, bug.Description, bug.Priority,
                bug.CreatedDate, bug.Author, bug.AssignedTo, bug.Attachments, out error);
            this.ErrorMessage = error;
#if Use2014_1_421
            // JIRA returns something like TSCB-14.
            // Return only the integer portion (until Test Studio is changed to take a string).
            return int.Parse(bugID.Substring(bugID.IndexOf('-')));
#else
            return bugID;
#endif
        }
Exemplo n.º 34
0
 public void when_calling_a_bug_that_doesnt_exist_it_should_throw_an_exception()
 {
     int  ID  = 9999;
     IBug bug = _client.GetBug(ID);
 }
Exemplo n.º 35
0
 public BugController(IBug bug)
 {
     _bug = bug;
 }
        public string Execute()
        {
            Console.WriteLine("Please enter the name of the team responsible for the workitem whose status you want to change:");
            Console.WriteLine("List of teams:" + Environment.NewLine + HelperMethods.ListTeams(this.engine.Teams));
            string teamName     = Console.ReadLine();
            bool   ifTeamExists = HelperMethods.IfExists(teamName, engine.Teams);

            if (ifTeamExists == false)
            {
                return("Team with such name does not exist.");
            }
            ITeam team = HelperMethods.ReturnExisting(teamName, engine.Teams);

            Console.Clear();
            Console.WriteLine("Please enter board where the workitem features:");
            Console.WriteLine("List of boards:" + Environment.NewLine + HelperMethods.ListBoards(team.Boards));
            string boardName     = Console.ReadLine();
            bool   ifBoardExists = HelperMethods.IfExists(boardName, team.Boards);

            if (ifBoardExists == false)
            {
                return($"Board with name {boardName} does not exist in team {team.Name}.");
            }
            IBoard board = HelperMethods.ReturnExisting(boardName, team.Boards);

            Console.Clear();
            Console.WriteLine("Please enter the id of the workitem that you wish to change:");
            Console.WriteLine($"List of workitems in team {board.Name}:" + Environment.NewLine + HelperMethods.ListWorkItems(board.WorkItems));
            int  workItemID       = int.Parse(Console.ReadLine());
            bool ifWorkItemExists = HelperMethods.IfExists(workItemID, board.WorkItems);

            if (ifWorkItemExists == false)
            {
                return($"WorkItem with id {workItemID} does not exist in board {board.Name}.");
            }
            IWorkItem workItem = HelperMethods.ReturnExisting(workItemID, board.WorkItems);
            string    result   = "";

            if (workItem is IBug)
            {
                Console.Clear();
                IBug bug = workItem as IBug;
                Console.WriteLine($"Please choose new status of the bug:{Environment.NewLine}" +
                                  $"Type 1 for Active.{Environment.NewLine}" +
                                  $"Type 2 for Fixed.{Environment.NewLine}");
                Console.WriteLine($"The current status of {bug.Title} is: {bug.Status}");
                string    bugStatusUserInput = Console.ReadLine();
                BugStatus status;
                switch (bugStatusUserInput)
                {
                case "1": status = BugStatus.Active; break;

                case "2": status = BugStatus.Fixed; break;

                default: return("invalid command");
                }
                if (status == bug.Status)
                {
                    return($"The selected WorkItem is already classified with status {status}.");
                }
                result     = HelperMethods.TimeStamp() + $"WorkItem with id {bug.ID} changed it's status to {status}.";
                bug.Status = status;
                bug.History.Add(result);
            }

            if (workItem is IStory)
            {
                Console.Clear();
                IStory story = workItem as IStory;
                Console.WriteLine($"Please choose new status of the story:{Environment.NewLine}" +
                                  $"Type 1 for NotDone.{Environment.NewLine}" +
                                  $"Type 2 for InProgress.{Environment.NewLine}" +
                                  $"Type 3 for Done.{Environment.NewLine}");
                Console.WriteLine($"The current status of {story.Title} is: {story.Status}");
                string      storyStatusUserInput = Console.ReadLine();
                StoryStatus status;
                switch (storyStatusUserInput)
                {
                case "1": status = StoryStatus.NotDone; break;

                case "2": status = StoryStatus.InProgress; break;

                case "3": status = StoryStatus.Done; break;

                default: return("invalid command");
                }
                if (status == story.Status)
                {
                    return($"The selected WorkItem is already classified with status {status}.");
                }
                result       = HelperMethods.TimeStamp() + $"WorkItem with id {story.ID} changed it's status to {status}.";
                story.Status = status;
                story.History.Add(result);
            }

            if (workItem is IFeedback)
            {
                Console.Clear();
                IFeedback feedback = workItem as IFeedback;
                Console.WriteLine($"Please choose new status of the feedback:{Environment.NewLine}" +
                                  $"Type 1 for New.{Environment.NewLine}" +
                                  $"Type 2 for Unscheduled.{Environment.NewLine}" +
                                  $"Type 3 for Scheduled.{Environment.NewLine}" +
                                  $"Type 4 for Done.{Environment.NewLine}");
                Console.WriteLine($"The current status of {feedback.Title} is: {feedback.Status}");
                string         feedbackStatusUserInput = Console.ReadLine();
                FeedbackStatus status;
                switch (feedbackStatusUserInput)
                {
                case "1": status = FeedbackStatus.New; break;

                case "2": status = FeedbackStatus.Unscheduled; break;

                case "3": status = FeedbackStatus.Scheduled; break;

                case "4": status = FeedbackStatus.Done; break;

                default: return("invalid command");
                }
                if (status == feedback.Status)
                {
                    return($"The selected WorkItem is already classified with status {status}.");
                }
                result          = HelperMethods.TimeStamp() + $"WorkItem with id {feedback.ID} changed it's status to {status}.";
                feedback.Status = status;
                feedback.History.Add(result);
            }
            if (workItem is IAssignableItem)
            {
                foreach (var item in team.Members)
                {
                    if (item.WorkItems.Contains(workItem))
                    {
                        item.History.Add(result);
                        break;
                    }
                }
            }
            board.History.Add(result);
            team.History.Add(result);
            return(result);
        }