public List <AvailTeamMember> getTeamMember(int teamId)
        {
            List <AvailTeamMember> availteam = new List <AvailTeamMember>();
            List <TeamMember>      teammas   = _taskBacklog.AllTeamMember();

            foreach (TeamMember tm in teammas)
            {
                if (tm.TeamId == teamId)
                {
                    User            master = _taskBacklog.Master(tm.MemberId);
                    AvailTeamMember avail  = new AvailTeamMember();
                    avail.MemberId   = master.Id;
                    avail.MemberName = master.FirstName + ' ' + master.LastName;
                    avail.TeamId     = tm.TeamId;
                    avail.Id         = tm.Id;
                    availteam.Add(avail);
                }
            }
            return(availteam);
        }
Exemplo n.º 2
0
        public void TestForGetAvailableMembers()
        {
            //Arrange
            List <AvailTeamMember> member = new List <AvailTeamMember>();
            var mem = new AvailTeamMember()
            {
                Id = 1,
            };
            var mockRepo = new Mock <ITeamRepo>();

            mockRepo.Setup(m => m.GetProjectMember(It.IsAny <int>()));
            mockRepo.Setup(m => m.GetTeamMember(It.IsAny <int>()));
            TeamService serObj = new TeamService(mockRepo.Object);


            //Act
            var result = Record.Exception(() => serObj.GetAvailableMember(101));

            //Assert
            Assert.IsType <NullReferenceException>(result);
        }
        //this method will return available members in a project
        public List <AvailTeamMember> GetAvailableMember(int projectId)
        {
            List <AvailTeamMember> availTeam    = new List <AvailTeamMember>();
            List <Projectmembers>  promem       = _teamRepo.GetProjectmembers(projectId);
            List <TeamMember>      finalmemlist = new List <TeamMember>();
            List <TeamMember>      teammem      = new List <TeamMember>();
            List <TeamMaster>      teams        = GetTeam(projectId);

            foreach (TeamMaster tm in teams)
            {
                teammem = _teamRepo.GetTeamMember(tm.TeamId);
                foreach (TeamMember temem in teammem)
                {
                    finalmemlist.Add(temem);
                }
            }
            foreach (Projectmembers pm in promem)
            {
                User            master = _teamRepo.Master(pm.MemberId);
                AvailTeamMember avail  = new AvailTeamMember();
                avail.MemberId   = master.Id;
                avail.MemberName = master.FirstName + ' ' + master.LastName;
                foreach (TeamMember tmm in finalmemlist)
                {
                    if (pm.MemberId == tmm.MemberId)
                    {
                        avail.TeamId = tmm.TeamId;
                        avail.Id     = tmm.Id;
                        break;
                    }
                    else
                    {
                        avail.TeamId = 0;
                        avail.Id     = 0;
                    }
                }
                availTeam.Add(avail);
            }
            return(availTeam);
        }
Exemplo n.º 4
0
        public void SignUpServiceUnitTest_to_GetTeamMember_for_NotNull()
        {
            //Arrange
            List <AvailTeamMember> teams = new List <AvailTeamMember>();
            var team = new AvailTeamMember();
            List <TeamMember> members = new List <TeamMember>();
            var member = new TeamMember()
            {
                TeamId = 1
            };

            teams.Add(team);
            var mockRepoTask = new Mock <ITaskBacklogReposiory>();

            mockRepoTask.Setup(x => x.AllTeamMember()).Returns(members);
            TaskBacklogService obj = new TaskBacklogService(mockRepoTask.Object);
            //Act
            var res = obj.getTeamMember(1);

            //Assert
            Assert.NotNull(res);
            Assert.Equal(teams.ToString(), res.ToString());
        }