public void Should_throw_an_exception_when_databasetype_is_not_supported() { _connectionstringArgumentsMapper.Expect(cam => cam.Map(Arg<string>.Is.Anything, Arg<string>.Is.Anything, Arg<string>.Is.Anything, Arg<string>.Is.Anything, Arg<string>.Is.Anything, Arg<string>.Is.Anything)) .Throw(new DatabaseTypeException("DatabaseTypeException")); _databaseSchemaExplorerController = new DatabaseSchemaExplorerController(_connectionstringArgumentsMapper, _databaseSchemaExplorer); _databaseSchemaExplorerController.Tables("DatabaseType", "Provider", "DataSource", "DatabaseName", "TableName","Username", "Password"); }
public void Should_throw_an_exception_when_table_is_not_found() { const string tableName = "NotExsitingTable"; _connectionstringArgumentsMapper.Expect(csam => csam.Map(Arg<string>.Is.Anything, Arg<string>.Is.Anything, Arg<string>.Is.Anything, Arg<string>.Is.Anything, Arg<string>.Is.Anything, Arg<string>.Is.Anything)).Return(new SqlServerConnectionstringArguments()); _databaseSchemaExplorer.Expect(de => de.GetTable(Arg<IConnectionstringArguments>.Is.Anything, Arg<string>.Is.Anything)).Throw(new TableNotFoundException(tableName)); _databaseSchemaExplorerController = new DatabaseSchemaExplorerController(_connectionstringArgumentsMapper, _databaseSchemaExplorer); _databaseSchemaExplorerController.Tables("DatabaseType", "Provider", "DataSource", "DatabaseName", tableName, "Username", "Password"); }
public void SetUp() { SqlServerDatabaseHelper.InitializeDatabase(); SqlServerDatabaseHelper.CreateUser(Username, Password); var connectionstringBuilderFactory = new ConnectionstringBuilderFactory(); var connectionstringBuilder = new ConnectionstringBuilder.ConnectionstringBuilder(connectionstringBuilderFactory); var indexMapper = new IndexMapper(); var foreignKeyMapper = new ForeignKeyMapper(); var columnMapper = new ColumnMapper(); var schemaReader = new SchemaReader(foreignKeyMapper, columnMapper, indexMapper); var connectionstringArgumentsMapper = new ConnectionstringArgumentsMapper(); var databaseSchemaExplorer = new DatabaseSchemaExplorer(connectionstringBuilder, schemaReader); _databaseSchemaExplorerController = new DatabaseSchemaExplorerController(connectionstringArgumentsMapper, databaseSchemaExplorer); }