public void CanAddPlayersToDraft()
        {
            IDraftMemberPositionsRepository repository = new DraftMemberPositionsRepository();

            Draft draft1 = _drafts[1];
            Member member1 = _members[0];
            Member member2 = _members[1];
            Member member3 = _members[2];
            Member member4 = _members[3];

            repository.AddMemberToDraft(draft1, member1, 4);
            repository.AddMemberToDraft(draft1, member2, 3);
            repository.AddMemberToDraft(draft1, member3, 2);
            repository.AddMemberToDraft(draft1, member4, 1);

            int positionFromDb = repository.GetDraftPosition(draft1, member1);
            Assert.AreEqual(4, positionFromDb);

            positionFromDb = repository.GetDraftPosition(draft1, member2);
            Assert.AreEqual(3, positionFromDb);

            positionFromDb = repository.GetDraftPosition(draft1, member3);
            Assert.AreEqual(2, positionFromDb);

            positionFromDb = repository.GetDraftPosition(draft1, member4);
            Assert.AreEqual(1, positionFromDb);
        }
        public bool AddMemberToDraft(int draftId, int memberId, int draftPosition)
        {
            IDraftMemberPositionsRepository dmpr = new DraftMemberPositionsRepository();
            IDraftRepository dr = new DraftRepository();
            IMemberRepository mr = new MemberRepository();

            try
            {
                var draft = dr.GetById(draftId);
                dmpr.AddMemberToDraft(draft, mr.GetById(memberId), draftPosition);
                draft.DraftSize++;
                dr.Update(draft);
                return true;
            }
            catch
            {
                return false;
            }
        }
        public bool AddMemberToDraft(int draftId, int memberId)
        {
            IDraftMemberPositionsRepository dmpr = new DraftMemberPositionsRepository();
            IDraftRepository dr = new DraftRepository();
            IMemberRepository mr = new MemberRepository();

            var draft = dr.GetById(draftId);

            ICollection<DraftMemberPositions> draftMembers = dmpr.GetMemberPositionsByDraft(draft);

            int newPosition = 0;
            bool foundPosition = true;

            while (foundPosition)
            {
                foundPosition = false;
                newPosition++;

                foreach (var draftMember in draftMembers)
                {
                    if (draftMember.Position == newPosition)
                    {
                        foundPosition = true;
                    }
                }

            }
            try
            {
                dmpr.AddMemberToDraft(draft, mr.GetById(memberId), newPosition);
                draft.DraftSize++;
                dr.Update(draft);
                return true;
            }
            catch
            {
                return false;
            }
        }
        public void CanAddPlayerToDraft()
        {
            IDraftMemberPositionsRepository repository = new DraftMemberPositionsRepository();

            Draft draft1 = _drafts[1];
            Member member1 = _members[0];

            repository.AddMemberToDraft(draft1, member1, 4);

            int positionFromDb = repository.GetDraftPosition(draft1, member1);

            Assert.AreEqual(4, positionFromDb);
        }
        public void CreateInitialData()
        {
            using (ISession session = _sessionFactory.OpenSession())
            using (ITransaction transaction = session.BeginTransaction())
            {
                foreach (var draft in _drafts)
                    session.Save(draft);

                foreach (var member in _members)
                    session.Save(member);

                transaction.Commit();

                IDraftMemberPositionsRepository repository = new DraftMemberPositionsRepository();

                repository.AddMemberToDraft(_drafts[0], _members[0], 1);
                repository.AddMemberToDraft(_drafts[0], _members[1], 2);
                repository.AddMemberToDraft(_drafts[0], _members[2], 3);
                repository.AddMemberToDraft(_drafts[0], _members[3], 4);
                repository.AddMemberToDraft(_drafts[2], _members[3], 1);

            }
        }