Get() public static méthode

public static Get ( IConnectionBuilder connectionBuilder ) : IConnectionProvider
connectionBuilder IConnectionBuilder
Résultat IConnectionProvider
Exemple #1
0
        public void PooledConnectionProvider()
        {
            // arrange
            var expected         = typeof(PooledConnectionProvider);
            var connectionString = "Keyspace=Testing;Pooling=True";

            // act
            var result = new ConnectionBuilder(connectionString);
            var actual = ConnectionProviderFactory.Get(result).GetType();

            // assert
            Assert.AreEqual(expected, actual);
        }
        public void PooledConnectionProvider()
        {
            // arrange
            var expected         = typeof(PooledConnectionProvider);
            var connectionString = "Keyspace=" + ConfigurationManager.AppSettings["TestKeySpace"] + ";Pooling=True";

            // act
            var result = new ConnectionBuilder(connectionString);
            var actual = ConnectionProviderFactory.Get(result).GetType();

            // assert
            Assert.Equal(expected, actual);
        }
        public void Fails_Over()
        {
            // arrange
            var expectedHost = ConfigurationManager.AppSettings["TestServer"];
            var expectedPort = Convert.ToInt16(ConfigurationManager.AppSettings["TestPort"]);

            // act
            var result     = new ConnectionBuilder(_failoverConnectionString);
            var provider   = ConnectionProviderFactory.Get(result);
            var conn       = provider.Open();
            var actualHost = conn.Server.Host;
            var actualPort = conn.Server.Port;

            // assert
            Assert.Equal(expectedHost, actualHost);
            Assert.Equal(expectedPort, actualPort);
        }
        public void Fails_Over()
        {
            // arrange
            var expectedHost = "127.0.0.1";
            var expectedPort = Server.DefaultPort;

            // act
            var result     = new ConnectionBuilder(FailoverConnectionString);
            var provider   = ConnectionProviderFactory.Get(result);
            var conn       = provider.Open();
            var actualHost = conn.Server.Host;
            var actualPort = conn.Server.Port;

            // assert
            Assert.AreEqual(expectedHost, actualHost);
            Assert.AreEqual(expectedPort, actualPort);
        }