Пример #1
0
        public void SearchByKeyword_ManufacturerContains_2Results()
        {
            _instrumentService = InstrumentServiceFactory.CreateForSearch(_instrumentRepository);
            _instrumentService.Create(Guid.NewGuid(), "Druck", "DPI601IS", "None", "Digital Pressure Indicator", 0);
            _instrumentService.Create(Guid.NewGuid(), "Druck", "DPI701IS", "None", "Digital Pressure Indicator", 0);
            _instrumentService.Create(Guid.NewGuid(), "Fluke", "FLK100", "None", "Digital Pressure Indicator", 0);

            var instruments = _instrumentService.SearchByKeyword("Dru");

            Assert.AreEqual(2, instruments.ToList().Count);
            _instrumentRepository.DeleteAll();
        }
Пример #2
0
        public void SearchByKeyword_ModelNoExactMatchCaseInsensitive_2Results()
        {
            _instrumentService = InstrumentServiceFactory.CreateForSearch(_instrumentRepository);
            _instrumentService.Create(Guid.NewGuid(), "Druck", "DPI601IS", "None", "Digital Pressure Indicator", 0);
            _instrumentService.Create(Guid.NewGuid(), "Druck", "DPI701IS", "None", "Digital Pressure Indicator", 0);
            _instrumentService.Create(Guid.NewGuid(), "Fluke", "FLK100", "None", "Digital Pressure Indicator", 0);

            var instruments = _instrumentService.SearchByKeyword("dpi601IS");

            Assert.AreEqual(1, instruments.ToList().Count);
            _instrumentRepository.DeleteAll();
        }
Пример #3
0
        public ActionResult SearchInstruments(string query)
        {
            IEnumerable <Instrument> instruments = _instrumentService.SearchByKeyword(query);

            return(Json(instruments));
        }