Example #1
0
        public async Task Save(IndexValue indexValue)
        {
            var result = _indexMapper.MapEntry(indexValue);

            foreach (var doc in result)
            {
                await SaveAsync(doc).ConfigureAwait(false);
            }
        }
Example #2
0
        public void Save(IndexValue indexValue)
        {
            var result = _indexMapper.MapEntry(indexValue);

            foreach (var doc in result)
            {
                Save(doc);
            }
        }
Example #3
0
        public void TestMapRootIndexValue()
        {
            //"root" element should be skipped.
            IndexValue iv = new IndexValue("root");

            iv.Values.Add(new IndexValue("internal_resource", new StringValue("Patient")));

            var results = sut.MapEntry(iv);

            Assert.Single(results);
            var result = results[0];

            Assert.True(result.IsBsonDocument);
            Assert.Equal(2, result.AsBsonDocument.ElementCount);
            var firstElement = result.AsBsonDocument.GetElement(0);

            Assert.Equal("internal_level", firstElement.Name);
            var secondElement = result.GetElement(1);

            Assert.Equal("internal_resource", secondElement.Name);
            Assert.True(secondElement.Value.IsString);
            Assert.Equal("Patient", secondElement.Value.AsString);
        }