Пример #1
0
        public void PushFranchisesTest()
        {
            Franchises test = new Franchises();

            dao.PushFranchise(340, "A series of unfortunate calls");
            using (SqlConnection connection = new SqlConnection(ConnectionString))
            {
                connection.Open();
                SqlCommand cmd = connection.CreateCommand();
                cmd.CommandText = @"select * from Franchises where franchise_Id = 340";
                cmd.ExecuteNonQuery();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    test.Franchise_Id   = (int)reader["franchise_id"];
                    test.Franchise_Name = (string)reader["franchise_name"];
                }
            }
            Assert.AreEqual(340, test.Franchise_Id);
            Assert.AreEqual("A series of unfortunate calls", test.Franchise_Name);
        }
 public void PushFranchiseIntoSQL(IList <GameInfo> games)
 {
     //Takes the results from IGDB query and inserts any missing franchises into SQL DB
     foreach (GameInfo x in games)
     {
         if (!franchiseSQLDAO.CheckFranchiseID(x.franchiseID))
         {
             Franchises newFranchise = new Franchises();
             newFranchise = franchisesIGDBDAO.PullSpecificFranchise(x.franchiseID);
             franchiseSQLDAO.PushFranchise(newFranchise.Franchise_Id, newFranchise.Franchise_Name);
         }
     }
 }