Exemple #1
0
        public void IndexHasLinkToDocuments()
        {
            _store.RegisterIndexes<ArticleIndexProvider>();

            using (var session = _store.CreateSession())
            {
                var d1 = new Article { PublishedUtc = new DateTime(2011, 11, 1) };
                var d2 = new Article { PublishedUtc = new DateTime(2011, 11, 1) };

                session.Save(d1);
                session.Save(d2);

            }

            using (var session = _store.CreateSession())
            {
                var articles = session.Load<Article>();
                Assert.Equal(2, articles.Count());
            }
        }
Exemple #2
0
        public async Task ChangesAreAutoFlushed()
        {
            _store.RegisterIndexes<ArticleIndexProvider>();

            using (var session = _store.CreateSession())
            {
                var d1 = new Article { PublishedUtc = new DateTime(2011, 11, 1) };
                var d2 = new Article { PublishedUtc = new DateTime(2011, 11, 1) };

                session.Save(d1);
                session.Save(d2);

                var articles = session.QueryAsync<Article, ArticlesByDay>(x => x.DayOfYear == 305);
                Assert.Equal(2, await articles.Count());
            }
        }