public void CompleteMessageTest()
        {
            this.SubmitRequestWithPropertiesTest();

            var manager = new QueueMessageManagerMongoDb(CONNECTION_STRING);

            var item = new QueueMessageItem()
            {
                TextInput = "My input",
                Message   = "Getting started."
            };

            manager.CreateItem(item);

            manager.Properties["Time"] = DateTime.Now;

            Assert.IsTrue(manager.Save(), manager.ErrorMessage);

            string reqId = item.Id;

            manager = new QueueMessageManagerMongoDb();
            item    = manager.GetNextQueueMessage();

            DateTime?time = manager.GetProperty("Time") as DateTime?;

            Assert.IsNotNull(time);

            manager.CompleteRequest(item, "Message completed @" + DateTime.Now.ToString("t"));

            Assert.IsTrue(manager.Save(), manager.ErrorMessage);
        }
        public void GetNextQueueMessageItemWithAddedItemTest()
        {
            using (var manager = new QueueMessageManagerMongoDb(CONNECTION_STRING))
            {
                Assert.IsTrue(manager.DeleteWaitingMessages());

                // create a pending message
                manager.SubmitRequest(messageText: "Next Complete Test " + DateTime.Now.ToString("t"));
                Assert.IsTrue(manager.Save(), manager.ErrorMessage);

                var item = manager.GetNextQueueMessage();
                Assert.IsNotNull(item, manager.ErrorMessage);

                Console.WriteLine(item.Status);

                manager.CompleteRequest(item, "Next Complete complete " + DateTime.Now.ToString("t"));

                Assert.IsTrue(manager.Save(), manager.ErrorMessage);
            }
        }
        public void CompleteMessageTest()
        {
            this.SubmitRequestWithPropertiesTest();

            var manager = new QueueMessageManagerMongoDb(CONNECTION_STRING);

            var item = new QueueMessageItem()
            {
                 TextInput = "My input",
                 Message = "Getting started."
            };
            manager.CreateItem(item);

            manager.Properties["Time"] = DateTime.Now;

            Assert.IsTrue(manager.Save(),manager.ErrorMessage);

            string reqId = item.Id;

            manager = new QueueMessageManagerMongoDb();            
            item = manager.GetNextQueueMessage();

            DateTime? time = manager.GetProperty("Time") as DateTime?;
            Assert.IsNotNull(time);

            manager.CompleteRequest(item,"Message completed @" + DateTime.Now.ToString("t"));

            Assert.IsTrue(manager.Save(), manager.ErrorMessage);
        }
        public void GetNextQueueMessageItemWithAddedItemTest()
        {
  
            using (var manager = new QueueMessageManagerMongoDb(CONNECTION_STRING))
            {
                Assert.IsTrue(manager.DeleteWaitingMessages());

                // create a pending message
                manager.SubmitRequest(messageText: "Next Complete Test " + DateTime.Now.ToString("t"));
                Assert.IsTrue(manager.Save(), manager.ErrorMessage);
                
                var item = manager.GetNextQueueMessage();
                Assert.IsNotNull(item, manager.ErrorMessage);

                Console.WriteLine(item.Status);

                manager.CompleteRequest(item, "Next Complete complete " + DateTime.Now.ToString("t"));

                Assert.IsTrue(manager.Save(), manager.ErrorMessage);
            }
        }