private async Task RunDataQueryModel(CosmosDbQueryModelRepository repository, int index) { try { //var queryModelId = Guid.NewGuid(); //var testQueryModel = new TestQueryModel(queryModelId, "Hello Integration Test!" + index); var testQueryModel = _fixture.Create <TestQueryModel>(); var queryModelId = testQueryModel.id; await repository.Save(testQueryModel); var hydratedQueryModel = await repository.GetById <TestQueryModel>(queryModelId); var existing = await repository.DoesItemExist <TestQueryModel>(queryModelId); if (!existing) { throw new Exception("DoesItemExist"); } var hydratedQueryModel1 = await repository.QueryItem <TestQueryModel>(x => x.id == queryModelId); Assert.IsTrue(existing); Assert.IsNotNull(hydratedQueryModel); Assert.AreEqual(queryModelId, hydratedQueryModel.id); Assert.AreEqual(queryModelId, hydratedQueryModel1.id); hydratedQueryModel.DummyPayload = "DummyPayload" + queryModelId; await repository.Save(hydratedQueryModel); await repository.DeleteById <TestQueryModel>(queryModelId); existing = await repository.DoesItemExist <TestQueryModel>(queryModelId); if (existing) { throw new Exception("DoesItemExist"); } } catch (TaskCanceledException ex) { System.Diagnostics.Debug.WriteLine(ex); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } }
public Task <T> QueryItem <T>(Expression <Func <T, bool> > predicate) where T : QueryModel { return(_repo.QueryItem <T>(predicate)); }