Beispiel #1
0
 public QueryDocumentsCommand(ISimoConnection connection)
     : base(connection)
 {
     Options = QueryCommandOptions.None;
     NumberOfDocumentsToSkip   = null;
     NumberOfDocumentsToReturn = null;
 }
        public void GetPipeStream_WhileNotConnected_ThrowsException()
        {
            _connection = TestHelper.CreateConnection();

            var stream = _connection.GetPipeStream();

            Assert.IsNull(stream, "Pipestream shall not be returned when not connected!");
        }
 protected override void OnTestCleanup()
 {
     if (_connection != null && _connection.IsConnected)
     {
         _connection.Dispose();
         _connection = null;
     }
 }
        public void Connect_ServerIsUp_CanConnect()
        {
            _connection = TestHelper.CreateConnection();

            _connection.Connect();

            Assert.IsTrue(_connection.IsConnected);
        }
        public void Connect_ServerIsUp_CanConnect()
        {
            _connection = TestHelper.CreateConnection();

            _connection.Connect();

            Assert.IsTrue(_connection.IsConnected);
        }
        public void Connect_WhileConnected_ThrowsException()
        {
            _connection = TestHelper.CreateConnection();
            _connection.Connect();

            _connection.Connect();

            Assert.IsTrue(_connection.IsConnected);
        }
        public void Dispose_WhenConnected_GetsDisconnected()
        {
            _connection = TestHelper.CreateConnection();
            _connection.Connect();

            _connection.Dispose();

            Assert.IsFalse(_connection.IsConnected);
        }
        public void Dispose_WhenConnected_GetsDisconnected()
        {
            _connection = TestHelper.CreateConnection();
            _connection.Connect();

            _connection.Dispose();

            Assert.IsFalse(_connection.IsConnected);
        }
        public void Connect_WhileConnected_ThrowsException()
        {
            _connection = TestHelper.CreateConnection();
            _connection.Connect();

            _connection.Connect();

            Assert.IsTrue(_connection.IsConnected);
        }
        public void GetPipeStream_WhenConnected_ReturnsStream()
        {
            _connection = TestHelper.CreateConnection();
            _connection.Connect();

            using (var stream = _connection.GetPipeStream())
            {
                Assert.IsNotNull(stream);
            }
        }
        public void Connect_NoServerIsUp_ThrowsException()
        {
            var dummyHost = Guid.NewGuid().ToString();
            var dummyConnectionInfo = new SimoConnectionInfo(dummyHost, SimoConnectionInfo.DefaultPort);
            _connection = new SimoConnection(dummyConnectionInfo);

            _connection.Connect();

            Assert.Fail("Connect should have generated exception.");
        }
 /// <summary>
 /// http://docs.mongodb.org/meta-driver/latest/legacy/implement-authentication-in-driver/
 /// </summary>
 /// <param name="connection"></param>
 /// <param name="UserName"></param>
 /// <param name="KeyDigest"></param>
 /// <param name="nonce"></param>
 public AuthenticateCommand(ISimoConnection connection, Reconnection recCallback, string UserName, string KeyDigest, string nonce)
     : base(connection, recCallback, new
     {
         authenticate = 1.0,
         user = UserName,
         nonce = nonce,
         key = KeyDigest
     })
 {
 }
        public void GetPipeStream_WhenConnected_ReturnsStream()
        {
            _connection = TestHelper.CreateConnection();
            _connection.Connect();

            using(var stream = _connection.GetPipeStream())
            {
                Assert.IsNotNull(stream);
            }
        }
        public void Connect_NoServerIsUp_ThrowsException()
        {
            var dummyHost           = Guid.NewGuid().ToString();
            var dummyConnectionInfo = new SimoConnectionInfo(dummyHost, SimoConnectionInfo.DefaultPort);

            _connection = new SimoConnection(dummyConnectionInfo);

            _connection.Connect();

            Assert.Fail("Connect should have generated exception.");
        }
Beispiel #15
0
        protected virtual void OnExecute(ISimoConnection connection)
        {
            var request = GenerateRequest();

            using (var requestStream = connection.GetPipeStream())
            {
                using (var requestWriter = new RequestWriter(requestStream))
                {
                    requestWriter.Write(request);

                    OnRequestSent();
                }
            }
        }
Beispiel #16
0
        protected virtual void OnExecute(ISimoConnection connection)
        {
            var request = GenerateRequest();

            //using (var requestStream = connection.GetPipeStream())
            var requestStream = connection.GetPipeStream();
            //{
            //using (var requestWriter = new RequestWriter(requestStream))
            var requestWriter = new RequestWriter(requestStream);
            //{
            requestWriter.Write(request);

            OnRequestSent();
            //}
            //}
        }
 public DropCollectionCommand(ISimoConnection connection)
     : base(connection, null)
 {
 }
 public InsertDocumentsCommand(ISimoConnection connection)
     : base(connection)
 {
 }
 protected override void OnTestCleanup()
 {
     if (_connection != null && _connection.IsConnected)
     {
         _connection.Dispose();
         _connection = null;
     }
 }
