Ejemplo n.º 1
0
        public ActionResult GetAllSpecs()
        {
            var activeParserCategoriesIdList = _yandexMarketCategoryService.GetActive().Select(x => x.Id);
            //var newSpecsOnly = _GetNewSpecs(activeParserCategoriesIdList);

            var mapper = new YandexMarketSpecMapper(_yandexMarketSpecService, EngineContext.Current.Resolve <ISpecificationAttributeService>());

            var allSpecs = mapper.GetSumOfYandexSpecsAndShopSpecs(activeParserCategoriesIdList);

            var resultNewSpecsOnly = new List <SpecificationAttribute>();

            foreach (SpecificationAttribute y in allSpecs)
            {
                if (y.SpecificationAttributeOptions.Any(r => r.DisplayOrder == 777))
                {
                    resultNewSpecsOnly.Add(y);
                }
            }


            foreach (var specificationAttribute in resultNewSpecsOnly)
            {
                specificationAttribute.Order();
            }

            return(Json(resultNewSpecsOnly));
        }
Ejemplo n.º 2
0
        private List <SpecificationAttribute> _GetNewSpecs(IEnumerable <int> parserCategoryIdList)
        {
            var mapper = new YandexMarketSpecMapper(_yandexMarketSpecService, EngineContext.Current.Resolve <ISpecificationAttributeService>());

            var allSpecs     = mapper.GetSumOfYandexSpecsAndShopSpecs(parserCategoryIdList);
            var newSpecsOnly = mapper.GetNewYandexSpecsOnly(allSpecs);

            return(newSpecsOnly);
        }
Ejemplo n.º 3
0
        public void Init()
        {
            var yandexMarketSpecServiceMoq = new Mock <IYandexMarketSpecService>();
            var shopSpecServiceMoq         = new Mock <ISpecificationAttributeService>();

            // set fake return value
            yandexMarketSpecServiceMoq.Setup(
                foo =>
                foo.GetByCategory(
                    It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>()))                  // input params
            .Returns(() => (YaSpecTestData()));

            shopSpecServiceMoq.Setup(
                foo =>
                foo.GetSpecificationAttributes())                 // input params
            .Returns(() => (ShopSpecTestData()));

            _mapperUnderTest = new YandexMarketSpecMapper(yandexMarketSpecServiceMoq.Object, shopSpecServiceMoq.Object);
        }