예제 #1
0
        public void AddComment_Success()
        {
            //Arrange
            CommonInstances.CreateTestInstances();
            var fakeMember    = new Member("TestMemberName");
            var fakeCurrTeam  = Commons.currentTeam;
            var fakeCurrBoard = Commons.currentBoard;

            fakeCurrTeam.Members.Add(fakeMember);
            var listParams = new List <string>()
            {
                "WorkItemTitle", "TestMemberName", "BlaBlaBla"
            };
            var workItem = new Bug("WorkItemTitle", "WorkItemDescription", Priority.High, Severity.Critical);

            fakeCurrBoard.WorkItems.Add(workItem);
            var fakeMemberProvider = new FakeMemberProvider();

            fakeMemberProvider.Add(fakeMember);

            var sut = new AddCommentCommand(listParams, fakeMemberProvider);

            //Act
            sut.Execute();

            //Assert
            Assert.AreEqual(1, workItem.Comments.Count);
        }
예제 #2
0
        public void AddComment_NoWorkItemToAddCommentTo_ThrowEx()
        {
            //Arrange
            CommonInstances.CreateTestInstances();
            var fakeCurrBoard = Commons.currentBoard;
            var listParams    = new List <string>()
            {
                "WorkItemTitle", "TestMemberName", "BlaBlaBla"
            };
            var workItem           = new Bug("WorkItemTitle", "WorkItemDescription", Priority.High, Severity.Critical);
            var fakeMemberProvider = new FakeMemberProvider();

            var sut = new AddCommentCommand(listParams, fakeMemberProvider);

            //Act & Assert
            Assert.ThrowsException <ArgumentException>(() => sut.Execute(), "No items in this board!");
        }
예제 #3
0
        public void AddComment_WorkItemNotInTheBoard_ThrowEx()
        {
            //Arrange
            CommonInstances.CreateTestInstances();
            var fakeMember    = new Member("TestMemberName");
            var fakeCurrTeam  = Commons.currentTeam;
            var fakeCurrBoard = Commons.currentBoard;
            var listParams    = new List <string>()
            {
                "WorkItemTitle", "TestMemberName", "BlaBlaBla"
            };
            var fakeMemberProvider = new FakeMemberProvider();

            var sut = new AddCommentCommand(listParams, fakeMemberProvider);

            //Act & Assert
            Assert.ThrowsException <ArgumentException>(() => sut.Execute(), $"Work item with title WorkItemTitle does not exist in board {fakeCurrBoard.Name}.");
        }
예제 #4
0
        public void BugCreation_Execute_Success()
        {
            //Arrange
            CommonInstances.CreateTestInstances();
            var fakeProvider = new FakeWorkItemProvider();

            var fakeCurrBoard = Commons.currentBoard;

            var listParams = new List <string>()
            {
                "WorkItemTitle", "WorkItemDescription", "High", "Critical"
            };

            var sut = new CreateBugCommand(listParams, fakeProvider);

            var result = sut.Execute();

            //Act & Assert
            Assert.AreEqual(result, $"WorkItemTitle bug added to {fakeCurrBoard} board!" + Commons.CreateBugText());
        }
예제 #5
0
        public void AddComment_MemberNotInTheTeam_ThrowEx()
        {
            //Arrange
            CommonInstances.CreateTestInstances();
            var fakeMember    = new Member("TestMemberName");
            var fakeCurrTeam  = Commons.currentTeam;
            var fakeCurrBoard = Commons.currentBoard;
            var listParams    = new List <string>()
            {
                "WorkItemTitle", "TestMemberName", "BlaBlaBla"
            };
            var workItem = new Bug("WorkItemTitle", "WorkItemDescription", Priority.High, Severity.Critical);

            fakeCurrBoard.WorkItems.Add(workItem);
            var fakeMemberProvider = new FakeMemberProvider();

            var sut = new AddCommentCommand(listParams, fakeMemberProvider);

            //Act & Assert
            Assert.ThrowsException <ArgumentException>(() => sut.Execute(), $"Member with name TestMemberName does not exist in team {fakeCurrTeam.Name}.");
        }
예제 #6
0
        public void BugCreation_Execute_SameTitleAlreadyExists_ThrowEx()
        {
            //Arrange
            CommonInstances.CreateTestInstances();
            var fakeProvider = new FakeWorkItemProvider();

            var fakeCurrBoard = Commons.currentBoard;

            var listParams = new List <string>()
            {
                "WorkItemTitle", "WorkItemDescription", "High", "Critical"
            };

            var workItem = new Bug("WorkItemTitle", "WorkItemDescription", Priority.High, Severity.Critical);

            fakeProvider.Add(workItem);

            var sut = new CreateBugCommand(listParams, fakeProvider);

            //Act & Assert
            Assert.ThrowsException <ArgumentException>(() => sut.Execute(), "Bug already exists!");
        }