public void TestUnsuccessfulConnection() { var writer = new RedBoxDatabaseWriter(new List <RedboxMovie>()); writer.ConnectionString = ""; Assert.Throws <MySqlException>(() => writer.Connect()); }
public void DeleteRecords() { var writer = new RedBoxDatabaseWriter(new List <RedboxMovie>()); writer.Connect(); var query = $"Delete FROM redbox WHERE titleId = '{SuccessfulId}'"; var command = new MySqlCommand(query, writer.Connection); command.ExecuteNonQuery(); writer.Connection.Close(); }
public void DatabaseWriteError() { var movies = new List <RedboxMovie>() { new RedboxMovie("This title id is too long", "1") }; var writer = new RedBoxDatabaseWriter(movies); writer.Connect(); Assert.Throws <DatabaseWritingException>(() => writer.WriteAllMovies()); writer.Connection.Close(); }