public ArticleRepositoryTest() { var config = new ContentfulConfig("test") .Add("DELIVERY_URL", "https://fake.url") .Add("TEST_SPACE", "SPACE") .Add("TEST_ACCESS_KEY", "KEY") .Add("TEST_MANAGEMENT_KEY", "KEY") .Build(); var documentFactory = new DocumentContentfulFactory(); _videoRepository = new Mock <IVideoRepository>(); _videoRepository.Setup(o => o.Process(It.IsAny <string>())).Returns(string.Empty); _mockTimeProvider = new Mock <ITimeProvider>(); _sectionFactory = new Mock <IContentfulFactory <ContentfulSection, Section> >(); _crumbFactory = new Mock <IContentfulFactory <ContentfulReference, Crumb> >(); _profileFactory = new Mock <IContentfulFactory <ContentfulProfile, Profile> >(); _parentTopicFactory = new Mock <IContentfulFactory <ContentfulArticle, Topic> >(); _alertFactory = new Mock <IContentfulFactory <ContentfulAlert, Alert> >(); _cache = new Mock <ICache>(); var contentfulFactory = new ArticleContentfulFactory( _sectionFactory.Object, _crumbFactory.Object, _profileFactory.Object, _parentTopicFactory.Object, documentFactory, _videoRepository.Object, _mockTimeProvider.Object, _alertFactory.Object ); var contentfulClientManager = new Mock <IContentfulClientManager>(); _contentfulClient = new Mock <IContentfulClient>(); contentfulClientManager.Setup(o => o.GetClient(config)).Returns(_contentfulClient.Object); _configuration = new Mock <IConfiguration>(); _configuration.Setup(_ => _["redisExpiryTimes:Articles"]).Returns("60"); _repository = new ArticleRepository(config, contentfulClientManager.Object, _mockTimeProvider.Object, contentfulFactory, new ArticleSiteMapContentfulFactory(), _videoRepository.Object, _cache.Object, _configuration.Object); }
public ArticleContentfulFactoryTest() { _contentfulArticle = new ContentfulArticleBuilder().Build(); // set to topic for mocking // TODO: Refactor into builder _contentfulArticle.Breadcrumbs[0].Sys.ContentType.SystemProperties.Id = "topic"; _videoRepository = new Mock <IVideoRepository>(); _sectionFactory = new Mock <IContentfulFactory <ContentfulSection, Section> >(); _crumbFactory = new Mock <IContentfulFactory <ContentfulReference, Crumb> >(); _profileFactory = new Mock <IContentfulFactory <ContentfulProfile, Profile> >(); _documentFactory = new Mock <IContentfulFactory <Asset, Document> >(); _parentTopicFactory = new Mock <IContentfulFactory <ContentfulArticle, Topic> >(); _alertFactory = new Mock <IContentfulFactory <ContentfulAlert, Alert> >(); _timeProvider = new Mock <ITimeProvider>(); _timeProvider.Setup(o => o.Now()).Returns(new DateTime(2017, 01, 01)); _articleFactory = new ArticleContentfulFactory(_sectionFactory.Object, _crumbFactory.Object, _profileFactory.Object, _parentTopicFactory.Object, _documentFactory.Object, _videoRepository.Object, _timeProvider.Object, _alertFactory.Object); }