Exemplo n.º 1
0
        public void TestSearchForIssues_MatchingTags_ShouldReturnIssuesasStringAndNoDuplicates_Test3()
        {
            IBuhtigIssueTrackerData data    = new FakeBuhtigTrackerData();
            IIssueTracker           tracker = new FakeIssueTrackerWithLoggedUser(data);

            string actualResult = tracker.SearchForIssues(new string[] { "pink", "green" });

            string        title1       = "title1";
            string        description1 = "description1";
            IssuePriority priority1    = (IssuePriority)Enum.Parse(typeof(IssuePriority), "low");

            string[] tags1 = new string[] { "new", "issue", "pink" };

            string        title3       = "smalltitle";
            string        description3 = "smalldescription";
            IssuePriority priority3    = (IssuePriority)Enum.Parse(typeof(IssuePriority), "medium");

            string[] tags3 = new string[] { "green", "issue", "new" };

            User         pesho  = new User("pesho", "parola");
            User         gosho  = new User("gosho", "parola");
            Issue        issue1 = new Issue(title1, description1, priority1, tags1, pesho);
            Issue        issue3 = new Issue(title3, description3, priority3, tags3, gosho);
            List <Issue> issues = new List <Issue>();

            issues.Add(issue1);
            issues.Add(issue3);
            var sortedIssues = issues.OrderByDescending(issue => issue.Priority).ThenBy(issue => issue.Title);

            string expectedResult = string.Join("", sortedIssues);

            Assert.AreEqual(expectedResult, actualResult, "SearchForIssues() does not get issues properly.");
        }
Exemplo n.º 2
0
        public void TestGetMyIssues_ShouldReturnCurrentUserIssues()
        {
            IBuhtigIssueTrackerData data    = new FakeBuhtigTrackerData();
            IIssueTracker           tracker = new FakeIssueTrackerWithLoggedUser(data);

            string actualResult = tracker.GetMyIssues();

            string        title1       = "title1";
            string        description1 = "description1";
            IssuePriority priority1    = (IssuePriority)Enum.Parse(typeof(IssuePriority), "low");

            string[] tags1 = new string[] { "new", "issue", "pink" };

            string        title2       = "bigtitle";
            string        description2 = "bigdescription";
            IssuePriority priority2    = (IssuePriority)Enum.Parse(typeof(IssuePriority), "medium");

            string[] tags2 = new string[] { "new", "issue", "yellow" };

            User         pesho  = new User("pesho", "parola");
            User         gosho  = new User("gosho", "parola");
            Issue        issue1 = new Issue(title1, description1, priority1, tags1, pesho);
            Issue        issue2 = new Issue(title2, description2, priority2, tags2, pesho);
            List <Issue> issues = new List <Issue>();

            issues.Add(issue1);
            issues.Add(issue2);
            var sortedIssues = issues.OrderByDescending(issue => issue.Priority).ThenBy(issue => issue.Title);

            string expectedResult = string.Join("", sortedIssues);

            Assert.AreEqual(expectedResult, actualResult, "GetMyIssues() does not get issues properly.");
        }
Exemplo n.º 3
0
        public void TestSearchForIssues_NoIssuesMatchingTheTags_ShouldReturnMessageAsString()
        {
            IBuhtigIssueTrackerData data    = new FakeBuhtigTrackerData();
            IIssueTracker           tracker = new FakeIssueTrackerWithLoggedUser(data);

            string actualResult = tracker.SearchForIssues(new string[] { "brown", "grey", "black" });

            string expectedResult = "There are no issues matching the tags provided";

            Assert.AreEqual(expectedResult, actualResult,
                            "SearchForIssues() does not show proper message in case of mismatching tags array.");
        }
Exemplo n.º 4
0
        public void TestSearchForIssues_EmptyTagsArray_ShouldReturnMessageAsString()
        {
            IBuhtigIssueTrackerData data    = new FakeBuhtigTrackerData();
            IIssueTracker           tracker = new FakeIssueTrackerWithLoggedUser(data);

            string actualResult = tracker.SearchForIssues(new string[] {});

            string expectedResult = "There are no tags provided";

            Assert.AreEqual(expectedResult, actualResult,
                            "SearchForIssues() does not show proper message in case of empty tags array.");
        }