public async Task TestGetLiteDb() { using var db = SetupLiteDb(); var repoDbDataLayer = new LiteDbDataLayer(db); var asyncEnumerable = await repoDbDataLayer .GetAsync((Expression <Func <OrderRecord, bool> >) _getOrderByIdPredicate); var returnValue = await asyncEnumerable.ToListAsync(); Assert.AreEqual(1, returnValue.Count); }
public async Task TestGetLiteDbWithBusinessLayer() { using var db = SetupLiteDb(); var liteDbDataLayer = new LiteDbDataLayer(db); var businessLayer = new BusinessLayer(whereAsync: liteDbDataLayer.GetAsync); var getAsync = (WhereAsync)businessLayer.WhereAsync; var asyncEnumerable = getAsync.GetAsync((Expression <Func <OrderRecord, bool> >)_getOrderByIdPredicate); var returnValue = (await asyncEnumerable).ToListAsync().Result; Assert.AreEqual(1, returnValue.Count); }
public async Task TestGetDbLiteViaGraphQL() { using var db = SetupLiteDb(); var schema = SchemaBuilder.FromObject <OrdersDbContext>(); var expressionFromGraphQLProvider = new ExpressionFromGraphQLProvider(schema); var expression = expressionFromGraphQLProvider.GetExpression($@"orderRecord.where(id = ""{_id}"")"); await CreateOrdersDb(); var repoDbDataLayer = new LiteDbDataLayer(db); var asyncEnumerable = await repoDbDataLayer .GetAsync((Expression <Func <OrderRecord, bool> >) expression); var returnValue = await asyncEnumerable.ToListAsync(); Assert.AreEqual(1, returnValue.Count); }