示例#1
0
        public void TestBoolean()
        {
            var tmpFile = TestPath.GetTempFileName();
            var db      = new DbAcs(tmpFile);

            db.buildTable();
            for (int i = 0; i < 10; i++)
            {
                db.Insert(new VO()
                {
                    Flag = (i % 3 == 0), Text = String.Format("VO{0}", i)
                });
            }

            // count vo which flag is true
            Assert.AreEqual(4, db.CountWithFlag(true));
            Assert.AreEqual(6, db.CountWithFlag(false));

            Debug.WriteLine("VO with true flag:");
            foreach (var vo in db.Query <VO>("SELECT * FROM VO Where Flag = ?", true))
            {
                Debug.WriteLine(vo.ToString());
            }

            Debug.WriteLine("VO with false flag:");
            foreach (var vo in db.Query <VO>("SELECT * FROM VO Where Flag = ?", false))
            {
                Debug.WriteLine(vo.ToString());
            }
        }
示例#2
0
        public void TestBoolean()
        {
            var    sqlite3Platform = new SQLitePlatformTest();
            string tmpFile         = TestPath.CreateTemporaryDatabase();
            var    db = new DbAcs(sqlite3Platform, tmpFile);

            db.buildTable();
            for (int i = 0; i < 10; i++)
            {
                db.Insert(new VO
                {
                    Flag = (i % 3 == 0),
                    Text = String.Format("VO{0}", i)
                });
            }

            // count vo which flag is true
            Assert.AreEqual(4, db.CountWithFlag(true));
            Assert.AreEqual(6, db.CountWithFlag(false));

            Debug.WriteLine("VO with true flag:");
            foreach (VO vo in db.Query <VO>("SELECT * FROM VO Where Flag = ?", true))
            {
                Debug.WriteLine(vo.ToString());
            }

            Debug.WriteLine("VO with false flag:");
            foreach (VO vo in db.Query <VO>("SELECT * FROM VO Where Flag = ?", false))
            {
                Debug.WriteLine(vo.ToString());
            }
        }
示例#3
0
        public void TestBoolean()
        {
            var sqlite3Platform = new SQLitePlatformTest();
            string tmpFile = TestPath.CreateTemporaryDatabase();
            var db = new DbAcs(sqlite3Platform, tmpFile);
            db.buildTable();
            for (int i = 0; i < 10; i++)
            {
                db.Insert(new VO
                {
                    Flag = (i%3 == 0),
                    Text = String.Format("VO{0}", i)
                });
            }

            // count vo which flag is true            
            Assert.AreEqual(4, db.CountWithFlag(true));
            Assert.AreEqual(6, db.CountWithFlag(false));

            Debug.WriteLine("VO with true flag:");
            foreach (VO vo in db.Query<VO>("SELECT * FROM VO Where Flag = ?", true))
            {
                Debug.WriteLine(vo.ToString());
            }

            Debug.WriteLine("VO with false flag:");
            foreach (VO vo in db.Query<VO>("SELECT * FROM VO Where Flag = ?", false))
            {
                Debug.WriteLine(vo.ToString());
            }
        }
示例#4
0
        public void TestBoolean()
        {
            var tmpFile = Path.GetTempFileName();
            var db = new DbAcs(tmpFile);
            db.buildTable();
            for (int i = 0; i < 10; i++)
                db.Insert(new VO() { Flag = (i % 3 == 0), Text = String.Format("VO{0}", i) });

            // count vo which flag is true
            Assert.AreEqual(4, db.CountWithFlag(true));
            Assert.AreEqual(6, db.CountWithFlag(false));

            Console.WriteLine("VO with true flag:");
            foreach (var vo in db.Query<VO>("SELECT * FROM VO Where Flag = ?", true))
                Console.WriteLine(vo.ToString());

            Console.WriteLine("VO with false flag:");
            foreach (var vo in db.Query<VO>("SELECT * FROM VO Where Flag = ?", false))
                Console.WriteLine(vo.ToString());
        }