public async Task FirstOrDefaultAsync_NoValue()
        {
            EntityMapping.RegisterType(typeof(QueryableAsyncModel));

            var connection = TestConfiguration.GetConnection();
            var provider   = new MongoFrameworkQueryProvider <QueryableAsyncModel>(connection);
            var queryable  = new MongoFrameworkQueryable <QueryableAsyncModel>(provider);

            Assert.IsNull(await queryable.FirstOrDefaultAsync());
        }
        public async Task FirstOrDefaultAsync_WithPredicate()
        {
            EntityMapping.RegisterType(typeof(QueryableAsyncModel));

            var connection = TestConfiguration.GetConnection();
            var context    = new MongoDbContext(connection);
            var provider   = new MongoFrameworkQueryProvider <QueryableAsyncModel>(connection);
            var queryable  = new MongoFrameworkQueryable <QueryableAsyncModel>(provider);

            context.ChangeTracker.SetEntityState(new QueryableAsyncModel {
                Title = "FirstOrDefaultAsync_WithPredicate.1"
            }, EntityEntryState.Added);
            context.ChangeTracker.SetEntityState(new QueryableAsyncModel {
                Title = "FirstOrDefaultAsync_WithPredicate.2"
            }, EntityEntryState.Added);
            context.SaveChanges();

            var result = await queryable.FirstOrDefaultAsync(e => e.Title == "FirstOrDefaultAsync_WithPredicate.2");

            Assert.AreEqual("FirstOrDefaultAsync_WithPredicate.2", result.Title);
        }