public TopicContentfulFactoryTest()
 {
     _contentfulTopic         = new ContentfulTopicBuilder().Build();
     _crumbFactory            = new Mock <IContentfulFactory <ContentfulReference, Crumb> >();
     _subItemFactory          = new Mock <IContentfulFactory <ContentfulReference, SubItem> >();
     _alertFactory            = new Mock <IContentfulFactory <ContentfulAlert, Alert> >();
     _eventBannerFactory      = new Mock <IContentfulFactory <ContentfulEventBanner, EventBanner> >();
     _expandingLinkBoxFactory = new Mock <IContentfulFactory <ContentfulExpandingLinkBox, ExpandingLinkBox> >();
     _timeProvider.Setup(o => o.Now()).Returns(new DateTime(2017, 02, 02));
     _topicContentfulFactory = new TopicContentfulFactory(_subItemFactory.Object, _crumbFactory.Object, _alertFactory.Object, _eventBannerFactory.Object, _expandingLinkBoxFactory.Object, _timeProvider.Object);
 }
Exemplo n.º 2
0
        public void ShouldSetDefaultsOnModel()
        {
            var actual   = new ContentfulTopic();
            var expected = new ContentfulTopic
            {
                Slug            = string.Empty,
                Name            = string.Empty,
                Teaser          = string.Empty,
                Summary         = string.Empty,
                Icon            = string.Empty,
                BackgroundImage = new Asset {
                    File = new File {
                        Url = string.Empty
                    }, SystemProperties = new SystemProperties {
                        Type = "Asset"
                    }
                },
                Image = new Asset {
                    File = new File {
                        Url = string.Empty
                    }, SystemProperties = new SystemProperties {
                        Type = "Asset"
                    }
                },
                SubItems           = new List <ContentfulReference>(),
                SecondaryItems     = new List <ContentfulReference>(),
                TertiaryItems      = new List <ContentfulReference>(),
                Breadcrumbs        = new List <ContentfulReference>(),
                Alerts             = new List <ContentfulAlert>(),
                SunriseDate        = DateTime.MinValue.ToUniversalTime(),
                SunsetDate         = DateTime.MaxValue.ToUniversalTime(),
                EmailAlerts        = false,
                EmailAlertsTopicId = string.Empty
            };

            actual.Should().BeEquivalentTo(expected);
        }