public static ICatalogEntryProvider Create(bool incremental, int catalogId, ESalesVariantHelper eSalesVariantHelper, ICatalogSystemMapper catalogSystemMapper,
                                                   IIndexSystemMapper indexSystemMapper)

        {
            if (incremental)
            {
                return(new IncrementalCatalogEntryProvider(catalogId, eSalesVariantHelper, catalogSystemMapper, indexSystemMapper));
            }
            return(new FullCatalogEntryProvider(catalogId, catalogSystemMapper));
        }
        public void FindNoParentProduct()
        {
            var relations = new CatalogRelationDto();

            relations.CatalogEntryRelation.AddCatalogEntryRelationRow(1, 10, "", 0, "", 0);
            relations.CatalogEntryRelation.AddCatalogEntryRelationRow(1, 11, "", 0, "", 0);
            relations.CatalogEntryRelation.AddCatalogEntryRelationRow(2, 12, "", 0, "", 0);
            var helper = new ESalesVariantHelper(relations.CatalogEntryRelation);

            Assert.Throws <KeyNotFoundException>(() => helper.GetParentProduct(13));
        }
        public void FindParentProduct()
        {
            var relations = new CatalogRelationDto();

            relations.CatalogEntryRelation.AddCatalogEntryRelationRow(1, 10, "", 0, "", 0);
            relations.CatalogEntryRelation.AddCatalogEntryRelationRow(1, 11, "", 0, "", 0);
            relations.CatalogEntryRelation.AddCatalogEntryRelationRow(2, 12, "", 0, "", 0);
            var helper = new ESalesVariantHelper(relations.CatalogEntryRelation);

            Assert.That(helper.GetParentProduct(12), Is.EqualTo(2));
        }
        public void FindNoVariants()
        {
            var relations = new CatalogRelationDto();

            relations.CatalogEntryRelation.AddCatalogEntryRelationRow(1, 10, "", 0, "", 0);
            relations.CatalogEntryRelation.AddCatalogEntryRelationRow(1, 11, "", 0, "", 0);
            relations.CatalogEntryRelation.AddCatalogEntryRelationRow(2, 12, "", 0, "", 0);
            var helper = new ESalesVariantHelper(relations.CatalogEntryRelation);

            Assert.That(!helper.GetVariants(3).Any());
        }
        public void FindVariants()
        {
            var relations = new CatalogRelationDto();

            relations.CatalogEntryRelation.AddCatalogEntryRelationRow(1, 10, "", 0, "", 0);
            relations.CatalogEntryRelation.AddCatalogEntryRelationRow(1, 11, "", 0, "", 0);
            relations.CatalogEntryRelation.AddCatalogEntryRelationRow(2, 12, "", 0, "", 0);
            var helper = new ESalesVariantHelper(relations.CatalogEntryRelation);

            Assert.That(helper.GetVariants(1).ToArray(), Is.EquivalentTo(new[] { 10, 11 }));
        }
Exemple #6
0
        internal IncrementalCatalogEntryProvider(int catalogId, ESalesVariantHelper eSalesVariantHelper, ICatalogSystemMapper catalogSystemMapper,
                                                 IIndexSystemMapper indexSystemMapper)
        {
            _eSalesVariantHelper = eSalesVariantHelper;
            _catalogSystemMapper = catalogSystemMapper;

            var searchSetId = Guid.NewGuid();

            _catalogSystemMapper.StartFindItemsForIndexing(searchSetId, catalogId, true, indexSystemMapper.LastBuildDate.ToUniversalTime(),
                                                           indexSystemMapper.CurrentBuildDate);
            var entryTable      = _catalogSystemMapper.ContinueFindItemsForIndexing(searchSetId, 1, int.MaxValue - 1);
            var originalEntries = entryTable.Rows.Cast <CatalogEntryDto.CatalogEntryRow>().ToDictionary(e => e.CatalogEntryId, e => e);

            _allEntries = AppendMissingVariants(originalEntries).ToArray();
        }