public void Setup()
        {
            var dependencies = Substitute.For <NlmExportService.IDependencies>();
            var mockLogger   = Substitute.For <ILog>();

            _mockService       = Substitute.For <ISitecoreService>();
            _mockReferences    = Substitute.For <IItemReferences>();
            _mockSearchService = Substitute.For <IArticleSearchService>();

            // May as well use real dependencies for testing; more of a system test
            var builder = new ContainerBuilder();

            builder.RegisterModule(new AutomapperModule("Informa.Library"));
            builder.Register(c => _mockService).As <ISitecoreService>();
            builder.Register(c => _mockReferences).As <IItemReferences>();
            builder.Register(c => _mockSearchService).As <IArticleSearchService>();
            var container = builder.Build();

            AutofacConfig.ServiceLocator = container;

            dependencies.Mapper.Returns(c => container.Resolve <IMapper>());
            dependencies.Serializer.Returns(c => new NlmSerializer());

            _exportService = new NlmExportService(dependencies, mockLogger);
        }
Example #2
0
 public ExecutiveSummaryViewModel(
     ITextTranslator textTranslator,
     IAccountManagementService accountService,
     IItemReferences itemReferences)
 {
     TextTranslator = textTranslator;
     AccountService = accountService;
     ItemReferences = itemReferences;
 }
 public void SetUp()
 {
     AuthUserContext          = Substitute.For <IAuthenticatedUserContext>();
     ItemReferences           = Substitute.For <IItemReferences>();
     EntitlementsContext      = Substitute.For <IUserEntitlementsContext>();
     SiteRoots                = Substitute.For <ISiteRootsContext>();
     AccountManagementService = new AccountManagementService(AuthUserContext, ItemReferences, EntitlementsContext, SiteRoots);
     GeneralPage              = Substitute.For <IGeneral_Content_Page>();
 }
Example #4
0
 public AccountManagementService(
     IAuthenticatedUserContext authenticatedUserContext,
     IItemReferences itemReferences,
     IUserEntitlementsContext userEntitlementsContext,
     ISiteRootsContext siteRootsContext)
 {
     AuthenticatedUserContext = authenticatedUserContext;
     ItemReferences           = itemReferences;
     UserEntitlementsContext  = userEntitlementsContext;
     SiteRootsContext         = siteRootsContext;
 }
 public GlobalService(
     ISitecoreService sitecoreService,
     ICacheProvider cacheProvider,
     IItemReferences itemReferences,
     ISiteRootContext siteRootContext
     )
 {
     SitecoreService = sitecoreService;
     CacheProvider   = cacheProvider;
     ItemReferences  = itemReferences;
     SiteRootContext = siteRootContext;
 }
Example #6
0
 public IssueNumberResolver(IItemReferences itemReferences, ISitecoreService service)
 {
     if (itemReferences == null)
     {
         throw new ArgumentNullException(nameof(itemReferences));
     }
     if (service == null)
     {
         throw new ArgumentNullException(nameof(service));
     }
     _itemReferences = itemReferences;
     _service        = service;
 }
Example #7
0
 public ArticlePermissionsResolver(ISitecoreService service, IItemReferences itemReferences)
 {
     if (service == null)
     {
         throw new ArgumentNullException(nameof(service));
     }
     if (itemReferences == null)
     {
         throw new ArgumentNullException(nameof(itemReferences));
     }
     _service        = service;
     _itemReferences = itemReferences;
 }
Example #8
0
 public ArticleSearch(
     IProviderSearchContextFactory searchContextFactory,
     IGlobalSitecoreService globalService,
     Func <string, ISitecoreService> sitecoreFactory,
     IItemReferences itemReferences,
     ICacheProvider cacheProvider
     )
 {
     SearchContextFactory = searchContextFactory;
     GlobalService        = globalService;
     SitecoreFactory      = sitecoreFactory;
     ItemReferences       = itemReferences;
     CacheProvider        = cacheProvider;
 }
