Inheritance: IConfigurationRepository
コード例 #1
0
        public void AppSettingsJsonConfigRepository_ReturnsADefaultInstanceIfSettingIsNotFound()
        {
            using (new MunqContext())
            {
                Dependency.Resolve<IDependencyRegistrar>()
                    .RegisterInstance<ILocalCache>(new LocalCacheEmulator());

                var actual = new AppSettingsJsonConfigRepository().Load(typeof(DummySettings)) as DummySettings;
                Assert.NotNull(actual);
                Assert.Equal("-1", actual.Default);
            }
        }
コード例 #2
0
        public void AppSettingsJsonConfigRepository_UsesSettingKeyAttributeIfPresent()
        {
            using (new MunqContext())
            {
                Dependency.Resolve<IDependencyRegistrar>()
                    .RegisterInstance<ILocalCache>(new LocalCacheEmulator());

                var actual = new AppSettingsJsonConfigRepository().Load(typeof(MyTestDbSettings)) as MyTestDbSettings;
                Assert.NotNull(actual);
                Assert.NotNull(actual.Provider);
                Assert.NotNull(actual.Server);
                Assert.NotNull(actual.RootPath);
            }
        }