Exemple #1
0
        public void Test_RegisterUser_CorrectParameters_ShouldRegisterUser()
        {
            var tracker = new GithubIssueTracker(new GithubIssueTrackerData());
            string message = tracker.RegisterUser("Ivan", "qwerty", "qwerty");

            Assert.AreEqual("User Ivan registered successfully", message);
        }
Exemple #2
0
        public void Test_RegisterUser_NoMatcingPasswords_ShouldReturnErrorMessage()
        {
            var tracker = new GithubIssueTracker(new GithubIssueTrackerData());
            string message = tracker.RegisterUser("Ivan", "qwerty", "qwerty12");

            Assert.AreEqual("The provided passwords do not match", message);
        }
Exemple #3
0
        public void Test_CreateIssue_NotLoggedUser_ShouldReturnErrorMessage()
        {
            var tracker = new GithubIssueTracker(new GithubIssueTrackerData());
            string message = tracker.CreateIssue("Not working comments", "Comments functionnality does not work", IssuePriority.High, new[] { "comments" });

            Assert.AreEqual("There is no currently logged in user", message);
        }
Exemple #4
0
        public void Test_RegisterUser_DuplicateUsername_ShouldReturnErrorMessage()
        {
            var tracker = new GithubIssueTracker(new GithubIssueTrackerData());
            tracker.RegisterUser("Ivan", "qwerty", "qwerty");
            string message = tracker.RegisterUser("Ivan", "asd", "asd");

            Assert.AreEqual("A user with username Ivan already exists", message);
        }
Exemple #5
0
        public void Test_CreateIssue_InvalidDescription_ShouldReturnException()
        {
            var tracker = new GithubIssueTracker(new GithubIssueTrackerData());
            tracker.RegisterUser("Ivan", "qwerty", "qwerty");
            tracker.LoginUser("Ivan", "qwerty");

            tracker.CreateIssue("Not working comments", "aaaa", IssuePriority.High, new[] { "comment" });
        }
Exemple #6
0
        public void Test_CreateIssue_InvalidTitle_ShouldReturnException()
        {
            var tracker = new GithubIssueTracker(new GithubIssueTrackerData());
            tracker.RegisterUser("Ivan", "qwerty", "qwerty");
            tracker.LoginUser("Ivan", "qwerty");

            tracker.CreateIssue("aa", "Comments functionnality does not work", IssuePriority.High, new[] { "comment" });
        }
Exemple #7
0
        public void Test_RegisterUser_AlreadyLoggedUser_ShouldReturnErrorMessage()
        {
            var tracker = new GithubIssueTracker(new GithubIssueTrackerData());
            tracker.RegisterUser("Ivan", "qwerty", "qwerty");
            tracker.LoginUser("Ivan", "qwerty");
            string message = tracker.RegisterUser("Stefan", "asd", "asd");

            Assert.AreEqual("There is already a logged in user", message);
        }
Exemple #8
0
        public void Test_RegisterUsers_CorrectParameters_ShouldRegisterUsers()
        {
            var tracker = new GithubIssueTracker(new GithubIssueTrackerData());
            string firstMessage = tracker.RegisterUser("Ivan", "qwerty", "qwerty");
            string secondMessage = tracker.RegisterUser("Stefan", "asd", "asd");

            Assert.AreEqual("User Ivan registered successfully", firstMessage);
            Assert.AreEqual("User Stefan registered successfully", secondMessage);
        }
Exemple #9
0
        public void Test_CreateIssue_CorrectParameters_ShouldCreateIssue()
        {
            var tracker = new GithubIssueTracker(new GithubIssueTrackerData());
            tracker.RegisterUser("Ivan", "qwerty", "qwerty");
            tracker.LoginUser("Ivan", "qwerty");

            string message = tracker.CreateIssue("Not working comments", "Comments functionnality does not work", IssuePriority.High, new[] { "comments" });

            Assert.AreEqual("Issue 1 created successfully", message);
        }
Exemple #10
0
        public void Test_GetMyIssues_NotLogged_ShouldReturnErrorMessage()
        {
            var tracker = new GithubIssueTracker(new GithubIssueTrackerData());
            tracker.RegisterUser("Ivan", "qwerty", "qwerty");
            tracker.LoginUser("Ivan", "qwerty");

            tracker.CreateIssue("New issue2", "This is a new issue2", IssuePriority.High, new[] { "issue2" });
            tracker.CreateIssue("New issue1", "This is a new issue1", IssuePriority.High, new[] { "issue1" });
            tracker.LogoutUser();
            string message = tracker.GetMyIssues();

            Assert.AreEqual("There is no currently logged in user", message);
        }
Exemple #11
0
        public void Test_GetMyIssues_SingleIssue_ShouldReturnIssues()
        {
            var tracker = new GithubIssueTracker(new GithubIssueTrackerData());
            tracker.RegisterUser("Ivan", "qwerty", "qwerty");
            tracker.LoginUser("Ivan", "qwerty");

            tracker.CreateIssue("New issue", "This is a new issue", IssuePriority.High, new[] { "issue" });
            string message = tracker.GetMyIssues();

            Assert.AreEqual(
                "New issue\r\n" +
                "Priority: ***\r\n" +
                "This is a new issue\r\n" +
                "Tags: issue",
                message);
        }
Exemple #12
0
        public void Test_SearchForIssues_SomeIssues_ShouldReturnDistinctIssues()
        {
            var tracker = new GithubIssueTracker(new GithubIssueTrackerData());
            tracker.RegisterUser("Ivan", "qwerty", "qwerty");
            tracker.LoginUser("Ivan", "qwerty");

            tracker.CreateIssue("Some issue", "This is a new issue", IssuePriority.High, new[] { "issue" });
            tracker.CreateIssue("New issue error", "This is a new issue error", IssuePriority.High, new[] { "issue", "issue_error" });
            string message = tracker.SearchForIssues(new[] { "issue", "issue_error" });

            Assert.AreEqual(
                "New issue error\r\n" +
                "Priority: ***\r\n" +
                "This is a new issue error\r\n" +
                "Tags: issue,issue_error\r\n" +
                "Some issue\r\n" +
                "Priority: ***\r\n" +
                "This is a new issue\r\n" +
                "Tags: issue",
                message);
        }
Exemple #13
0
        public void Test_GetMyIssues_NoIssues_ShouldReturnNoIssuesMessage()
        {
            var tracker = new GithubIssueTracker(new GithubIssueTrackerData());
            tracker.RegisterUser("Ivan", "qwerty", "qwerty");
            tracker.LoginUser("Ivan", "qwerty");
            string message = tracker.GetMyIssues();

            Assert.AreEqual("No issues", message);
        }
Exemple #14
0
        public void Test_SearchForIssues_NoMatchingTags_ShouldReturnNoIssues()
        {
            var tracker = new GithubIssueTracker(new GithubIssueTrackerData());
            tracker.RegisterUser("Ivan", "qwerty", "qwerty");
            tracker.LoginUser("Ivan", "qwerty");

            tracker.CreateIssue("Some issue", "This is a new issue", IssuePriority.High, new[] { "issue" });
            tracker.CreateIssue("New issue error", "This is a new issue error", IssuePriority.High, new[] { "issue", "issue_error" });
            string message = tracker.SearchForIssues(new[] { "comment_issue" });

            Assert.AreEqual("There are no issues matching the tags provided", message);
        }