コード例 #1
0
        public void TestInitialize()
        {
            //setup access to secrets.json file
            var builder = new ConfigurationBuilder().AddUserSecrets <CMSPropertiesTests>();

            Configuration = builder.Build();

            //create the database object
            var csb = new MySqlConnectionStringBuilder
            {
                Server   = Configuration["MySqlServer"],
                Port     = Convert.ToUInt32(Configuration["MySqlPort"]),
                UserID   = Configuration["MySqlUser"],
                Password = Configuration["MySqlPassword"]
            };

            _database = new CMSDatabase(csb.ToString());

            //create database
            _database.NonQuery("CREATE DATABASE IF NOT EXISTS TestDatabase");
            _database.NonQuery("USE TestDatabase");

            //create properties table
            _database.NonQuery("CREATE TABLE IF NOT EXISTS Properties (Timestamp DATETIME NOT NULL, Property CHAR(150) NOT NULL, Value TEXT NOT NULL, PRIMARY KEY (Property));");
        }
コード例 #2
0
 public CMSProperties(ICMSDatabase database)
 {
     _database = database;
 }