Exemple #1
0
        public void ConnectTest()
        {
            var server = Utility.LoadServers("TestData/servers.yml")["mssql"];
            var sql    = new MsSql(server, false);
            var res    = sql.Connect();

            Assert.True(res);
        }
Exemple #2
0
        public void QueryTest()
        {
            var server = Utility.LoadServers("TestData/servers.yml")["mssql"];
            var db     = Utility.LoadDataBase("TestData/mssql.yml");

            var sql   = new MsSql(server, false);
            var res   = sql.Connect();
            var query = sql.Query(db);

            _output.WriteLine(query);
            Assert.False(string.IsNullOrWhiteSpace(query));
        }
Exemple #3
0
        public void ReCreateTest()
        {
            var server = Utility.LoadServers("TestData/servers.yml")["mssql"];
            var db     = Utility.LoadDataBase("TestData/mssql.yml");

            var sql = new MsSql(server, false);

            sql.Connect();
            var result = sql.ReCreate(db, false);

            _output.WriteLine(result.Query);
            Assert.True(result.Success);
        }
Exemple #4
0
        public void DiffTest()
        {
            var server = Utility.LoadServers("TestData/servers.yml")["mssql"];
            var db     = Utility.LoadDataBase("TestData/mssql.yml");

            var sql = new MsSql(server, false);
            var res = sql.Connect();

            sql.ReCreate(db, false);
            Utility.TrimDataBaseProperties(db);
            var diff = sql.Diff(db);

            Assert.False(diff.HasDiff);
        }
Exemple #5
0
        public void UpdateTest()
        {
            var server = Utility.LoadServers("TestData/servers.yml")["mssql"];
            var db     = Utility.LoadDataBase("TestData/mssql.yml");

            Utility.TrimDataBaseProperties(db);

            var sql = new MsSql(server, false);

            sql.Connect();
            var result = sql.Update(db, true, true);

            _output.WriteLine(result.Query ?? "");
            Assert.True(result.Success);
        }
Exemple #6
0
        public void ExtractTest()
        {
            var server = Utility.LoadServers("TestData/servers.yml")["mssql"];
            var db     = Utility.LoadDataBase("TestData/mssql.yml");

            var sql = new MsSql(server, false);
            var res = sql.Connect();

            sql.ReCreate(db, false);
            Utility.TrimDataBaseProperties(db);

            var extract = sql.Extract();
            var yaml    = Utility.DataBaseToYaml(extract);

            _output.WriteLine(yaml);
            Assert.NotEmpty(extract.Tables);
        }