public void BuildSearchParametersRaisesArgumentNullExceptionForMissingSearchProperties()
        {
            // Arrange
            SearchProperties searchProperties = null;
            var azSearchQueryConverter        = new AzSearchQueryConverter();

            // Act
            var exceptionResult = Assert.Throws <ArgumentNullException>(() => azSearchQueryConverter.BuildSearchParameters(searchProperties));

            // assert
            Assert.Equal("Value cannot be null. (Parameter 'properties')", exceptionResult.Message);
        }
        public void BuildSearchParametersReturnsSearchParametersForSearchProperties()
        {
            // Arrange
            var searchProperties       = A.Fake <SearchProperties>();
            var azSearchQueryConverter = new AzSearchQueryConverter();

            // Act
            var results = azSearchQueryConverter.BuildSearchParameters(searchProperties);

            // Assert
            Assert.NotNull(results);
        }
        public void BuildSearchParametersTest()
        {
            var properties = new SearchProperties
            {
                Count            = 2,
                FilterBy         = "filterby",
                Page             = 3,
                SearchFields     = new[] { "Field1", "Field2" },
                UseRawSearchTerm = true
            };

            var queryConverter = new AzSearchQueryConverter();
            var result         = queryConverter.BuildSearchParameters(properties);

            result.SearchMode.Should().Be(SearchMode.Any);                        //SearchMode = SearchMode.Any
            result.IncludeTotalResultCount.Should().BeTrue();                     //IncludeTotalResultCount = true
            result.SearchFields.Should().BeEquivalentTo(properties.SearchFields); //SearchFields = properties.SearchFields,
            result.Filter.Should().Be(properties.FilterBy);                       //Filter = properties.FilterBy,
            result.Skip.Should().Be(4);                                           //Skip = (properties.Page - 1) * properties.Count,
            result.Top.Should().Be(2);                                            //Top = properties.Count,
            result.QueryType.Should().Be(QueryType.Full);                         //QueryType = QueryType.Full,
        }