Example #1
0
        public void CanConnectToCosmosDb()
        {
            string     id = DateTime.UtcNow.Ticks.ToString();
            NewsThread t  = new NewsThread()
            {
                Id            = id,
                DatePublished = DateTime.Now,
                Position      = 0,
                Source        = "unittest",
                LastModified  = DateTime.Now,
                User          = "******",
                Subject       = "CanConnectToCosmosDb"
            };

            db.CreateAsync("threads", "unittest", t).Wait();
            var item = db.GetAsync <NewsThread>("threads", "unittest", id).Result;

            Assert.NotNull(item);
        }
Example #2
0
        public void CanGetNewsThreads()
        {
            string id = DateTime.UtcNow.Ticks.ToString();

            for (int i = 0; i < 5; i++)
            {
                NewsThread t = new NewsThread()
                {
                    Id            = id + i.ToString(),
                    DatePublished = DateTime.Now,
                    Position      = 0,
                    Source        = "unittest",
                    LastModified  = DateTime.Now,
                    User          = "******",
                    Subject       = "CanGetNewsThreads" + i.ToString()
                };
                db.CreateAsync("threads", "unittest", t).Wait();
            }
            var items = db.GetAsync <NewsThread>("threads", "unittest", new[] { id + "0", id + "1", id + "2" }).Result;

            Assert.NotEmpty(items);
        }