コード例 #1
0
        public void TestSettingsSaveOrUpdate()
        {
            var testRepo = Container.Resolve<TestWithSettingRepository>();

            var e = new TestWithSettingEntity();
            testRepo.Save(e);
            e = testRepo.Get(e.Id);
            e = testRepo.Load(e.Id);
            e.Settings.SetEntry("lol", "lol");
            testRepo.Update(e);
            e = testRepo.Get(e.Id);
            Assert.AreEqual(e.Settings.Entries.Count, 1);
        }
コード例 #2
0
        public void TestSettingsSaveOrUpdate()
        {
            var testRepo = Container.Resolve <TestWithSettingRepository>();

            var e = new TestWithSettingEntity();

            testRepo.Save(e);
            e = testRepo.Get(e.Id);
            e = testRepo.Load(e.Id);
            e.Settings.SetEntry("lol", "lol");
            testRepo.Update(e);
            e = testRepo.Get(e.Id);
            Assert.AreEqual(e.Settings.Entries.Count, 1);
        }
コード例 #3
0
        public void TestSettingsCRUD()
        {
            var testRepo = Container.Resolve<TestWithSettingRepository>();
            var e = new TestWithSettingEntity();

            testRepo.Save(e);

            e = testRepo.Get(e.Id);
            Assert.IsTrue(e.Settings != null);

            e = testRepo.Load(e.Id);
            Assert.IsTrue(e.Settings != null);

            e.Settings.SetEntry("test", "test");
            e.Str = "ss";
            testRepo.Update(e);
            e = testRepo.Load(e.Id);
            Assert.IsTrue(e.Settings["test"].GetValue().ToString() == "test");

            e.Settings.SetEntry("test", "test3");
            //e.Str = e.Str;
            testRepo.Update(e);
            e = testRepo.Load(e.Id);
            Assert.IsTrue(e.Settings["test"].GetValue().ToString() == "test3");


            testRepo.Delete(e);

            e = new TestWithSettingEntity();
            e.Settings = new SettingsEntity();
            e.Settings.SetEntry("test", "test2");
            testRepo.SaveOrUpdate(e);
            testRepo.Evict(e);
            e = testRepo.Get(e.Id);
            Assert.IsTrue(e.Settings["test"].GetValue().ToString() == "test2");
        }
コード例 #4
0
        public void TestSettingsCRUD()
        {
            var testRepo = Container.Resolve <TestWithSettingRepository>();
            var e        = new TestWithSettingEntity();

            testRepo.Save(e);

            e = testRepo.Get(e.Id);
            Assert.IsTrue(e.Settings != null);

            e = testRepo.Load(e.Id);
            Assert.IsTrue(e.Settings != null);

            e.Settings.SetEntry("test", "test");
            e.Str = "ss";
            testRepo.Update(e);
            e = testRepo.Load(e.Id);
            Assert.IsTrue(e.Settings["test"].GetValue().ToString() == "test");

            e.Settings.SetEntry("test", "test3");
            //e.Str = e.Str;
            testRepo.Update(e);
            e = testRepo.Load(e.Id);
            Assert.IsTrue(e.Settings["test"].GetValue().ToString() == "test3");


            testRepo.Delete(e);

            e          = new TestWithSettingEntity();
            e.Settings = new SettingsEntity();
            e.Settings.SetEntry("test", "test2");
            testRepo.SaveOrUpdate(e);
            testRepo.Evict(e);
            e = testRepo.Get(e.Id);
            Assert.IsTrue(e.Settings["test"].GetValue().ToString() == "test2");
        }