public void AuthenticatesWithProperCredentials()
 {
     var provider = new NormalConnectionProvider(ConnectionStringBuilder.Create(AuthenticatedConnectionString("usr", "8e156e298e19afdc3a104ddd172a2bee")));
     var connection = provider.Open(null);
     Assert.Equal(true, connection.Client.Connected);
     provider.Close(connection);
 }
 public void ClosesTheUnderlyingConnection()
 {
     var provider = new NormalConnectionProvider(ConnectionStringBuilder.Create(TestHelper.ConnectionString()));
     var connection = provider.Open(null);
     provider.Close(connection);
     Assert.Null(connection.Client.Client);
 }
        public void ThrowsExceptionIfConnectingWithInvalidCredentials()
        {
            var provider = new NormalConnectionProvider(ConnectionStringBuilder.Create(AuthenticatedConnectionString("bad", "boy")));

            var ex = Assert.Throws<MongoException>(() => provider.Open(null));
            Assert.Equal("auth fails", ex.Message);
        }
        public void ThrowsExceptionIfConnectingWithInvalidCredentials()
        {
            var provider = new NormalConnectionProvider(ConnectionStringBuilder.Create(AuthenticatedConnectionString("bad", "boy")));

            var ex = Assert.Throws <MongoException>(() => provider.Open(null));

            Assert.Equal("auth fails", ex.Message);
        }
        public void AuthenticatesWithProperCredentials()
        {
            var provider   = new NormalConnectionProvider(ConnectionStringBuilder.Create(AuthenticatedConnectionString("usr", "pss")));
            var connection = provider.Open(null);

            Assert.Equal(true, connection.Client.Connected);
            provider.Close(connection);
        }
        public void ClosesTheUnderlyingConnection()
        {
            var provider   = new NormalConnectionProvider(ConnectionStringBuilder.Create(TestHelper.ConnectionString()));
            var connection = provider.Open(null);

            provider.Close(connection);
            Assert.Null(connection.Client.Client);
        }
 public void CreatesANewConnectionForEachOpen()
 {
     IConnection connection1 = null;
     IConnection connection2 = null;
     var provider = new NormalConnectionProvider(ConnectionStringBuilder.Create(TestHelper.ConnectionString()));
     
     try
     {            
         connection1 = provider.Open(null);
         connection2 = provider.Open(null);
         Assert.NotSame(connection1, connection2);
     }
     finally
     {
         if (connection1 != null) { provider.Close(connection1); }
         if (connection2 != null) { provider.Close(connection2); }                
     }
 }
        public void CreatesANewConnectionForEachOpen()
        {
            IConnection connection1 = null;
            IConnection connection2 = null;
            var         provider    = new NormalConnectionProvider(ConnectionStringBuilder.Create(TestHelper.ConnectionString()));

            try
            {
                connection1 = provider.Open(null);
                connection2 = provider.Open(null);
                Assert.NotSame(connection1, connection2);
            }
            finally
            {
                if (connection1 != null)
                {
                    provider.Close(connection1);
                }
                if (connection2 != null)
                {
                    provider.Close(connection2);
                }
            }
        }