예제 #1
0
 public void SetUp()
 {
     _fakeConfig = new ConnectionStringSettingsCollection {
         new ConnectionStringSettings("key-here", "junk")
     };
     _wrapper = new ConnectionStringsExtended(_fakeConfig, new AppSettingsExtended(new NameValueCollection()));
 }
 public void SetUp()
 {
     _underlyingAppSettingStore = new NameValueCollection();
     _connectionStrings         = new ConnectionStringSettingsCollection();
     _appSettings = new AppSettingsExtended(_underlyingAppSettingStore);
     _interceptor = new ConfigurationSubstitutionInterceptor();
     _connectionStringsExtended = new ConnectionStringsExtended(_connectionStrings, _appSettings, new[] { _interceptor });
 }
 public void SetUp()
 {
     _underlyingAppSettingStore = new NameValueCollection();
     _connectionStrings = new ConnectionStringSettingsCollection();
     _appSettings = new AppSettingsExtended(_underlyingAppSettingStore);
     _interceptor = new ConfigurationSubstitutionInterceptor();
     _connectionStringsExtended = new ConnectionStringsExtended(_connectionStrings, _appSettings, new[] {_interceptor});
 }
        public void Indexer_WhenSettingDoesNotExist_AndInterceptorPresentReturnsNull()
        {
            var wrapper = new ConnectionStringsExtended(_fakeConfig, new AppSettingsExtended(new NameValueCollection()),
                    new List<IConnectionStringInterceptor> { new NullConnectionStringInterceptor() });

            var val = wrapper["key-here"];

            Assert.That(val, Is.Null);
        }
        public void Indexer_WhenSettingExists_RunsAnyRegisteredInterceptorsAndReturnsSetting()
        {
            var wrapper = new ConnectionStringsExtended(_fakeConfig, new AppSettingsExtended(new NameValueCollection()),
                    new List<IConnectionStringInterceptor> {new TestConnectionStringInterceptor("return this")});

            var val = wrapper["key-here"];

            Assert.That(val.ConnectionString, Is.EqualTo("return this"));
        }
예제 #6
0
        public void Indexer_WhenSettingDoesNotExist_AndInterceptorPresentReturnsNull()
        {
            var wrapper = new ConnectionStringsExtended(_fakeConfig, new AppSettingsExtended(new NameValueCollection()),
                                                        new List <IConnectionStringInterceptor> {
                new NullConnectionStringInterceptor()
            });

            var val = wrapper["key-here"];

            Assert.That(val, Is.Null);
        }
예제 #7
0
        public void Indexer_WhenSettingExists_RunsAnyRegisteredInterceptorsAndReturnsSetting()
        {
            var wrapper = new ConnectionStringsExtended(_fakeConfig, new AppSettingsExtended(new NameValueCollection()),
                                                        new List <IConnectionStringInterceptor> {
                new TestConnectionStringInterceptor("return this")
            });

            var val = wrapper["key-here"];

            Assert.That(val.ConnectionString, Is.EqualTo("return this"));
        }
 public void SetUp()
 {
     _fakeConfig = new ConnectionStringSettingsCollection {new ConnectionStringSettings("key-here", "junk")};
     _wrapper = new ConnectionStringsExtended(_fakeConfig, new AppSettingsExtended(new NameValueCollection()));
 }