Exemple #1
0
        public void ShouldReturnAFooter()
        {
            var mockFooter = new Footer("Title", "a-slug", new List <SubItem>(), new List <SocialMediaLink>());

            var footerCollection = new ContentfulCollection <ContentfulFooter>();

            footerCollection.Items = new List <ContentfulFooter>
            {
                new ContentfulFooterBuilder().Build()
            };

            _client.Setup(o => o.GetEntries(
                              It.Is <QueryBuilder <ContentfulFooter> >(q => q.Build() == new QueryBuilder <ContentfulFooter>().ContentTypeIs("footer").Include(1).Build()),
                              It.IsAny <CancellationToken>())).ReturnsAsync(footerCollection);

            _contentfulFactory.Setup(o => o.ToModel(It.IsAny <ContentfulFooter>()))
            .Returns(new Footer("Title", "a-slug", new List <SubItem>(),
                                new List <SocialMediaLink>()));
            var footer = AsyncTestHelper.Resolve(_repository.GetFooter());

            footer.Get <Footer>().Title.Should().Be(mockFooter.Title);
            footer.Get <Footer>().Slug.Should().Be(mockFooter.Slug);
            footer.StatusCode.Should().Be(HttpStatusCode.OK);
        }