public static void ClassInit(TestContext context)
        {
            var service = new MySqlDbService();

            service.CreateConnection(connectionString);
            service.Open();
            service.Execute(@"
                    CREATE DATABASE IF NOT EXISTS `db1` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
                                USE `db1`;

                    DROP TABLE IF EXISTS `info_users`;
                    CREATE TABLE `info_users` (
                      `id` int(11) UNSIGNED NOT NULL,
                      `username` varchar(255) NOT NULL,
                      `age` int(11) DEFAULT NULL
                    ) ENGINE = MyISAM DEFAULT CHARSET = latin1;


                    INSERT INTO `info_users` (`id`, `username`, `age`) VALUES
                    (1, 'user1', 20),
                    (2, 'user2', 30),
                    (3, 'user3', NULL);


                    ALTER TABLE `info_users`
                      ADD PRIMARY KEY(`id`);

                    ALTER TABLE `info_users`
                      MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT = 4; ");

            service.Close();
        }
Example #2
0
        public MySqlDbService GetService()
        {
            var service = new MySqlDbService();

            service.CreateConnection(connectionString);
            service.Open();
            return(service);
        }