Example #9
0
 public AnalyticsViewModel(
     IItemReferences itemReferences,
     IIsEntitledProducItemContext isEntitledProductItemContext,
     IArticleSearch articleSearch,
     ISiteSettings siteSettings,
     IAuthenticatedUserContext authenticatedUserContext,
     IUserCompanyContext userCompanyContext,
     IUserProfileContext userProfileContext,
     IUserSubscriptionsContext userSubscriptionsContext,
     IWebAuthenticateUser webAuthenticateUser,
     IUserEntitlementsContext userEntitlementsContext,
     IUserIpAddressContext userIpAddressContext,
     ISiteRootContext siteRootContext,
     IHttpContextProvider httpContextProvider,
     IDCDReader dcdReader,
     ITaxonomyService taxonomyService, IGlobalSitecoreService globalService, IRecaptchaService recaptchaSettings)
 {
     ItemReferences = itemReferences;
     IsEntitledProductItemContext = isEntitledProductItemContext;
     ArticleSearch            = articleSearch;
     SiteSettings             = siteSettings;
     AuthenticatedUserContext = authenticatedUserContext;
     UserCompanyContext       = userCompanyContext;
     UserProfileContext       = userProfileContext;
     UserSubscriptionsContext = userSubscriptionsContext;
     WebAuthenticateUser      = webAuthenticateUser;
     UserEntitlementsContext  = userEntitlementsContext;
     UserIpAddressContext     = userIpAddressContext;
     SiteRootContext          = siteRootContext;
     HttpContextProvider      = httpContextProvider;
     DcdReader              = dcdReader;
     EntitlementType        = GetEntitlementType(UserCompanyContext);
     UserEntitlements       = GetUserEntitlements();
     SubscribedProducts     = GetSubscribedProducts();
     OpportunityLineItemIds = GetOpportunityLineItemIds();
     OpportunityIds         = GetOpportunityIds();
     TaxonomyService        = taxonomyService;
     GlobalService          = globalService;
     RecaptchaSettings      = recaptchaSettings;
 }
        public SyndicationFeed GetRssFeed(I_Base_Rss_Feed rssFeed, ISitecoreContext sitecoreContext, IItemReferences itemReferences)
        {
            var feed = new SyndicationFeed();

            feed.AttributeExtensions.Add(new XmlQualifiedName("atom", XNamespace.Xmlns.NamespaceName),
                                         RssConstants.AtomNamespace.ToString());

            feed.AttributeExtensions.Add(new XmlQualifiedName(RssConstants.InformaNamespace.ToString(), XNamespace.Xmlns.NamespaceName),
                                         RssConstants.InformaNamespaceUrl.ToString());

            feed.Title       = new TextSyndicationContent(rssFeed.Title);
            feed.Language    = rssFeed.Language;
            feed.Description = new TextSyndicationContent(rssFeed.Description);

            feed = AddCopyrightTextToFeed(feed, sitecoreContext, Constants.ScripRootNode, rssFeed);
            feed = AddFeedLinksToFeed(feed, rssFeed);
            feed = AddWebMasterToFeed(feed, rssFeed);

            return(feed);
        }
Example #11
0
        public new SyndicationFeed GetRssFeed(I_Base_Rss_Feed rssFeed, ISitecoreContext sitecoreContext, IItemReferences itemReferences)
        {
            SyndicationFeed feed = base.GetRssFeed(rssFeed, sitecoreContext, itemReferences);

            feed = AddFeedLinksToFeed(feed, rssFeed);

            feed.Title = new TextSyndicationContent(GetSearchFeedTitle());

            return(feed);
        }
 public GenerateIfDictionaryKeyNotFound(Func <string, ISitecoreService> sitecoreFactory, IItemReferences itemReferences)
 {
     SitecoreService = sitecoreFactory(Constants.MasterDb);
     ItemReferences  = itemReferences;
 }
Example #13
0
        public static IQueryable <T> FilterTaxonomies <T>(this IQueryable <T> source, ITaxonomySearchFilter filter, IItemReferences refs, IGlobalSitecoreService service)
            where T : ITaxonomySearchResults
        {
            if (source == null || filter == null || !filter.TaxonomyIds.Any())
            {
                return(source);
            }

            var taxItems = filter.TaxonomyIds.Select(a => service.GetItem <ITaxonomy_Item>(a));

            if (taxItems == null || !taxItems.Any())
            {
                return(source);
            }

            //breaking up the taxonomies by their respective folder to 'or' any within a folder and 'and' the folders together
            List <Guid> taxGuids = new List <Guid>()
            {
                refs.RegionsTaxonomyFolder,
                refs.SubjectsTaxonomyFolder,
                refs.TherapyAreasTaxonomyFolder,
                refs.DeviceAreasTaxonomyFolder,
                refs.IndustriesTaxonomyFolder
            };

            var predicate = PredicateBuilder.True <T>();

            taxGuids
            .Select(g => GetPredicate <T>(service, taxItems, g))
            .Where(p => p != null)
            .ToList()
            .ForEach(i => predicate = predicate.And(i));

            return(source.Filter(predicate));
        }