public void Can_find_items_azuresearch()
        {
            var scope = "default";
            var queryBuilder = new AzureSearchQueryBuilder();
            var conn = new SearchConnection(Datasource, scope, accessKey: AccessKey);
            var provider = new AzureSearchProvider(queryBuilder, conn);

            var criteria = new CatalogItemSearchCriteria
                           {
                               SearchPhrase = "sony",
                               IsFuzzySearch = true,
                               Catalog = "vendorvirtual",
                               RecordsToRetrieve = 10,
                               StartingRecord = 0,
                               Pricelists = new string[] { },
                               StartDate = DateTime.UtcNow,
                               Sort = new SearchSort("price_usd_saleusd")
                           };

            criteria.Outlines.Add("vendorvirtual*");

            //"(startdate lt 2014-09-26T22:05:11Z) and sys__hidden eq 'false' and sys__outline/any(t:t eq 'VendorVirtual/e1b56012-d877-4bdd-92d8-3fc186899d0f*') and catalog/any(t: t eq 'VendorVirtual')"
            var results = provider.Search(scope, criteria);
        }
        public void Can_find_item_azuresearch()
        {
            var scope = "test";
            var queryBuilder = new AzureSearchQueryBuilder();
            var conn = new SearchConnection(Datasource, scope, accessKey: AccessKey);
            var provider = new AzureSearchProvider(queryBuilder, conn);

            provider.RemoveAll(scope, String.Empty);
            SearchHelper.CreateSampleIndex(provider, scope);

            var criteria = new CatalogItemSearchCriteria
            {
                SearchPhrase = "product",
                IsFuzzySearch = true,
                Catalog = "goods",
                RecordsToRetrieve = 10,
                StartingRecord = 0,
                Pricelists = new string[] { }
            };


            // force delay, otherwise records are not available
            Thread.Sleep(1000); 

            var results = provider.Search(scope, criteria);
            
            Assert.True(results.DocCount == 1, String.Format("Returns {0} instead of 1", results.DocCount));

            criteria = new CatalogItemSearchCriteria
            {
                SearchPhrase = "sample product ",
                IsFuzzySearch = true,
                Catalog = "goods",
                RecordsToRetrieve = 10,
                StartingRecord = 0,
                Pricelists = new string[] { }
            };


            results = provider.Search(scope, criteria);

            Assert.True(results.DocCount == 1, String.Format("\"Sample Product\" search returns {0} instead of 1", results.DocCount));

            provider.RemoveAll(scope, String.Empty);
        }