public void ListItem_ListBugsStatusAssigneeSorted()
        {
            var factory = new Mock <IFactory>();
            var bug     = new FakeBug("10");
            var member  = new FakeMember("Member10");

            bug.AddAssignee(member);
            var bug2 = new FakeBug("11");

            bug.AddAssignee(member);
            bug2.AddAssignee(member);
            database.AddMemberToDB(member);
            database.AddWorkItemToDB(bug);
            database.AddWorkItemToDB(bug2);
            bug.Title  = "Title for Bug.";
            bug2.Title = "Bug title";
            var allBugs = database.GetAllWorkItems().OfType <FakeBug>()
                          .Where(b => (b.Status.ToString().Equals("active", StringComparison.OrdinalIgnoreCase)) &&
                                 (b.Assignee != null && b.Assignee.Name.Equals("Member10", StringComparison.OrdinalIgnoreCase))).ToList()
                          .OrderBy(b => b.Title).ToList();
            var result = new ListWorkItemsCommand(new List <string>()
            {
                "bug", "active", "Member10", "title"
            }, database, factory.Object).Execute();

            Assert.AreEqual(string.Join("\n", allBugs), result);
        }
        public void ListItem_ThrowWhen_CantSort4params()
        {
            var factory = new Mock <IFactory>();
            var bug     = new FakeBug("10");
            var member  = new FakeMember("Member10");

            bug.AddAssignee(member);
            var bug2 = new FakeBug("11");

            bug.AddAssignee(member);
            bug2.AddAssignee(member);
            database.AddMemberToDB(member);
            database.AddWorkItemToDB(bug);
            database.AddWorkItemToDB(bug2);
            bug.Title  = "Title for Bug.";
            bug2.Title = "Bug title";

            var result = Assert.ThrowsException <ArgumentException>(() =>
                                                                    new ListWorkItemsCommand(new List <string>()
            {
                "bug", "active", "Member10", "filter"
            }, database, factory.Object).Execute());

            Assert.AreEqual("There is no filter: 'filter' for bug.", result.Message);
        }
コード例 #3
0
        public void SeedData()
        {
            var member1  = new FakeMember("Member1");
            var member2  = new FakeMember("Member2");
            var member3  = new FakeMember("Member3");
            var team1    = new FakeTeam("Team1");
            var team2    = new FakeTeam("Team2");
            var board1   = new FakeBoard("Board1");
            var board2   = new FakeBoard("Board2");
            var board3   = new FakeBoard("Board3");
            var feedback = new FakeFeedback("1");
            var story    = new FakeStory("2");

            database.AddTeamToDB(team1);
            database.AddTeamToDB(team2);
            database.AddMemberToDB(member1);
            database.AddMemberToDB(member2);
            database.AddMemberToDB(member3);
            database.AddWorkItemToDB(feedback);
            database.AddWorkItemToDB(story);

            team2.AddMember(member1);
            team1.AddBoard(board1);
            team2.AddBoard(board2);
            team2.AddBoard(board3);
            board1.AddWorkItem(feedback);
            board2.AddWorkItem(story);
            member1.AddWorkItems(story);
            member1.AddWorkItems(feedback);
        }
コード例 #4
0
        public void AddMemberShould_MemberAdded()
        {
            var member = new FakeMember();
            var team   = new Team("Team1");

            team.AddMember(member);
            Assert.AreEqual(team.Members.Count, 1);
        }
コード例 #5
0
        public void GetAssigneeShould_ReturnAssignee()
        {
            var bug    = new Bug("1", "TheFirstBug", PriorityType.High, SeverityType.Critical, new List <string>(), "This is a description for a bug");
            var member = new FakeMember();

            bug.AddAssignee(member);
            Assert.IsTrue(bug.GetAssignee() == member);
        }
コード例 #6
0
        public void AddAssigneeShould_AssigneeAdded()
        {
            var story  = new Story("1", "This is the story 12 title", PriorityType.High, SizeType.Large, "this is the story 12 description");
            var member = new FakeMember();

            story.AddAssignee(member);
            Assert.IsTrue(story.Assignee == member);
        }
コード例 #7
0
        public void RemoveAssigneeShould_AssigneeRemoved()
        {
            var bug    = new Bug("1", "TheFirstBug", PriorityType.High, SeverityType.Critical, new List <string>(), "This is a description for a bug");
            var member = new FakeMember();

            bug.AddAssignee(member);
            bug.RemoveAssignee();
            Assert.IsTrue(bug.Assignee == null);
        }
コード例 #8
0
        public void Should_AddMember()
        {
            var db     = Database.Instance;
            var member = new FakeMember();

            db.AddMemberToDB(member);

            Assert.IsTrue(db.AllMembers.Contains(member));
        }
コード例 #9
0
        public void AddAssigneeShould_ThrowWhen_AssigneeExists()
        {
            var story  = new Story("1", "This is the story 12 title", PriorityType.High, SizeType.Large, "this is the story 12 description");
            var member = new FakeMember("Member1");

            story.AddAssignee(member);
            var result = Assert.ThrowsException <ArgumentException>(() => story.AddAssignee(member));

            Assert.AreEqual("Story already assigned to 'Member1'", result.Message);
        }
