Esempio n. 1
0
        public async Task TestGetEntityFramework()
        {
            await CreateOrdersDb();

            await using var ordersDbContext = new OrdersDbContext();
            var entityFrameworkDataLayer = new EntityFrameworkDataLayer(ordersDbContext);
            var asyncEnumerable          = await entityFrameworkDataLayer.WhereAsync((Expression <Func <OrderRecord, bool> >) _getOrderByIdPredicate);

            var returnValue = await asyncEnumerable.ToListAsync();

            Assert.AreEqual(1, returnValue.Count);
        }
Esempio n. 2
0
        public async Task TestGetEntityFrameworkViaGraphQL()
        {
            var schema = SchemaBuilder.FromObject <OrdersDbContext>();

            var expressionFromGraphQLProvider = new ExpressionFromGraphQLProvider(schema);

            var expression = expressionFromGraphQLProvider.GetExpression($@"orderRecord.where(id = ""{_id}"")");

            await CreateOrdersDb();

            await using var ordersDbContext = new OrdersDbContext();
            var entityFrameworkDataLayer = new EntityFrameworkDataLayer(ordersDbContext);
            var asyncEnumerable          = await entityFrameworkDataLayer.WhereAsync((Expression <Func <OrderRecord, bool> >) expression);

            var returnValue = await asyncEnumerable.ToListAsync();

            Assert.AreEqual(1, returnValue.Count);
        }