public void GetMyIssues_LoggedInUser_ShouldReturnUsersIssues() { this.data.LoggedInUser = new User("admin", "Password123"); var inputTags = new string[] { "tag1" }; var issue1 = new Issue("issue 1", "issue description 1", IssuePriority.High, inputTags.ToList()); var issue2 = new Issue("issue 2", "issue description 2", IssuePriority.Medium, inputTags.ToList()); StringBuilder userIssues = new StringBuilder(); userIssues.AppendLine(issue1.ToString()); userIssues.AppendLine(issue2.ToString()); this.tracker.CreateIssue("issue 1", "issue description 1", IssuePriority.High, inputTags); this.tracker.CreateIssue("issue 2", "issue description 2", IssuePriority.Medium, inputTags); var result = this.tracker.GetMyIssues(); Assert.AreEqual(userIssues.ToString().Trim(), result); }
public void CreateIssue_CreateIssueValidData_ShouldCreateAndReturnSuccessMessage() { this.data.LoggedInUser = new User("admin", "Password123"); var tags = new List<string> {"tag1"}; var inputTags = new string[] { "tag1" }; var issue = new Issue("issue", "issue description", IssuePriority.High, tags); var issueId = 1; var result = this.tracker.CreateIssue("issue", "issue description", IssuePriority.High, inputTags); var successMessage = string.Format("Issue {0} created successfully.", issueId); Assert.AreEqual(successMessage, result); Assert.IsTrue(this.data.Issues.ContainsKey(issueId)); Assert.AreEqual(issue.ToString(), this.data.Issues[1].ToString()); }