Exemple #1
0
        public async Task OpenSharedConnectionAsync_SqlConnection_ConnectionOpened()
        {
            var definitionProvider = new DataAnnotationsDefinitionProvider();
            var statementCompiler  = new TransactSqlAdapter(definitionProvider);

            await using (var connection = new SqlConnection(ConfigurationRoot.GetConnectionString("MasterDatabase")))
                await using (var database = new DatabaseContext(connection, statementCompiler))
                {
                    var cancellationToken = CancellationToken.None;
                    await database.OpenSharedConnectionAsync(cancellationToken);

                    await database.ChangeDatabaseAsync("master", cancellationToken);

                    Assert.AreEqual("master", database.Connection.Database);
                }
        }