public void CanDoSimple4PlayerDraft()
        {
            IDraftLogic draftLogic = new ModifiedRotisserieDraftLogic();
            var draft = draftLogic.CreateDraft("My Testdraft", _members[1].Id, 75, true);
            for (var i = 0; i < 4; i++)
            {
                draftLogic.AddMemberToDraft(draft.Id, _members[i].Id);
            }

            draftLogic.StartDraft(draft.Id, false);

            using (var sl = new SystemLogic())
            {
                var wasPicked = draftLogic.PickCard(draft.Id, _members[1].Id, _cards[1].Id);
                Assert.IsFalse(wasPicked, "Not Player Bs turn");

                // Card should end up in _member[1]s FuturePick.
                var futurePicks = sl.GetMyFuturePicks(draft.Id, _members[1].Id);
                Assert.AreEqual(1, futurePicks.Count);

                wasPicked = draftLogic.PickCard(draft.Id, _members[0].Id, _cards[0].Id);
                Assert.IsTrue(wasPicked, "Player A should be able to pick");

                // We should now have two picks total in this draft.
                var picks = sl.GetPickList(draft.Id);
                Assert.AreEqual(2, picks.Count);

                //And _member[1] should have no FuturePicks
                futurePicks = sl.GetMyFuturePicks(draft.Id, _members[1].Id);
                Assert.AreEqual(0, futurePicks.Count);

                Assert.IsTrue(draftLogic.IsMyTurn(draft.Id, _members[2].Id), "Should be Player Cs turn");

                wasPicked = draftLogic.PickCard(draft.Id, _members[2].Id, _cards[2].Id);
                Assert.IsTrue(wasPicked, "It should be Player C");

                wasPicked = draftLogic.PickCard(draft.Id, _members[3].Id, _cards[3].Id);
                Assert.IsTrue(wasPicked, "It should be Player D");

                wasPicked = draftLogic.PickCard(draft.Id, _members[3].Id, _cards[4].Id);
                Assert.IsTrue(wasPicked, "It should be Player D");

                wasPicked = draftLogic.PickCard(draft.Id, _members[2].Id, _cards[5].Id);
                Assert.IsTrue(wasPicked, "It should be Player C");

                wasPicked = draftLogic.PickCard(draft.Id, _members[1].Id, _cards[6].Id);
                Assert.IsTrue(wasPicked, "It should be Player B");

                wasPicked = draftLogic.PickCard(draft.Id, _members[0].Id, _cards[7].Id);
                Assert.IsTrue(wasPicked, "It should be Player A");

                wasPicked = draftLogic.PickCard(draft.Id, _members[1].Id, _cards[8].Id);
                Assert.IsTrue(wasPicked, "It should be Player B");
            }
        }
        public void CanCreateDraftFixedPositions()
        {
            IDraftLogic draftLogic = new ModifiedRotisserieDraftLogic();
            var draft = draftLogic.CreateDraft("My Testdraft", _members[1].Id, 75, true);

            draftLogic.AddMemberToDraft(draft.Id, _members[0].Id);
            draftLogic.AddMemberToDraft(draft.Id, _members[1].Id);
            draftLogic.AddMemberToDraft(draft.Id, _members[2].Id);
            draftLogic.AddMemberToDraft(draft.Id, _members[3].Id);
            draftLogic.AddMemberToDraft(draft.Id, _members[4].Id);
            draftLogic.AddMemberToDraft(draft.Id, _members[5].Id);
            draftLogic.AddMemberToDraft(draft.Id, _members[6].Id);
            draftLogic.AddMemberToDraft(draft.Id, _members[7].Id);

            //draftLogic.PickCard(draft.Id, _members[0].Id, _cards[5].Id);
            //draftLogic.PickCard(draft.Id, _members[1].Id, _cards[11].Id);

            // use session to try to load the pick)
            using (var session = _sessionFactory.OpenSession())
            {
                var fromDb = session.Get<Draft>(draft.Id);

                // Test that the pick was successfully inserted
                Assert.IsNotNull(fromDb);
                Assert.AreNotSame(draft, fromDb);

                Assert.AreEqual(draft.Owner.Id, fromDb.Owner.Id);
                Assert.AreEqual(draft.MaximumPicksPerMember, fromDb.MaximumPicksPerMember);
                Assert.AreEqual(8, fromDb.DraftSize);

                IDraftMemberPositionsRepository dmpr = new DraftMemberPositionsRepository();

                ICollection<DraftMemberPositions> testList = dmpr.GetMemberPositionsByDraft(draft);
                List<DraftMemberPositions> test = testList.ToList();

                var position = dmpr.GetDraftMemberPositionByDraftAndPosition(fromDb, 4);
                Assert.AreEqual(_members[3].Id, position.Id);

                position = dmpr.GetDraftMemberPositionByDraftAndPosition(fromDb, 8);
                Assert.AreEqual(_members[7].Id, position.Id);
                position = dmpr.GetDraftMemberPositionByDraftAndPosition(fromDb, 7);
                Assert.AreEqual(_members[6].Id, position.Id);
                position = dmpr.GetDraftMemberPositionByDraftAndPosition(fromDb, 6);
                Assert.AreEqual(_members[5].Id, position.Id);
                position = dmpr.GetDraftMemberPositionByDraftAndPosition(fromDb, 5);
                Assert.AreEqual(_members[4].Id, position.Id);
                position = dmpr.GetDraftMemberPositionByDraftAndPosition(fromDb, 3);
                Assert.AreEqual(_members[2].Id, position.Id);
                position = dmpr.GetDraftMemberPositionByDraftAndPosition(fromDb, 2);
                Assert.AreEqual(_members[1].Id, position.Id);
                position = dmpr.GetDraftMemberPositionByDraftAndPosition(fromDb, 1);
                Assert.AreEqual(_members[0].Id, position.Id);

            }
        }
        public void CanCreateDraftRandomPositions()
        {
            IDraftLogic draftLogic = new ModifiedRotisserieDraftLogic();
            var draft1 = draftLogic.CreateDraft("My Testdraft", _members[1].Id, 75, true);

            for (var i = 0; i < 8; i++)
            {
                draftLogic.AddMemberToDraft(draft1.Id, _members[i].Id);
            }

            var draft2 = draftLogic.CreateDraft("My Testdraft 2", _members[2].Id, 75, true);
            for (var i = 0; i < 8; i++)
            {
                draftLogic.AddMemberToDraft(draft2.Id, _members[i].Id);
            }

            var draft3 = draftLogic.CreateDraft("My Testdraft 3", _members[2].Id, 75, true);
            for (var i = 0; i < 8; i++)
            {
                draftLogic.AddMemberToDraft(draft3.Id, _members[i].Id);
            }

            var draft4 = draftLogic.CreateDraft("My Testdraft 4", _members[2].Id, 75, true);
            for (var i = 0; i < 8; i++)
            {
                draftLogic.AddMemberToDraft(draft4.Id, _members[i].Id);
            }

            var draft5 = draftLogic.CreateDraft("My Testdraft 5", _members[2].Id, 75, true);
            for (var i = 0; i < 8; i++)
            {
                draftLogic.AddMemberToDraft(draft5.Id, _members[i].Id);
            }

            draftLogic.StartDraft(draft1.Id, true);
            draftLogic.StartDraft(draft2.Id, true);
            draftLogic.StartDraft(draft3.Id, true);
            draftLogic.StartDraft(draft4.Id, true);
            draftLogic.StartDraft(draft5.Id, true);

            IDraftMemberPositionsRepository dmpr = new DraftMemberPositionsRepository();

            // use session to try to load the pick
            using (var session = _sessionFactory.OpenSession())
            {
                var fromDb1 = session.Get<Draft>(draft1.Id);
                var fromDb2 = session.Get<Draft>(draft2.Id);
                var fromDb3 = session.Get<Draft>(draft3.Id);
                var fromDb4 = session.Get<Draft>(draft4.Id);
                var fromDb5 = session.Get<Draft>(draft5.Id);

                var position1 = dmpr.GetDraftMemberPositionByDraftAndPosition(fromDb1, 1);
                var position2 = dmpr.GetDraftMemberPositionByDraftAndPosition(fromDb2, 1);
                var position3 = dmpr.GetDraftMemberPositionByDraftAndPosition(fromDb3, 1);
                var position4 = dmpr.GetDraftMemberPositionByDraftAndPosition(fromDb4, 1);
                var position5 = dmpr.GetDraftMemberPositionByDraftAndPosition(fromDb5, 1);

                if (position1.Member.Id != position2.Member.Id || position1.Member.Id != position3.Member.Id
                    || position1.Member.Id != position4.Member.Id || position1.Member.Id != position5.Member.Id)
                {
                    return;
                }

                Assert.Fail("Someone should get different place");
            }
        }