public void ShouldCreateADocumentFromAContentfulDocument()
        {
            var contentfulDocument = new ContentfulDocumentBuilder().Build();

            var document = new DocumentContentfulFactory().ToModel(contentfulDocument);

            document.FileName.Should().Be(contentfulDocument.File.FileName);
            document.Title.Should().Be(contentfulDocument.Description);
            document.LastUpdated.Should().Be(contentfulDocument.SystemProperties.UpdatedAt.Value);
            document.Size.Should().Be((int)contentfulDocument.File.Details.Size);
            document.Url.Should().Be(contentfulDocument.File.Url);
        }
        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);
        }