Exemple #1
0
        public void Ack()
        {
            var messageOne = new BsonDocument {
                { "key1", 0 }, { "key2", true }
            };

            using (var streamOne = new MemoryStream())
                using (var streamTwo = new MemoryStream())
                {
                    streamOne.WriteByte(111);
                    streamTwo.WriteByte(222);
                    streamOne.Position = 0;
                    streamTwo.Position = 0;
                    queue.Send(messageOne, DateTime.Now, 0.0, new Dictionary <string, Stream> {
                        { "one", streamOne }, { "two", streamTwo }
                    });
                }
            queue.Send(new BsonDocument("key", "value"));

            var result = queue.Get(new QueryDocument(messageOne), TimeSpan.MaxValue, TimeSpan.Zero);

            Assert.AreEqual(2, collection.Count());

            queue.Ack(result.Handle);
            Assert.AreEqual(1, collection.Count());
            Assert.AreEqual(0, gridfs.Files.Count());
            Assert.AreEqual(0, gridfs.Chunks.Count());
        }