public void CreateTableOf8001() { StringBuilder sbCreateTableSql = new StringBuilder(); //附属信息 sbCreateTableSql.Append("Create table ControllerAttachedInfo(ID integer not null primary key autoincrement,controllerID integer not null,FileVersion varchar(4), ProtocolVersion varchar(4));"); //回路表 sbCreateTableSql.Append("Create table Loop(id integer not null primary key autoincrement,name varchar(20),Code varchar(6),controllerID int,DeviceAmount int );"); _logHelper = Substitute.For <SCA.Interface.ILogRecorder>(); _dbConn.ExecuteBySql(sbCreateTableSql); int intControllerAttachedInfoNum = Convert.ToInt16(_dbConn.GetObjectValue(new StringBuilder("select count(*) from ControllerAttachedInfo"))); int intLoopNum = Convert.ToInt16(_dbConn.GetObjectValue(new StringBuilder("select count(*) from Loop"))); Assert.AreEqual(0, intControllerAttachedInfoNum); // Assert.AreEqual(0, intLoopNum);//不知为什么查出的结果会是1 _dbConn.Dispose(); }
public void GetObjectValueTest() { StringBuilder sbCreateTableSql = new StringBuilder(); //附属信息 sbCreateTableSql.Append("Create table ControllerAttachedInfo2(ID integer not null primary key autoincrement,controllerID integer not null,FileVersion varchar(4), ProtocolVersion varchar(4));"); _dbConn = new DatabaseAccess.SQLiteDatabaseAccess(strDBFile, _logHelper, _fileService); _dbConn.ExecuteBySql(sbCreateTableSql); int intControllerAttachedInfoNum = Convert.ToInt16(_dbConn.GetObjectValue(new StringBuilder("select count(*) from ControllerAttachedInfo2"))); Assert.AreEqual(0, intControllerAttachedInfoNum); //_dbConn.Dispose(); }
public static void GetObjectValueTest() { StringBuilder sbCreateTableSql = new StringBuilder(); //附属信息 sbCreateTableSql.Append("Create table ControllerAttachedInfo2(ID integer not null primary key autoincrement,controllerID integer not null,FileVersion varchar(4), ProtocolVersion varchar(4));"); string strDBFile = "E:\\test.db"; //_logHelper = Substitute.For<SCA.Interface.ILogRecorder>(); //_fileService = new SCA.BusinessLib.Utility.FileService(); _dbConn = new SCA.DatabaseAccess.SQLiteDatabaseAccess(strDBFile, _logHelper, _fileService); _dbConn.ExecuteBySql(sbCreateTableSql); int intControllerAttachedInfoNum = Convert.ToInt16(_dbConn.GetObjectValue(new StringBuilder("select count(*) from Co9ntrollerAttachedInfo2"))); _dbConn.Dispose(); }