コード例 #1
0
        public void ShouldSetDefaultsOnModel()
        {
            var actual   = new ContentfulArticle();
            var expected = new ContentfulArticle
            {
                Body            = string.Empty,
                Slug            = string.Empty,
                Title           = string.Empty,
                Teaser          = string.Empty,
                MetaDescription = string.Empty,
                Icon            = string.Empty,
                BackgroundImage = new Asset {
                    File = new File {
                        Url = string.Empty
                    }, SystemProperties = new SystemProperties {
                        Type = "Asset"
                    }
                },
                Sections    = new List <ContentfulSection>(),
                Breadcrumbs = new List <ContentfulReference>(),
                Alerts      = new List <ContentfulAlert>(),
                Profiles    = new List <ContentfulProfile>(),
                Documents   = new List <Asset>(),
                SunriseDate = DateTime.MinValue.ToUniversalTime(),
                SunsetDate  = DateTime.MaxValue.ToUniversalTime()
            };

            actual.Should().BeEquivalentTo(expected);
        }
コード例 #2
0
        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);
        }