public DatabaseSandboxSqlConnectionTest() { IConnectionStringBuilder connectionStringBuilder = new StubConnectionStringBuilder(); _sqlServerDbSandBoxConnection = new SqlServerDbSandBoxConnection(connectionStringBuilder); }
public void open_connection_with_userPassword_ConnectionString() { IConnectionStringBuilder connectionStringBuilder = new StubConnectionStringBuilder() .SetConnectionString("data source=.\\MSSQLSERVER2016;initial catalog=master;User Id=sa;Password=123456"); var serverConnectionString = new SqlServerDbSandBoxConnection(connectionStringBuilder); serverConnectionString.Open(); }
public void when_canNot_open_connection_to_database_should_throw_exception() { IConnectionStringBuilder connectionStringBuilder = new StubConnectionStringBuilder() .SetConnectionString("data source=.;initial catalog=master;User Id=sa;Password=123457"); var serverConnectionString = new SqlServerDbSandBoxConnection(connectionStringBuilder); Action action = () => serverConnectionString.Open(); action.Should().Throw <CannotConnectToDatabaseException>(); }
public async Task when_openAsync_canNot_open_connection_to_database_should_throw_exception() { //Todo: what should i do for CI server, is there any account!!! IConnectionStringBuilder connectionStringBuilder = new StubConnectionStringBuilder() .SetConnectionString("data source=.;initial catalog=master;User Id=sa;Password=123457"); var serverConnectionString = new SqlServerDbSandBoxConnection(connectionStringBuilder); Func <Task> action = async() => await serverConnectionString.OpenAsync(); action.Should().Throw <CannotConnectToDatabaseException>(); }