public DataBaseMediator() { platformsSQLDAO = new PlatformsSQLDAO(ConnectionString); coverSQLDAO = new CoversSQLDAO(ConnectionString); franchiseSQLDAO = new FranchisesSQLDAO(ConnectionString); gameInfoSQLDAO = new GameInfoSQLDAO(ConnectionString); gameRatingSQLDAO = new GameRatingSQLDAO(ConnectionString); genresSQLDAO = new GenresSQLDAO(ConnectionString); userGameInfoSQLDAO = new UserGameInfoSQLDAO(ConnectionString); userLoginSQLDAO = new UserLoginSqlDao(ConnectionString, hash); genresIGDBDAO = new GenresIGDBDAO(UserApiKey); platformsInfoIGDBDAO = new PlatformsIGDBDAO(UserApiKey); gameInfoIGDBDAO = new GameInfoIGDBDAO(UserApiKey, ConnectionString); coversIGDBDAO = new CoversIGDBDAO(UserApiKey); franchisesIGDBDAO = new FranchisesIGDBDAO(UserApiKey); }
public override void Setup() { base.Setup(); PasswordHasher hash = new PasswordHasher(); dao = new UserLoginSqlDao(ConnectionString, new PasswordHasher()); string salt = Convert.ToBase64String(hash.GenerateRandomSalt()); using (SqlConnection connection = new SqlConnection(ConnectionString)) { connection.Open(); SqlCommand cmd = connection.CreateCommand(); cmd.CommandText = @"insert into UserInfo (userName,password,salt) values ('testUser',@password,@salt)"; cmd.Parameters.AddWithValue("@salt", "RrQlUO2CbmowsGDSpRhXZA=="); cmd.Parameters.AddWithValue("@password", "RrQlUO2CbmowsGDSpRhXZPGjRy1BEXkN3fdCrNs4xUJjxNcs"); cmd.ExecuteNonQuery(); } }