private void PrepareMember(BoardMember trelloBoardMember, TeamMember dbtm)
 {
     if (dbtm == null)
     {
         var teamMember = new TeamMember
         {
             TrelloId = trelloBoardMember.Id,
             FullName = trelloBoardMember.FullName
         };
         _hackTrackDbContext.TeamMembers.Add(teamMember);
     }
     else
     {
         dbtm.FullName = trelloBoardMember.FullName;
         _hackTrackDbContext.Entry(dbtm).State = EntityState.Modified;
     }
 }
        public void GivenATrelloBoardMemberWhenPersistingTeamMembers()
        {
            _trelloBoardMember = new BoardMember
            {
                Id = Guid.NewGuid().ToString()
            };

            _mockTeamMembers = new InMemoryDbSet<TeamMember>();

            _mockHackTrackDbContext = new Mock<IHackTrackDbContext>();
            _mockHackTrackDbContext
                .SetupGet(context => context.TeamMembers)
                .Returns(_mockTeamMembers);
            _mockHackTrackDbContext
                .Setup(context => context.SaveChanges());

            var service = new TrelloMemberPersistenceService(_mockHackTrackDbContext.Object);
            service.PersistMember(_trelloBoardMember);
        }
        public IEnumerable<BoardCard> GetCurrentCardsForMember(BoardMember member)
        {
            var cards = _trelloService.Cards
                .ForMember(new MemberId(member.Id))
                .Where(c => c.IdBoard == _board.Id);

            var columns = _trelloService.Lists.ForBoard(_board);

            return cards
                .Where(c => c.IdList != columns.First().Id
                            && c.IdList != columns.Last().Id)
                .Select(card => new BoardCard
                {
                    Id = card.Id,
                    Name = card.Name,
                    CardNumber = card.IdShort,
                    BoardId = card.IdBoard,
                    ListId = card.IdList,
                    Checklists = ConvertChecklists(card.Checklists)
                });
        }
 public void PersistMember(BoardMember trelloBoardMember)
 {
     PersistMembers(new[] {trelloBoardMember});
 }