public void FieldsParameter002() { // Arrange var expected = JObject.Parse(@" { ""fields"": [ ""_id_"", ""_score_"" ] }"); string actual; var jObject = new JObject(); var expressionCache = new ExpressionCache <TestDocument>(); var expressionBuilder = (IExpressionBuilder <TestDocument>) new ExpressionBuilder <TestDocument>(expressionCache); var parameter = new FieldsParameter <TestDocument>(expressionBuilder); parameter.Configure(q => q.Id, q => q.Score); // Act parameter.Execute(jObject); actual = jObject.ToString(); // Assert Assert.Equal(expected.ToString(), actual); }
public void FieldsParameter001() { // Arrange var container = new List <string>(); var solrOptions = new SolrExpressOptions(); var solrConnection = new FakeSolrConnection <TestDocument>(); var expressionBuilder = new ExpressionBuilder <TestDocument>(solrOptions, solrConnection); expressionBuilder.LoadDocument(); var parameter = new FieldsParameter <TestDocument>(expressionBuilder); parameter.FieldExpressions = new Expression <Func <TestDocument, object> >[] { q => q.Id, q => q.Score }; // Act parameter.Execute(); parameter.AddResultInContainer(container); // Assert Assert.Single(container); Assert.Equal("fl=id,score", container[0]); }