public async Task CanQueryByChild() { var parent = ParentGenerator.Default; parent = await _parentRepository.AddAsync(parent); Assert.NotNull(parent?.Id); var child = ChildGenerator.Default; child = await _childRepository.AddAsync(child); Assert.NotNull(child?.Id); await _childRepository.AddAsync(ChildGenerator.Generate(parentId: parent.Id)); await _client.RefreshAsync(); Assert.Equal(2, await _childRepository.CountAsync()); await _client.RefreshAsync(); var parentResults = await _parentRepository.QueryAsync(new MyAppQuery().WithChildQuery(q => q.WithType("child").WithFilter("id:" + child.Id))); Assert.Equal(1, parentResults.Total); }
public async Task CanQueryByChild() { var parent = ParentGenerator.Default; parent = await _parentRepository.AddAsync(parent, o => o.ImmediateConsistency()); Assert.NotNull(parent?.Id); var child = ChildGenerator.Default; child = await _childRepository.AddAsync(child, o => o.ImmediateConsistency()); Assert.NotNull(child?.Id); await _childRepository.AddAsync(ChildGenerator.Generate(parentId: parent.Id), o => o.ImmediateConsistency()); Assert.Equal(2, await _childRepository.CountAsync()); var parentResults = await _parentRepository.QueryAsync(q => q.ChildQuery(typeof(Child), c => c.FilterExpression("id:" + child.Id))); Assert.Equal(1, parentResults.Total); }