Materialize() public method

Add to response fields that needs to read highlighted info.
public Materialize ( ElasticLinq.Response.Model.ElasticResponse response ) : object
response ElasticLinq.Response.Model.ElasticResponse ElasticResponse to obtain the existence of a result.
return object
コード例 #1
0
        public void HighlightMaterializerTests_Throws_If_Not_Chained()
        {
            var respomse = MaterializerTestHelper.CreateSampleResponse(1);
            var materializer = new HighlightElasticMaterializer(null);

            Assert.Throws<ArgumentNullException>(()=>materializer.Materialize(respomse));
        }
コード例 #2
0
        public void HighlightMaterializerTests_Must_recognize_Highlighted_Result()
        {
            var respomse = MaterializerTestHelper.CreateSampleResponseWithHighlight(1);
            var materializer = new HighlightElasticMaterializer(new ListHitsElasticMaterializer(DefaultBySourceItemCreator, typeof(SampleClassWithHighlight)));

            var result = materializer.Materialize(respomse);

            var actualList = Assert.IsType<List<SampleClassWithHighlight>>(result);
            var highlighted = actualList.First().SampleField_Highlight;
            Assert.NotNull(highlighted);
        }