public void DeleteGameResults(int GameResultsId)
 {
     AgileMindEntities db = new DAL.Data.AgileMindEntities();
     List<t_GameResults> resultList = (from data in db.t_GameResults where data.GameScoreId == GameResultsId select data).ToList();
     foreach (t_GameResults item in resultList)
     {
         db.DeleteObject(item);
     }
     db.SaveChanges();
 }
        public static void DeleteLoginsFromDB(String LoginName)
        {
            AgileMind.DAL.Data.AgileMindEntities agileMindDB = new DAL.Data.AgileMindEntities();

            List<AgileMind.DAL.Data.Login> loginList = (from p in agileMindDB.Logins where p.LoginName == LoginName select p).ToList();
            foreach (AgileMind.DAL.Data.Login loginToDelete in loginList)
            {
                agileMindDB.DeleteObject(loginToDelete);
            }
            agileMindDB.SaveChanges();
        }
        public void CallingCreateLoginInfoAddsTheLoginPersonIntoTheDatabase()
        {
            String loginName = "TestName";
            String password = "Password";
            String email = "Email";

            DeleteLoginsFromDB(loginName);
            LoginResult loginInfo = LoginResult.CreateLogin(loginName, password, email);

            AgileMind.DAL.Data.AgileMindEntities agileMind = new DAL.Data.AgileMindEntities();
            List<AgileMind.DAL.Data.Login> loginList = agileMind.Logins_CheckLogin(loginName, password, String.Empty).ToList();
            Assert.AreEqual(1, loginList.Count, "After insertion of new login there should be one login");
            Assert.AreEqual(loginName, loginList[0].LoginName, "Login Name should be set equal");
            Assert.AreEqual(password, loginList[0].Password, "Password should be equal");
            Assert.AreEqual(email, loginList[0].EmailAddress);

            DeleteLoginsFromDB(loginName);
        }
        public void CallingValidateLoginReturnsFalseIfTheLoginNameAndPasswordAreCorrectButActiveIsFalse()
        {
            String loginName = "TestAccount";
            String password = "Password";
            String email = "[email protected]";

            DeleteLoginsFromDB(loginName);
            LoginResult loginResult = LoginResult.CreateLogin(loginName, password, email);

            AgileMind.DAL.Data.AgileMindEntities agileMindDB = new DAL.Data.AgileMindEntities();
            List<AgileMind.DAL.Data.Login> loginList = (from data in agileMindDB.Logins where data.LoginName == loginName select data).ToList();
            foreach (AgileMind.DAL.Data.Login login in loginList)
            {
                login.Active = false;
            }
            agileMindDB.SaveChanges();

            LoginResult validateResult = LoginResult.ValidateLogin(loginName, password, String.Empty);

            Assert.IsFalse(validateResult.Success);

            DeleteLoginsFromDB(loginName);
        }
 public static int GetFirstGameID()
 {
     AgileMind.DAL.Data.AgileMindEntities db = new DAL.Data.AgileMindEntities();
     AgileMind.DAL.Data.t_Game tGame = (from data in db.t_Game select data).First();
     return tGame.GameId;
 }