示例#1
0
        public async Task CanQueryByParent()
        {
            var parent = ParentGenerator.Default;

            parent = await _parentRepository.AddAsync(parent);

            Assert.NotNull(parent?.Id);

            await _parentRepository.AddAsync(ParentGenerator.Generate());

            var child = ChildGenerator.Default;

            child = await _childRepository.AddAsync(child, o => o.ImmediateConsistency());

            Assert.NotNull(child?.Id);

            var childResults = await _childRepository.QueryAsync(q => q.ParentQuery(p => p.Id(parent.Id)));

            Assert.Equal(1, childResults.Total);
        }
        public async Task CanQueryByParent()
        {
            var parent = ParentGenerator.Default;

            parent = await _parentRepository.AddAsync(parent);

            Assert.NotNull(parent?.Id);

            await _parentRepository.AddAsync(ParentGenerator.Generate());

            var child = ChildGenerator.Default;

            child = await _childRepository.AddAsync(child);

            Assert.NotNull(child?.Id);

            await _client.RefreshAsync();

            var childResults = await _childRepository.QueryAsync(new MyAppQuery().WithParentQuery(q => q.WithId(parent.Id)));

            Assert.Equal(1, childResults.Total);
        }