Beispiel #20
0
 public InsertDocumentsCommand(ISimoConnection connection)
     : base(connection)
 {
 }
Beispiel #21
0
 protected SimoCommand(ISimoConnection connection, Reconnection OnReconnect)
 {
     Connection = connection;
     ReconnectionCallback = OnReconnect;
 }
Beispiel #22
0
 protected SimoCommand(ISimoConnection connection)
 {
     Connection = connection;
 }
Beispiel #23
0
 public UpdateDocumentsCommand(ISimoConnection connection)
     : base(connection)
 {
     Mode = UpdateModes.Upsert;
 }
 public UpdateDocumentsCommand(ISimoConnection connection)
     : base(connection)
 {
     Mode = UpdateModes.Upsert;
 }
Beispiel #25
0
 public SimoSession(ISimoConnection connection)
 {
     Connection = connection;
     Pluralizer = SimoEngine.Instance.IoC.Resolve<ISimoPluralizer>();
 }
 public GetNonceCommand(ISimoConnection connection, Reconnection OnReconnect)
     : base(connection, OnReconnect, new { getnonce = 1.0 })
 {
 }
 public DropDatabaseCommand(ISimoConnection connection, Reconnection OnReconnect)
     : base(connection, OnReconnect, new { dropDatabase = 1.0 })
 {
 }
 public GetLastErrorCommand(ISimoConnection connection, Reconnection OnReconnect)
     : base(connection, OnReconnect, new { getlasterror = 1.0 })
 {
 }
 public DropDatabaseCommand(ISimoConnection connection)
     : base(connection, new { dropDatabase = 1.0 })
 {
 }
Beispiel #30
0
 public GetLastErrorCommand(ISimoConnection connection)
     : base(connection, new { getlasterror = 1.0 })
 {
 }
 public SimoSession(ISimoConnection connection)
 {
     Connection = connection;
     Pluralizer = SimoEngine.Instance.IoC.Resolve <ISimoPluralizer>();
 }
 protected DatabaseCommand(ISimoConnection connection, object command)
     : base(connection)
 {
     Command = command;
 }
 public DropCollectionCommand(ISimoConnection connection, Reconnection OnReconnect)
     : base(connection, OnReconnect, null)
 {
 }
 public UpdateDocumentsCommand(ISimoConnection connection, Reconnection recCallback)
     : base(connection, recCallback)
 {
     Mode = UpdateModes.Upsert;
 }
Beispiel #35
0
        protected override void OnExecute(ISimoConnection connection)
        {
            InitializeResponse();

            base.OnExecute(connection);
        }
 public DropDatabaseCommand(ISimoConnection connection)
     : base(connection, new { dropDatabase = 1.0 })
 {
 }
Beispiel #37
0
 public QueryDocumentsCommand <TDocumentInfered> CreateInfered <TDocumentInfered>(ISimoConnection connection, TDocumentInfered inferedTemplate)
     where TDocumentInfered : class
 {
     return(new QueryDocumentsCommand <TDocumentInfered>(connection));
 }
        public void GetPipeStream_WhileNotConnected_ThrowsException()
        {
            _connection = TestHelper.CreateConnection();

            var stream = _connection.GetPipeStream();

            Assert.IsNull(stream, "Pipestream shall not be returned when not connected!");
        }
 public GetMoreCommand(ISimoConnection connection, long cursorId, int numberOfDocumentsToReturn)
     : base(connection)
 {
     InitialCursorId           = cursorId;
     NumberOfDocumentsToReturn = numberOfDocumentsToReturn;
 }
 public DropCollectionCommand(ISimoConnection connection)
     : base(connection, null)
 {
 }
        protected override void OnExecute(ISimoConnection connection)
        {
            Command = new { drop = CollectionName };

            base.OnExecute(connection);
        }
 public DeleteDocumentsCommand(ISimoConnection connection, Reconnection recCallback)
     : base(connection, recCallback)
 {
 }
Beispiel #43
0
 protected SimoResponseCommand(ISimoConnection connection)
     : base(connection)
 {
     InitializeResponse();
 }
        protected override void OnExecute(ISimoConnection connection)
        {
            Command = new { drop = CollectionName };

            base.OnExecute(connection);
        }
 public DeleteDocumentsCommand(ISimoConnection connection)
     : base(connection)
 {
 }