Esempio n. 1
0
        public void Test_Peek()
        {
            var key = "CouchbaseQueueTests.Test_Peek";

            _bucket.Remove(key);

            var queue = new CouchbaseQueue <Poco>(_bucket, key);

            queue.Enqueue(new Poco {
                Name = "pcoco1"
            });
            queue.Enqueue(new Poco {
                Name = "pcoco2"
            });
            queue.Enqueue(new Poco {
                Name = "pcoco3"
            });

            var item = queue.Peek();

            Assert.AreEqual("pcoco1", item.Name);

            var items = _bucket.Get <List <Poco> >(key).Value;

            Assert.AreEqual(3, items.Count);
        }
Esempio n. 2
0
        public void Test_Peek_Throws_InvalidOperationException_When_Empty()
        {
            var key = "Test_Peek_Throws_InvalidOperationException_When_Empty";

            _bucket.Remove(key);

            var queue = new CouchbaseQueue <Poco>(_bucket, key);

            Assert.Throws <InvalidOperationException>(() => queue.Peek());
        }
        public void Test_Peek()
        {
            var key = "CouchbaseQueueTests.Test_Peek";
            _bucket.Remove(key);

            var queue = new CouchbaseQueue<Poco>(_bucket, key);
            queue.Enqueue(new Poco { Name = "pcoco1" });
            queue.Enqueue(new Poco { Name = "pcoco2" });
            queue.Enqueue(new Poco { Name = "pcoco3" });

            var item = queue.Peek();
            Assert.AreEqual("pcoco1", item.Name);

            var items = _bucket.Get<List<Poco>>(key).Value;
            Assert.AreEqual(3, items.Count);
        }
        public void Test_Peek_Throws_InvalidOperationException_When_Empty()
        {
            var key = "Test_Peek_Throws_InvalidOperationException_When_Empty";
            _bucket.Remove(key);

            var queue = new CouchbaseQueue<Poco>(_bucket, key);

            Assert.Throws<InvalidOperationException>(() => queue.Peek());
        }