public static void CreateConnection_WhenInvoked_ReturnsConnectionInClosedState() { var factory = new SqliteConnectionFactory("Data Source=:memory:"); using var connection = factory.CreateConnection(); Assert.That(connection.State, Is.EqualTo(ConnectionState.Closed)); }
public void Manages_borrowed_connection() { Func<string, IDbConnection> func = cs => { var factory = new SqliteConnectionFactory { ConnectionString = cs }; return factory.CreateConnection(); }; Database.Install(CreateConnectionString(), func); var db1 = UnitOfWork.Current; var db2 = UnitOfWork.Current; Assert.IsNotNull(db1); Assert.IsNotNull(db2); Assert.AreEqual(db1, db2); }
public PersonsService(SqliteConnectionFactory connectionFactory) { _masterConnection = connectionFactory.CreateConnection(); }