Exemplo n.º 1
0
        public void GetDataListBySQLTest()
        {
            IList <LoopModel> lstLoopModel = new List <LoopModel>();

            StringBuilder sbCreateTableSql = new StringBuilder();

            //回路信息
            sbCreateTableSql.Append("Create table Loop(id integer not null primary key autoincrement,name varchar(20),Code varchar(6),controllerID int,DeviceAmount int );");

            _dbConn = new DatabaseAccess.SQLiteDatabaseAccess(strDBFile, _logHelper, _fileService);
            _dbConn.ExecuteBySql(sbCreateTableSql);
            _dbConn.ExecuteBySql(new StringBuilder("insert into Loop(id,name,Code,controllerID,DeviceAmount) values(1,'william','0101',1,55)"));

            lstLoopModel = (List <LoopModel>)_dbConn.GetDataListBySQL <SCA.Model.LoopModel>(new StringBuilder("select * from Loop"));
            Assert.AreEqual(1, lstLoopModel.Count);
        }