private async Task PrintMssqlVersion(MssqlContainer mssql) { using (var connection = new SqlConnection(mssql.GetConnectionString())) using (var command = new SqlCommand("SELECT @@VERSION", connection)) { await connection.OpenAsync(); var reader = await command.ExecuteReaderAsync(); await reader.ReadAsync(); _testOutput.WriteLine($"MSSQL Version: {reader.GetString(0)}"); } }
public async Task InitializeAsync() { DockerEnvironmentBuilder builder = new DockerEnvironmentBuilder(); m_environment = builder .AddMssqlContainer(SqlContainerName, Guid.NewGuid().ToString()) .Build(); await m_environment.Up(); m_mssqlContainer = m_environment.GetContainer <MssqlContainer>(SqlContainerName); m_connectionString = m_mssqlContainer.GetConnectionString(); Initialize(); }