Example #1
0
        private async Task CreateOrdersDb()
        {
            await using var ordersDbContext = new OrdersDbContext();
            await ordersDbContext.OrderRecord.AddAsync(new OrderRecord { Id = _id });

            await ordersDbContext.SaveChangesAsync();
        }
Example #2
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);
        }
Example #3
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);
        }