示例#1
0
        public async Task FirstAsync_NoValue()
        {
            var tenantId   = TestConfiguration.GetTenantId();
            var connection = TestConfiguration.GetConnection();
            var context    = new MongoDbTenantContext(connection, tenantId);
            var dbSet      = new MongoDbTenantSet <QueryableAsyncModel>(context);

            dbSet.AddRange(GetModels());
            context.SaveChanges();

            var context2 = new MongoDbTenantContext(connection, tenantId + "-2");
            var dbSet2   = new MongoDbTenantSet <QueryableAsyncModel>(context2);

            await Assert.ThrowsExceptionAsync <InvalidOperationException>(async() => await dbSet2.FirstAsync());
        }