public SuggestionsController(ISuggestionSearcher searcher)
 {
     _searcher = searcher;
 }
 public RefreshController(ISuggestionSearcher searcher, IConstants constants)
 {
     _searcher = searcher;
     _constants = constants;
 }
        public void Initialize()
        {
            // Fake category data
            //
            // Gamma-ray gun | Space weapons
            // X-ray gun 12' | Laser weapons | Earth weapons
            // X-ray gun 15' | Laser weapons | Earth weapons
            IEnumerable<CategorySuggestion> fakeDbCategorySuggestions = new List<CategorySuggestion>
                {
                    new CategorySuggestion("Gamma-ray gun",200,"Space weapons",20),
                    new CategorySuggestion("X-ray gun 15'",101,"Laser weapons",10),
                    new CategorySuggestion("X-ray gun 12'",100,"Laser weapons",10),
                    new CategorySuggestion("Space weapons",20,"",0),
                    new CategorySuggestion("Laser weapons",10,"Earth weapons" ,2),
                    new CategorySuggestion("Earth weapons",10,"",0)
                };

            var categoryRepository = Substitute.For<ICategoryRepository>();
            categoryRepository.GetAllSuggestions().ReturnsForAnyArgs(fakeDbCategorySuggestions);

            // ------------

            IEnumerable<ProductSuggestion> fakeDbProductSuggestions = new List<ProductSuggestion>
                {
                    new ProductSuggestion("Xray8944",1),
                    new ProductSuggestion("Bray8946wk",2)
                };

            var productRepository = Substitute.For<IProductRepository>();
            productRepository.GetAllSuggestions().ReturnsForAnyArgs(fakeDbProductSuggestions);

            // ------------

            var httpContext = Substitute.For<HttpContextBase>();
            httpContext.Cache.Returns(HttpRuntime.Cache);

            // ------------

            _searcher = new SuggestionSearcher(categoryRepository, productRepository);
            _searcher.LoadSuggestionsStore(LucenePath, true);
        }
Beispiel #4
0
 public RouteSearcherController(IHereService hereService, IRouteSearcher routeSearcher, ISuggestionSearcher suggestionSearcher)
 {
     _hereService        = hereService;
     _routeSearcher      = routeSearcher;
     _suggestionSearcher = suggestionSearcher;
 }