public void TestInsertNoDirectDatabaseReaderIntegration()
        {
            //arrange
            ProviderChecker.Check(Providername, _connectionString);

            var rdr = new ScriptWriter();

            //act
            var txt = rdr.ReadTable("Categories", _connectionString, Providername);

            //assert
            Assert.IsTrue(txt.Contains("INSERT INTO [Categories]"), "Insert statments created: [" + txt + "]");
            Assert.IsTrue(txt.Contains("[CategoryName],  [Description]"), "Insert names the columns: [" + txt + "]");
            Assert.IsTrue(txt.Contains("'Beverages'"), "Data includes Beverages: [" + txt + "]");
        }
        public void TestInsertIntegration()
        {
            //arrange
            var dbReader = TestHelper.GetNorthwindReader();
            var table = dbReader.Table("Categories");

            var rdr = new ScriptWriter();

            //act
            var txt = rdr.ReadTable(table, _connectionString, Providername);

            //assert
            Assert.IsTrue(txt.Contains("INSERT INTO [Categories]"), "Insert statments created: [" + txt + "]");
            Assert.IsTrue(txt.Contains("[CategoryName],  [Description]"), "Insert names the columns: [" + txt + "]");
            Assert.IsTrue(txt.Contains("'Beverages'"), "Data includes Beverages: [" + txt + "]");
        }
Esempio n. 3
0
 public void GetData(DatabaseTable databaseTable, string connectionString, string providerName)
 {
     try
     {
         var sw = new ScriptWriter();
         sw.IncludeBlobs = false;
         sw.IncludeIdentity = true;
         sw.PageSize = 100;
         var txt = sw.ReadTable(databaseTable, connectionString, providerName);
         Clipboard.SetText(txt, TextDataFormat.UnicodeText);
     }
     catch (Exception exception)
     {
         Debug.WriteLine(exception.Message);
     }
 }
        public void TestInsertWithDataReader()
        {
            //arrange
            var dbReader = TestHelper.GetNorthwindReader();
            dbReader.DataTypes(); //need the datatypes here, so this must be called before or after
            var table = dbReader.Table("Categories");

            var rdr = new ScriptWriter();

            string result = null;

            //act
            rdr.ReadTable(table, _connectionString, Providername, insertString =>
            {
                result = insertString;
                return false; //only need one record, return
            });

            //assert
            Assert.IsNotNull(result);
            Assert.IsTrue(result.Contains("INSERT INTO [Categories]"), "Insert statments created: " + result);
            Assert.IsTrue(result.Contains("[CategoryName],"), "Insert names the columns: " + result);
        }