public void ShowAllTeamBoardsPrint()
        {
            string teamName = "Tigrite88";
            ITeam  team     = new Team(teamName);

            string boardName = "Board";
            IBoard board     = new Board(boardName);

            database.Teams.Add(team);
            database.Boards.Add(board);
            team.Boards.Add(board);

            List <string> parameters = new List <string>
            {
                teamName
            };

            ShowAllTeamBoardsCommand command = new ShowAllTeamBoardsCommand(parameters);

            var sb = new StringBuilder();

            sb.AppendLine($"***TEAM: {teamName}***");
            sb.AppendLine("***BOARDS***");
            foreach (var item in team.Boards)
            {
                sb.AppendLine(item.PrintDetails());
            }
            string expected = sb.ToString();
            string actual   = command.Execute();

            Assert.AreEqual(expected, actual);
        }
        public void ThrowsExceptionWhenLessParametersPassed()
        {
            string teamName = "Tigrite23";
            ITeam  team     = new Team(teamName);

            string boardName = "Board";
            IBoard board     = new Board(boardName);

            database.Boards.Add(board);
            database.Teams.Add(team);
            team.Boards.Add(board);

            List <string> parameters = new List <string>()
            {
            };

            ShowAllTeamBoardsCommand command = new ShowAllTeamBoardsCommand(parameters);

            command.Execute();
        }
        public void ThrowsExceptionWhenTeamNameIsNull()
        {
            string teamName = null;
            ITeam  team     = new Team(teamName);

            string boardName = "Board";
            IBoard board     = new Board(boardName);

            database.Boards.Add(board);
            database.Teams.Add(team);
            team.Boards.Add(board);

            List <string> parameters = new List <string>()
            {
                teamName,
                boardName
            };

            ShowAllTeamBoardsCommand command = new ShowAllTeamBoardsCommand(parameters);

            command.Execute();
        }
Example #4
0
        public void Throw_When_A_Passed_Team_Is_Null()
        {
            //Arrange
            var   validTeamName = "validTeam";
            ITeam team          = null;
            var   fakeGetters   = new Mock <IGetters>();
            var   fakeHistoryItemsCollection = new Mock <IHistoryItemsCollection>();
            var   sut      = new ShowAllTeamBoardsCommand(fakeGetters.Object, fakeHistoryItemsCollection.Object);
            var   fakeList = new List <string>()
            {
                validTeamName
            };

            //Arrange
            fakeGetters.Setup(x => x.GetTeam(validTeamName)).Returns(team);
            var expectedMessage = string.Format(Consts.NULL_OBJECT, nameof(team));

            //Act,Assert
            var realMessage = Assert.ThrowsException <ArgumentException>(() => sut.Execute(fakeList));

            //Assert
            Assert.AreEqual(expectedMessage, realMessage.Message);
        }