예제 #1
0
        public void Execute_Success()
        {
            //Arrange
            Commons.currentTeam  = new Team("TeamName");
            Commons.currentBoard = new Board("BoardName");
            Commons.currentTeam.Boards.Add(Commons.currentBoard);
            var fakeMember    = new Member("TestMemberName");
            var fakeCurrTeam  = Commons.currentTeam;
            var fakeCurrBoard = Commons.currentBoard;

            fakeCurrTeam.Members.Add(fakeMember);
            var listParams = new List <string>()
            {
                "TestMemberName", "WorkItemTitle"
            };

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

            fakeCurrBoard.WorkItems.Add(workItem);

            var sut = new AssignCommand(listParams);

            //Act
            var result = sut.Execute();

            //Assert
            Assert.AreEqual(result, "TestMemberName has been assigned to WorkItemTitle");
        }
예제 #2
0
        public void Execute_NonAssigneeType_ThrowEx()
        {
            //Arrange
            Commons.currentTeam  = new Team("TeamName");
            Commons.currentBoard = new Board("BoardName");
            Commons.currentTeam.Boards.Add(Commons.currentBoard);
            var fakeMember    = new Member("TestMemberName");
            var fakeCurrTeam  = Commons.currentTeam;
            var fakeCurrBoard = Commons.currentBoard;

            fakeCurrTeam.Members.Add(fakeMember);
            var listParams = new List <string>()
            {
                "TestMemberName", "WorkItemTitle"
            };

            var workItem = new Feedback("WorkItemTitle", "WorkItemDescription", 3);

            fakeCurrBoard.WorkItems.Add(workItem);

            var sut = new AssignCommand(listParams);

            //Act & Assert
            Assert.ThrowsException <ArgumentException>(() => sut.Execute(), $"Work item WorkItemTitle is of type feedback and it is not supposed to have assignee.");
        }
        public void AssignCommand_AssignMemberToWorkItem()
        {
            var factory = new Mock <IFactory>();
            var command = new AssignCommand(new List <string>()
            {
                "Member1", "2"
            }, database, factory.Object);

            Assert.AreEqual("Work item: '2' assigned to 'Member1'.", command.Execute());
        }
예제 #4
0
        public void Execute_Less_Params_ThrowEx()
        {
            //Arrange
            var listParams = new List <string>()
            {
                "TeamMemberName"
            };

            var sut = new AssignCommand(listParams);

            //Act & Assert
            Assert.ThrowsException <ArgumentException>(() => sut.Execute(), "Parameters count is not valid!");
        }
예제 #5
0
        public void Execute_NonExistingWorkItem_ThrowEx()
        {
            //Arrange
            Commons.currentTeam  = new Team("TeamName");
            Commons.currentBoard = new Board("BoardName");
            Commons.currentTeam.Boards.Add(Commons.currentBoard);

            var fakeCurrTeam  = Commons.currentTeam;
            var fakeCurrBoard = Commons.currentBoard;

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

            var sut = new AssignCommand(listParams);

            //Act & Assert
            Assert.ThrowsException <ArgumentException>(() => sut.Execute(), $"Work item with title WorkItemTitle does not exist in board {fakeCurrBoard.Name}.");
        }
예제 #6
0
        public void Execute_NonExistingMember_ThrowEx()
        {
            //Arrange
            Commons.currentTeam  = new Team("TeamName");
            Commons.currentBoard = new Board("BoardName");
            Commons.currentTeam.Boards.Add(Commons.currentBoard);
            var fakeCurrTeam  = Commons.currentTeam;
            var fakeCurrBoard = Commons.currentBoard;

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

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

            fakeCurrBoard.WorkItems.Add(workItem);

            var sut = new AssignCommand(listParams);

            //Act & Assert
            Assert.ThrowsException <ArgumentException>(() => sut.Execute(), $"Member with name TestMemberName does not exist in team {fakeCurrTeam.Name}.");
        }