public void GetDefaultDataStore_ConnectionStringNotInConfig_InAnotherCastleInvalidConfigurationThrown() { var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); config.ConnectionStrings.ConnectionStrings.Clear(); config.Save(); ConfigurationManager.RefreshSection("connectionStrings"); DefaultServiceProvider provider = new DefaultServiceProvider(); var results = provider.GetStorage(); }
public void GetDefaultDataStore_DefaultDataStoreInstanceReturned() { DefaultServiceProvider provider = new DefaultServiceProvider(); var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); config.ConnectionStrings.ConnectionStrings.Clear(); //Ensure that connection is present config.ConnectionStrings.ConnectionStrings.Add(new ConnectionStringSettings(DefaultServiceProvider.ConnectionStringKey, "Server=LocalHost;Database=MyTests;Trusted_Connection=True;MultipleActiveResultSets=true;", "System.Data.SqlClient")); config.Save(); ConfigurationManager.RefreshSection("connectionStrings"); var results = provider.GetStorage(); Assert.IsNotNull(results, "Should have default"); Assert.IsInstanceOfType(results, typeof(ConfigurationStorage)); }