Ejemplo n.º 1
0
        public void it_should_create_them_dynamically_if_the_pool_is_empty()
        {
            var sut = new RealConnectionPool(new Database(Instance, null), 1);
            sut.TakeConnection();

            sut.PooledConnections.Any().ShouldBeFalse();
            sut.TakeConnection().ShouldBeOfType<Connection>();
        }
Ejemplo n.º 2
0
        public void it_should_add_them_to_the_pool()
        {
            var connection = new Connection(new Database(Instance, null));
            var sut = new RealConnectionPool(new Database(Instance, null), 0);

            sut.FreeConnection(connection);

            sut.PooledConnections.Count.ShouldEqual(1);
        }
Ejemplo n.º 3
0
        public void it_should_take_them_from_the_pool()
        {
            ushort actual = 1;
            var expected = actual - 1;
            var sut = new RealConnectionPool(new Database(Instance, null), actual);

            sut.TakeConnection();

            sut.PooledConnections.Count.ShouldEqual(expected);
        }
Ejemplo n.º 4
0
 public void it_should_pool_connections()
 {
     var sut = new RealConnectionPool(new Database(Instance, null), 5);
     sut.PooledConnections.Count.ShouldEqual(5);
 }
Ejemplo n.º 5
0
 public void it_should_not_pool_connections_when_given_initial_size_of_zero()
 {
     var sut = new RealConnectionPool(new Database(Instance, null), 0);
     sut.PooledConnections.Count.ShouldEqual(0);
 }
Ejemplo n.º 6
0
        public void it_should_create_them_dynamically_if_the_pool_is_zero_sized()
        {
            var sut = new RealConnectionPool(new Database(Instance, null), 0);

            sut.TakeConnection().ShouldBeOfType<Connection>();
        }