Exemplo n.º 1
0
        public void CanDynamicallySave()
        {
            var sample = new ConfigSample("stockapp", "dev.config", string.Empty, false);
            var repo   = new RepositoryInMemory <ConfigItem>();

            InitSample(sample, repo);

            sample.Save();

            var config2 = new ConfigSourceDb("stockapp", "dev.config", repo, true);

            // Load from the repo/datasource.
            Assert.AreEqual(sample.AppName, "stockapp");
            Assert.AreEqual(sample.ConfigName, "dev.config");
            Assert.AreEqual(sample.Header, config2["", "Header"]);
            Assert.AreEqual(sample.PageSize, config2["", "PageSize"]);
            Assert.AreEqual(sample.EnableEmails, config2["", "EnableEmails"]);
            Assert.AreEqual(sample.MaxAmount, config2["", "MaxAmount"]);
            Assert.AreEqual(sample.BusinessDate, config2["", "BusinessDate"]);
        }
Exemplo n.º 2
0
        public void CanDynamicallySaveLoad()
        {
            var sample = new ConfigSample("stockapp", "dev.config", null, false);
            var repo   = new RepositoryInMemory <ConfigItem>();

            InitSample(sample, repo);
            sample.Save();

            var sampleReloaded = new ConfigSample("stockapp", "dev.config", null, false);

            sampleReloaded.SetRepository(null, repo);
            sampleReloaded.Load();

            // Load from the repo/datasource.
            Assert.AreEqual(sample.AppName, "stockapp");
            Assert.AreEqual(sample.ConfigName, "dev.config");
            Assert.AreEqual(sample.Header, sampleReloaded.Header);
            Assert.AreEqual(sample.PageSize, sampleReloaded.PageSize);
            Assert.AreEqual(sample.EnableEmails, sampleReloaded.EnableEmails);
            Assert.AreEqual(sample.MaxAmount, sampleReloaded.MaxAmount);
            Assert.AreEqual(sample.BusinessDate, sampleReloaded.BusinessDate);
        }