コード例 #1
0
        public void TestPackageLocation()
        {
            using (var db = new DbInstance("TestPackage", Windows.ApplicationModel.Package.Current.InstalledLocation))
            {
                db.Map <MyData>().Automap(i => i.Id, true);
                db.Initialize();

                db.Save(new MyData());
            }
        }
コード例 #2
0
        public void TestPackageLocation()
        {
            try
            {
                using (var db = new DbInstance("TestPackage", Windows.ApplicationModel.Package.Current.InstalledLocation))
                {
                    db.Map <MyData>().Automap(i => i.Id, true);
                    db.Initialize();

                    db.Save(new MyData());
                }
                Assert.Fail("Must fail");
            }
            catch (IOException)
            {
            }
        }
コード例 #3
0
        public void TestPKKey <T>(Expression <Func <MyDataKeys, T> > pkGetter, Action <MyDataKeys, T> pkSetter, T key)
        {
            var db = new DbInstance("DbKeys");

            db.Map <MyDataKeys>().Key(pkGetter);
            db.Initialize();
            var getter = pkGetter.Compile();
            var obj1   = new MyDataKeys();

            pkSetter(obj1, key);
            db.Save(obj1);

            var obj2 = db.LoadByKey <MyDataKeys>(key);

            Assert.AreEqual(getter(obj1), getter(obj2));

            db.Purge();
        }