public void TestHasMoreData() { DbDacDataProvider p = new DbDacDataProvider(); Dictionary <string, string> args = new Dictionary <string, string>(); args.Add("dbcongxml", this.path); p.Init(args); // 5. ISqlHelper sqlHelper = SqlHelperFactory.Create(DbType.MSSQL, "Initial Catalog=DW_iSecureCloud_Empty;Data Source=192.168.1.128;User Id=sa;Password=861004"); sqlHelper.Query("update T_THEMES_ENVI_WIND set lastSyncTime = null"); int count = 0; Assert.IsTrue(p.HasMoreData()); Console.WriteLine("TotalReminder: {0} records.", p.Remainder); Assert.IsTrue(p.Remainder > 0); count = p.Remainder; int len = 0; TranMsg[] msgs = p.NextPackages(out len); Assert.IsNotNull(msgs); byte[] buff = msgs[0].Data; Console.WriteLine(ValueHelper.BytesToHexStr(buff, 0, len, "")); // Record 4. Assert.IsTrue(len > 0); Console.WriteLine("len: {0}", len); // Data Sent p.OnPackageSent(); var ds = sqlHelper.Query("select count(ID) from T_THEMES_ENVI_WIND where lastSyncTime is null"); int count2 = Convert.ToInt32(ds.Tables[0].Rows[0][0]); int rows = 1024 / (3 * 8 + 15); Assert.AreEqual(rows, count - count2 + 1); }
public void TestHasMoreData() { DbDacDataProvider p = new DbDacDataProvider(); Dictionary <string, string> args = new Dictionary <string, string>(); args.Add("sqlitedbcongxml", this.path); p.Init_Sqlite(args); // 5. // var cs = connstr.Split(','); LoadDbConfigXml lc = new LoadDbConfigXml(this.path); string[] sonstr = lc.GetSqlConnectionStrings("/config/databases"); ISqlHelper sqlHelper = SqlHelperFactory.Create(DbType.SQLite, sonstr[0]); sqlHelper.Query("update D_OriginalWindData set lastSyncTime = null"); Assert.IsTrue(p.HasMoreData()); Console.WriteLine("TotalReminder: {0} records.", p.Remainder); Assert.IsTrue(p.Remainder > 0); int len = 0; TranMsg[] msgs = p.NextPackages(out len); Assert.IsNotNull(msgs); byte[] buff = msgs[0].Data; Console.WriteLine(ValueHelper.BytesToHexStr(buff, 0, len, "")); // Record 4. Assert.IsTrue(len > 0); // Data Sent p.OnPackageSent(); var ds = sqlHelper.Query("select count(ID) from D_OriginalWindData where lastSyncTime is null"); Assert.AreEqual(0, Convert.ToInt32(ds.Tables[0].Rows[0][0])); }