Exemplo n.º 1
0
        public void FirstConnectionNoyOpenUsesSecondAndWorksTwice()
        {

            var d1 = new DummyConnectionFactoryWrapper(false);
            var d2 = new DummyConnectionFactoryWrapper(true);

            var cp = new ConnectionProvider(d2, d1);

            var connection = cp.GetConnection();
            Assert.NotNull(connection);
            var connection2 = cp.GetConnection();
            Assert.NotNull(connection2);
            Assert.Equal(1, d1.NumberOfTimesCalled);
        }
Exemplo n.º 2
0
        public void FirstThrowsSocketUsesSecondAndWorksTwice()
        {
            var d1 = new DummyConnectionFactoryWrapper(new SocketException(123));
            var d2 = new DummyConnectionFactoryWrapper(true);

            var cp = new ConnectionProvider(d2, d1);

            var connection = cp.GetConnection();

            Assert.NotNull(connection);
            var connection2 = cp.GetConnection();

            Assert.NotNull(connection2);
        }
Exemplo n.º 3
0
        public void FirstThrowsSocketUsesSecondAndWorksTwice()
        {

            var d1 = new DummyConnectionFactoryWrapper(new SocketException(123));
            var d2 = new DummyConnectionFactoryWrapper(true);

            var cp = new ConnectionProvider(d2, d1);
           
            var connection = cp.GetConnection();
            Assert.NotNull(connection);
            var connection2 = cp.GetConnection();
            Assert.NotNull(connection2);

        }
Exemplo n.º 4
0
        public void FirstConnectionNoyOpenUsesSecondAndWorksTwice()
        {
            var d1 = new DummyConnectionFactoryWrapper(false);
            var d2 = new DummyConnectionFactoryWrapper(true);

            var cp = new ConnectionProvider(d2, d1);

            var connection = cp.GetConnection();

            Assert.NotNull(connection);
            var connection2 = cp.GetConnection();

            Assert.NotNull(connection2);
            Assert.Equal(1, d1.NumberOfTimesCalled);
        }