public void SearchPropertyNameUtility_OrderBy()
        {
            ISearchParametersBuilder <Model> searchParametersBuilder = SearchParametersBuilder <Model> .Create();

            Assert.IsNull(searchParametersBuilder.OrderBy);

            searchParametersBuilder.WithOrderBy(_ => Constants.SearchScore).WithThenByDescending(_ => Constants.SearchScore);

            Assert.IsNotNull(searchParametersBuilder.OrderBy);
            Assert.AreEqual(2, searchParametersBuilder.OrderBy.Count());
            Assert.AreEqual("search.score() asc", searchParametersBuilder.OrderBy.ElementAtOrDefault(0));
            Assert.AreEqual("search.score() desc", searchParametersBuilder.OrderBy.ElementAtOrDefault(1));

            SearchParameters parameters = searchParametersBuilder.Build();

            Assert.IsNotNull(parameters);
            Assert.IsNotNull(parameters.OrderBy);
            Assert.AreEqual(2, parameters.OrderBy.Count());
            Assert.AreEqual("search.score() asc", parameters.OrderBy.ElementAtOrDefault(0));
            Assert.AreEqual("search.score() desc", parameters.OrderBy.ElementAtOrDefault(1));

            searchParametersBuilder.WithOrderByDescending(_ => Constants.SearchScore).WithThenBy(_ => Constants.SearchScore);

            Assert.IsNotNull(searchParametersBuilder.OrderBy);
            Assert.AreEqual(2, searchParametersBuilder.OrderBy.Count());
            Assert.AreEqual("search.score() desc", searchParametersBuilder.OrderBy.ElementAtOrDefault(0));
            Assert.AreEqual("search.score() asc", searchParametersBuilder.OrderBy.ElementAtOrDefault(1));

            parameters = searchParametersBuilder.Build();
            Assert.IsNotNull(parameters);
            Assert.IsNotNull(parameters.OrderBy);
            Assert.AreEqual(2, parameters.OrderBy.Count());
            Assert.AreEqual("search.score() desc", parameters.OrderBy.ElementAtOrDefault(0));
            Assert.AreEqual("search.score() asc", parameters.OrderBy.ElementAtOrDefault(1));
        }
        public void SearchPropertyNameUtility_IncludeTotalResultCount()
        {
            ISearchParametersBuilder <Model> searchParametersBuilder = SearchParametersBuilder <Model> .Create();

            Assert.IsFalse(searchParametersBuilder.IncludeTotalResultCount);

            searchParametersBuilder.WithIncludeTotalResultCount(true);

            Assert.IsTrue(searchParametersBuilder.IncludeTotalResultCount);

            SearchParameters parameters = searchParametersBuilder.Build();

            Assert.IsNotNull(parameters);
            Assert.IsTrue(parameters.IncludeTotalResultCount);
        }
        public void SearchPropertyNameUtility_SearchMode()
        {
            ISearchParametersBuilder <Model> searchParametersBuilder = SearchParametersBuilder <Model> .Create();

            Assert.AreEqual(SearchMode.Any, searchParametersBuilder.SearchMode);

            searchParametersBuilder.WithSearchMode(SearchMode.All);

            Assert.AreEqual(SearchMode.All, searchParametersBuilder.SearchMode);

            SearchParameters parameters = searchParametersBuilder.Build();

            Assert.IsNotNull(parameters);
            Assert.AreEqual(SearchMode.All, parameters.SearchMode);
        }
        public void SearchPropertyNameUtility_Skip()
        {
            ISearchParametersBuilder <Model> searchParametersBuilder = SearchParametersBuilder <Model> .Create();

            Assert.IsNull(searchParametersBuilder.Skip);

            searchParametersBuilder.WithSkip(1);

            Assert.IsNotNull(searchParametersBuilder.Skip);
            Assert.AreEqual(1, searchParametersBuilder.Skip);

            SearchParameters parameters = searchParametersBuilder.Build();

            Assert.IsNotNull(parameters);
            Assert.AreEqual(1, parameters.Skip);
        }
        public void SearchPropertyNameUtility_ScoringProfile()
        {
            ISearchParametersBuilder <Model> searchParametersBuilder = SearchParametersBuilder <Model> .Create();

            Assert.IsNull(searchParametersBuilder.ScoringProfile);

            searchParametersBuilder.WithScoringProfile("test");

            Assert.IsNotNull(searchParametersBuilder.ScoringProfile);
            Assert.AreEqual("test", searchParametersBuilder.ScoringProfile);

            SearchParameters parameters = searchParametersBuilder.Build();

            Assert.IsNotNull(parameters);
            Assert.AreEqual("test", parameters.ScoringProfile);
        }
        public void SearchPropertyNameUtility_ScoringParameters()
        {
            ISearchParametersBuilder <Model> searchParametersBuilder = SearchParametersBuilder <Model> .Create();

            Assert.IsNull(searchParametersBuilder.ScoringParameters);

            searchParametersBuilder.WithScoringParameter(new ScoringParameter("foo", Enumerable.Empty <string>()));

            Assert.IsNotNull(searchParametersBuilder.ScoringParameters);
            Assert.AreEqual(1, searchParametersBuilder.ScoringParameters.Count());

            SearchParameters parameters = searchParametersBuilder.Build();

            Assert.IsNotNull(parameters);
            Assert.IsNotNull(parameters.ScoringParameters);
            Assert.AreEqual(1, parameters.ScoringParameters.Count());
        }
        public void SearchPropertyNameUtility_HighlightFields()
        {
            ISearchParametersBuilder <Model> searchParametersBuilder = SearchParametersBuilder <Model> .Create();

            Assert.IsNull(searchParametersBuilder.HighlightFields);

            searchParametersBuilder.WithHighlightField(_ => Constants.SearchScore);

            Assert.IsNotNull(searchParametersBuilder.HighlightFields);
            Assert.AreEqual(1, searchParametersBuilder.HighlightFields.Count());
            Assert.AreEqual("search.score()", searchParametersBuilder.HighlightFields.ElementAtOrDefault(0));

            SearchParameters parameters = searchParametersBuilder.Build();

            Assert.IsNotNull(parameters);
            Assert.IsNotNull(parameters.HighlightFields);
            Assert.AreEqual(1, parameters.HighlightFields.Count());
            Assert.AreEqual("search.score()", parameters.HighlightFields.ElementAtOrDefault(0));
        }