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());
        }
        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 SearchIssues_ValidTag_ShouldReturnIssues()
        {
            this.data.LoggedInUser = new User("admin", "Password123");
            var inputTags = new string[] {"issue"};
            var issue3Tags = new string[] { "problem" };
            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());
            var issue3 = new Issue("problem", "problem description", IssuePriority.Low, issue3Tags.ToList());
            
            this.tracker.CreateIssue("issue 1", "issue description 1", IssuePriority.High, inputTags);
            this.tracker.CreateIssue("issue 2", "issue description 2", IssuePriority.Medium, inputTags);
            this.tracker.CreateIssue("problem", "problem description", IssuePriority.Low, issue3Tags);
            var issues = this.data.TagIssues["issue"]
                         .Distinct()
                         .OrderByDescending(x => x.Priority)
                         .ThenBy(x => x.Title);
            var expected = string.Join(Environment.NewLine, issues);

            var result = this.tracker.SearchForIssues(inputTags);

            Assert.AreEqual(expected, result);
        }