Пример #1
0
 private void InitSample(ConfigSample sample, IRepository <ConfigItem> repo)
 {
     // Init w/ fake in-memory repository.
     sample.SetRepository(null, repo);
     sample.BusinessDate = DateTime.Today.Date;
     sample.EnableEmails = false;
     sample.Header       = "My C# Framework";
     sample.MaxAmount    = 50.2;
     sample.PageSize     = 15;
 }
Пример #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);
        }