public IncludeReferenceSeed(DatabaseFixture databaseFixture)
        {
            var blogs = databaseFixture.Database.GetCollection <IncludeReferenceTests.Blog>();
            var posts = databaseFixture.Database.GetCollection <IncludeReferenceTests.Post>();

            var blog1 = new IncludeReferenceTests.Blog
            {
                Id   = ObjectId.GenerateNewId(),
                Name = "Blog1"
            };
            var blog2 = new IncludeReferenceTests.Blog
            {
                Id   = ObjectId.GenerateNewId(),
                Name = "Blog2"
            };
            var blog3 = new IncludeReferenceTests.Blog
            {
                Id   = ObjectId.GenerateNewId(),
                Name = "Blog3"
            };

            var post1 = new IncludeReferenceTests.Post
            {
                Id   = ObjectId.GenerateNewId(),
                Name = "Post1"
            };
            var post2 = new IncludeReferenceTests.Post
            {
                Id   = ObjectId.GenerateNewId(),
                Name = "Post2"
            };
            var post3 = new IncludeReferenceTests.Post
            {
                Id   = ObjectId.GenerateNewId(),
                Name = "Post3",
            };
            var post4 = new IncludeReferenceTests.Post
            {
                Id   = ObjectId.GenerateNewId(),
                Name = "Post4"
            };
            var post5 = new IncludeReferenceTests.Post
            {
                Id   = ObjectId.GenerateNewId(),
                Name = "Post5"
            };

            post1.BlogId = blog1.Id;
            post2.BlogId = blog1.Id;

            blog2.PostIds = new[] { post3.Id, post4.Id };

            blogs.InsertMany(new[] { blog1, blog2, blog3 });
            posts.InsertMany(new[] { post1, post2, post3, post4, post5 });
        }
Example #2
0
        public IncludeCollectionSeed(DatabaseFixture databaseFixture)
        {
            var blogs = databaseFixture.Database.GetCollection <IncludeCollectionTests.Blog>();
            var posts = databaseFixture.Database.GetCollection <IncludeCollectionTests.Post>();

            var blog1 = new IncludeCollectionTests.Blog
            {
                Id   = ObjectId.GenerateNewId(),
                Name = "Blog1"
            };
            var blog2 = new IncludeCollectionTests.Blog
            {
                Id   = ObjectId.GenerateNewId(),
                Name = "Blog2"
            };
            var blog3 = new IncludeCollectionTests.Blog
            {
                Id   = ObjectId.GenerateNewId(),
                Name = "Blog2"
            };

            var post1 = new IncludeCollectionTests.Post
            {
                Id   = ObjectId.GenerateNewId(),
                Name = "Post1",
            };
            var post2 = new IncludeCollectionTests.Post
            {
                Id   = ObjectId.GenerateNewId(),
                Name = "Post2",
            };
            var post3 = new IncludeCollectionTests.Post
            {
                Id   = ObjectId.GenerateNewId(),
                Name = "Post3",
            };

            blog1.PostIds = new[] { post1.Id, post2.Id };
            post1.BlogIds = new[] { blog1.Id, blog2.Id };

            blogs.InsertMany(new[] { blog1, blog2, blog3 });
            posts.InsertMany(new[] { post1, post2, post3 });
        }
Example #3
0
        public IncludeCollectionTests(DatabaseFixture databaseFixture)
        {
            this.postCollection = databaseFixture.Database.GetCollection <Post>();
            this.blogCollection = databaseFixture.Database.GetCollection <Blog>();

            #region Test Syntax
            //#region Include all
            //postCollection.AsAggregateQueryable().Include(p => p.Blog);
            //postCollection.AsAggregateQueryable().Include(p => p.BlogSS);
            //postCollection.AsAggregateQueryable().Include(p => p.BlogSSS);
            //postCollection.AsAggregateQueryable().Include(p => p.BlogSSSS);
            //#endregion

            //#region Include all ThenInclude Post
            //postCollection.AsAggregateQueryable().Include(p => p.Blog).ThenInclude(p => p.Post);
            //postCollection.AsAggregateQueryable().Include(p => p.BlogSS).ThenInclude(p => p.Post);
            //postCollection.AsAggregateQueryable().Include(p => p.BlogSSS).ThenInclude(p => p.Post);
            //postCollection.AsAggregateQueryable().Include(p => p.BlogSSSS).ThenInclude(p => p.Post);
            //#endregion

            //#region Include all ThenInclude PostSS
            //postCollection.AsAggregateQueryable().Include(p => p.Blog).ThenInclude(p => p.PostSS);
            //postCollection.AsAggregateQueryable().Include(p => p.BlogSS).ThenInclude(p => p.PostSS);
            //postCollection.AsAggregateQueryable().Include(p => p.BlogSSS).ThenInclude(p => p.PostSS);
            //postCollection.AsAggregateQueryable().Include(p => p.BlogSSSS).ThenInclude(p => p.PostSS);
            //#endregion

            //#region Include all ThenInclude PostSSS
            //postCollection.AsAggregateQueryable().Include(p => p.Blog).ThenInclude(p => p.PostSSS);
            //postCollection.AsAggregateQueryable().Include(p => p.BlogSS).ThenInclude(p => p.PostSSS);
            //postCollection.AsAggregateQueryable().Include(p => p.BlogSSS).ThenInclude(p => p.PostSSS);
            //postCollection.AsAggregateQueryable().Include(p => p.BlogSSSS).ThenInclude(p => p.PostSSS);
            //#endregion

            //#region Include all ThenInclude PostSSSS
            //postCollection.AsAggregateQueryable().Include(p => p.Blog).ThenInclude(p => p.PostSSSS);
            //postCollection.AsAggregateQueryable().Include(p => p.BlogSS).ThenInclude(p => p.PostSSSS);
            //postCollection.AsAggregateQueryable().Include(p => p.BlogSSS).ThenInclude(p => p.PostSSSS);
            //postCollection.AsAggregateQueryable().Include(p => p.BlogSSSS).ThenInclude(p => p.PostSSSS);
            #endregion
        }
Example #4
0
 public AsAggregateQueryableTests(DatabaseFixture databaseFixture)
 {
     this.collection = databaseFixture.Database.GetCollection <Post>();
     //TODO:
     var a = nameof(IAsyncCursorSourceExtensions.ToListAsync);
 }
 public IncludeReferenceTests(DatabaseFixture databaseFixture)
 {
     this.collection = databaseFixture.Database.GetCollection <Post>();
 }