public override void SetUp() { base.SetUp(); var connectionString = "Data Source=myServerAddress;Initial Catalog=MyDataBase;User Id=myUsername;Password=myPassword;"; _innerScriptBuilderMock = MockRepository.GenerateMock <IScriptBuilder> (); _builder = new SqlDatabaseSelectionScriptElementBuilder(_innerScriptBuilderMock, connectionString); }
public void GetCreateScript_WithConnectionStringMissingInitialCatalog_ThrowsInvalidOperationException() { var builder = new SqlDatabaseSelectionScriptElementBuilder( _innerScriptBuilderMock, new SqlConnectionStringBuilder { DataSource = "localhost" }.ToString()); Assert.That( () => builder.GetCreateScript(), Throws.InvalidOperationException .With.Message.EqualTo("No database name could be found in the given connection string 'Data Source=localhost'.")); }