コード例 #10
0
        public void Returns_Member()
        {
            var db     = Database.Instance;
            var member = new FakeMember("Member2");

            db.AddMemberToDB(member);
            var expected = db.GetMember("Member2");

            Assert.AreEqual(member, expected);
        }
コード例 #11
0
        public void AddAssigneeShould_ThrowWhen_AssigneeExists()
        {
            var bug    = new Bug("1", "TheFirstBug", PriorityType.High, SeverityType.Critical, new List <string>(), "This is a description for a bug");
            var member = new FakeMember("Member1");

            bug.AddAssignee(member);
            var result = Assert.ThrowsException <ArgumentException>(() => bug.AddAssignee(member));

            Assert.AreEqual("Bug already assigned to 'Member1'", result.Message);
        }
コード例 #12
0
        public void ThrowWhen_MemberDoesNotHaveWorkItem()
        {
            var validator = new Validator(database);
            var member    = new FakeMember("Member1");
            var workItem  = new FakeFeedback();

            workItem.Id = "1";
            var result = Assert.ThrowsException <ArgumentException>(() => validator.MemberHasWorkItem(workItem, member));

            Assert.AreEqual("Member: 'Member1' does not have access to work item: '1'.", result.Message);
        }
コード例 #13
0
        public void ThrowWhen_AlreadyExists()
        {
            var validator = new Validator(database);

            var member = new FakeMember("Member1");
            var team   = new FakeTeam("Team1");

            team.AddMember(member);
            var result = Assert.ThrowsException <ArgumentException>(() => validator.MemberExistsInTeam("Member1", team));

            Assert.AreEqual("Member: 'Member1' already exist in team: 'Team1'.", result.Message);
        }
コード例 #14
0
        public void AddCommentsShould_AddSuccesfully()
        {
            var feedback = new Feedback("1", "TheFirstFeedback", 3, "This is a feedback created");
            var member   = new FakeMember();
            var list     = new List <string>()
            {
                "Comments added."
            };
            IDictionary <IMember, IList <string> > comments = new Dictionary <IMember, IList <string> >();

            comments.Add(member, list);
            feedback.AddComment(member, list);
            CollectionAssert.AreEquivalent((ICollection)feedback.Comments, (ICollection)comments);
        }
コード例 #15
0
        public void Assign_Removed()
        {
            var factory = new Mock <IFactory>();
            var member  = new FakeMember("Member5");
            var story   = new FakeStory("5");

            database.AddMemberToDB(member);
            database.AddWorkItemToDB(story);
            story.AddAssignee(member);
            var result = new UnassignCommand(new List <string>()
            {
                "5"
            }, database, factory.Object).Execute();

            Assert.IsTrue(story.Assignee == null);
            Assert.AreEqual("Work item: '5' unassigned", result);
        }
        public void ListItem_ListBugsAssignee()
        {
            var factory = new Mock <IFactory>();
            var bug     = new FakeBug("10");
            var member  = new FakeMember("Member10");

            bug.AddAssignee(member);
            database.AddMemberToDB(member);
            database.AddWorkItemToDB(bug);
            var allBugs = database.GetAllWorkItems().OfType <FakeBug>()
                          .Where(b => b.Assignee != null && b.Assignee.Name.Equals("Member10", StringComparison.OrdinalIgnoreCase)).ToList();
            var result = new ListWorkItemsCommand(new List <string>()
            {
                "bug", "Member10"
            }, database, factory.Object).Execute();

            Assert.AreEqual(string.Join("\n", allBugs), result);
        }
コード例 #17
0
        public void ShowTeamActivity_ShowMemberAndBoardActivity()
        {
            var           factory = new Mock <IFactory>();
            StringBuilder sb      = new StringBuilder();
            var           team    = new FakeTeam("Team5");

            database.AddTeamToDB(team);
            var board = new FakeBoard();

            team.AddBoard(board);
            var f1 = new FakeFeedback("5");

            board.AddWorkItem(f1);
            var f2 = new FakeFeedback("6");

            board.AddWorkItem(f2);
            var member = new FakeMember("Member5");

            database.AddMemberToDB(member);
            team.AddMember(member);
            var f3 = new FakeFeedback("7");

            member.AddWorkItems(f3);

            sb.AppendLine($"Team: 'Team5' - Boards activity: ");
            var activityTeam = team.Boards.SelectMany(b => b.ActivityHistory).ToList();

            sb.AppendLine(string.Join("; ", activityTeam));

            sb.AppendLine($"Team: 'Team5' - Members activity: ");
            var activityMembers = team.Members.SelectMany(m => m.ActivityHistory).ToList();

            sb.AppendLine(string.Join("; ", activityMembers));

            var result = new ShowTeamActivityCommand(new List <string>()
            {
                "Team5"
            }, database, factory.Object).Execute();

            Assert.AreEqual(sb.ToString(), result);
        }