示例#1
0
 public bool ValidateUser(string userName, string password)
 {
     using (var sl = new SystemLogic())
     {
         return sl.AuthenticateUser(userName, password);
     }
 }
示例#2
0
 public bool ChangePassword(string userName, string oldPassword, string newPassword)
 {
     using (var sl = new SystemLogic())
     {
         return sl.ChangePassword(userName, oldPassword, newPassword);
     }
 }
示例#3
0
 public MembershipCreateStatus CreateUser(string userName, string password, string email, string fullName)
 {
     using (var sl = new SystemLogic())
     {
         var creationstatus = sl.CreateUser(userName, email, password, fullName);
         return creationstatus
                    ? MembershipCreateStatus.Success
                    : MembershipCreateStatus.DuplicateUserName;
     }
 }
        public void CreateDebugData()
        {
            using (SystemLogic sl = new SystemLogic())
            {
                sl.CreateUser("Snidd", "*****@*****.**", "magnus", "Magnus Kjellberg");
                sl.CreateUser("Mats", "*****@*****.**", "mats", "Mats Törnros");
                sl.CreateUser("Rikard", "*****@*****.**", "rikard", "Rikard Stenlund");

                var dl = GetDraftLogic.DefaultDraftLogic();

                var member1 = sl.FindMember("Snidd");
                var member2 = sl.FindMember("Mats");
                var member3 = sl.FindMember("Rikard");

                var draft = dl.CreateDraft("Min draft", member1.Id, 75, true);

                dl.AddMemberToDraft(draft.Id, member1.Id, 1);
                dl.AddMemberToDraft(draft.Id, member2.Id, 2);
                dl.AddMemberToDraft(draft.Id, member3.Id, 3);

                dl.StartDraft(draft.Id, false);
            }
        }
        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");
            }
        }