Exemplo n.º 1
0
        public void CollateAttributeSubtype()
        {
            var obj = new TestObjWithSubtypedAttributes
            {
                CollateDefault = "Alpha ",
                CollateBinary  = "Alpha ",
                CollateRTrim   = "Alpha ",
                CollateNoCase  = "Alpha ",
            };

            var db = new TestDbSubtype(new SQLitePlatformTest(), TestPath.CreateTemporaryDatabase());

            db.Insert(obj);

            var testTable = db.Table <TestObjWithSubtypedAttributes>();

            Assert.AreEqual(1, (from o in testTable where o.CollateDefault == "Alpha " select o).Count());
            Assert.AreEqual(0, (from o in testTable where o.CollateDefault == "ALPHA " select o).Count());
            Assert.AreEqual(0, (from o in testTable where o.CollateDefault == "Alpha" select o).Count());
            Assert.AreEqual(0, (from o in testTable where o.CollateDefault == "ALPHA" select o).Count());

            Assert.AreEqual(1, (from o in testTable where o.CollateBinary == "Alpha " select o).Count());
            Assert.AreEqual(0, (from o in testTable where o.CollateBinary == "ALPHA " select o).Count());
            Assert.AreEqual(0, (from o in testTable where o.CollateBinary == "Alpha" select o).Count());
            Assert.AreEqual(0, (from o in testTable where o.CollateBinary == "ALPHA" select o).Count());

            Assert.AreEqual(1, (from o in testTable where o.CollateRTrim == "Alpha " select o).Count());
            Assert.AreEqual(0, (from o in testTable where o.CollateRTrim == "ALPHA " select o).Count());
            Assert.AreEqual(1, (from o in testTable where o.CollateRTrim == "Alpha" select o).Count());
            Assert.AreEqual(0, (from o in testTable where o.CollateRTrim == "ALPHA" select o).Count());

            Assert.AreEqual(1, (from o in testTable where o.CollateNoCase == "Alpha " select o).Count());
            Assert.AreEqual(1, (from o in testTable where o.CollateNoCase == "ALPHA " select o).Count());
            Assert.AreEqual(0, (from o in testTable where o.CollateNoCase == "Alpha" select o).Count());
            Assert.AreEqual(0, (from o in testTable where o.CollateNoCase == "ALPHA" select o).Count());
        }
Exemplo n.º 2
0
        public void CollateAttributeSubtype()
        {
            var obj = new TestObjWithSubtypedAttributes
            {
                CollateDefault = "Alpha ",
                CollateBinary = "Alpha ",
                CollateRTrim = "Alpha ",
                CollateNoCase = "Alpha ",
            };

            var db = new TestDbSubtype(new SQLitePlatformTest(), TestPath.GetTempFileName());

            db.Insert(obj);

            var testTable = db.Table<TestObjWithSubtypedAttributes>();
            Assert.AreEqual(1, (from o in testTable where o.CollateDefault == "Alpha " select o).Count());
            Assert.AreEqual(0, (from o in testTable where o.CollateDefault == "ALPHA " select o).Count());
            Assert.AreEqual(0, (from o in testTable where o.CollateDefault == "Alpha" select o).Count());
            Assert.AreEqual(0, (from o in testTable where o.CollateDefault == "ALPHA" select o).Count());

            Assert.AreEqual(1, (from o in testTable where o.CollateBinary == "Alpha " select o).Count());
            Assert.AreEqual(0, (from o in testTable where o.CollateBinary == "ALPHA " select o).Count());
            Assert.AreEqual(0, (from o in testTable where o.CollateBinary == "Alpha" select o).Count());
            Assert.AreEqual(0, (from o in testTable where o.CollateBinary == "ALPHA" select o).Count());

            Assert.AreEqual(1, (from o in testTable where o.CollateRTrim == "Alpha " select o).Count());
            Assert.AreEqual(0, (from o in testTable where o.CollateRTrim == "ALPHA " select o).Count());
            Assert.AreEqual(1, (from o in testTable where o.CollateRTrim == "Alpha" select o).Count());
            Assert.AreEqual(0, (from o in testTable where o.CollateRTrim == "ALPHA" select o).Count());

            Assert.AreEqual(1, (from o in testTable where o.CollateNoCase == "Alpha " select o).Count());
            Assert.AreEqual(1, (from o in testTable where o.CollateNoCase == "ALPHA " select o).Count());
            Assert.AreEqual(0, (from o in testTable where o.CollateNoCase == "Alpha" select o).Count());
            Assert.AreEqual(0, (from o in testTable where o.CollateNoCase == "ALPHA" select o).Count());
        }