public void AddIssue(Problem issue)
 {
     this.Issues.Add(issue.Id, issue);
     this.UsersAndIssues[this.LoggedUser.Username].Add(issue);
     foreach (var tag in issue.Tags)
     {
         this.TagsAndIssues[tag].Add(issue);
     }
 }
 public void TestSearchForIssueWhenOneMathcingTagsGivenShouldReturnOneMatchingResult()
 {
     var username = "******";
     var password = "******";
     this.tracker.RegisterUser(username, password, password);
     this.tracker.LoginUser(username, password);
     this.tracker.CreateIssue("asa", "asdasd", IssuePriority.High, new string[] { "a", "b" });
     var message = this.tracker.SearchForIssues(new[] { "a" });
     var resultMessage = new Problem(1, "asa", "asdasd", IssuePriority.High, new List<string>() { "a", "b" }).ToString();
     Assert.AreEqual(resultMessage, message);
 }
 public void TestSearchForIssueWhenMathcingTagsGivenShouldReturnOrderedMatchingResult()
 {
     var username = "******";
     var password = "******";
     this.tracker.RegisterUser(username, password, password);
     this.tracker.LoginUser(username, password);
     this.tracker.CreateIssue("some", "issue", IssuePriority.Low, new string[] { "a", "b", "c" });
     this.tracker.CreateIssue("other", "missue", IssuePriority.High, new string[] { "a", "b", "c" });
     var message = tracker.SearchForIssues(new[] { "a" });
     var expectedMessage =
         new Problem(2, "other", "missue", IssuePriority.High, new List<string>() { "a", "b", "c" }) +
         Environment.NewLine +
         new Problem(1, "some", "issue", IssuePriority.Low, new List<string>() { "a", "b", "c" });
     Assert.AreEqual(expectedMessage, message);
 }
        public void RemoveIssue(Problem issue)
        {
            this.UsersAndIssues[this.LoggedUser.Username].Remove(issue);
            foreach (var tag in issue.Tags)
            {
                this.TagsAndIssues[tag].Remove(issue);
            }

            this.Issues.Remove(issue.Id);
        }