public void ToModel_ShouldConvertContentfulPrivacyNoticeToPrivacyNotice()
        {
            // Arrange
            var contentfulPrivacyNotice = new ContentfulPrivacyNotice
            {
                Slug              = "test-slug",
                Title             = "test-title",
                Category          = "test-category",
                Purpose           = "test-purpose",
                TypeOfData        = "test-type-of-data",
                Legislation       = "test-legislation",
                Obtained          = "test-obtained",
                ExternallyShared  = "test-externally-shared",
                RetentionPeriod   = "test-retention-period",
                OutsideEu         = false,
                AutomatedDecision = false,
                UrlOne            = "test-url-1",
                UrlTwo            = "test-url-2",
                UrlThree          = "test-url-3",
                Breadcrumbs       = new List <ContentfulReference>()
            };

            // Act
            var privacyNotice = _privacyNoticeContentfulFactory.ToModel(contentfulPrivacyNotice);

            // Assert
            privacyNotice
            .Should()
            .BeEquivalentTo(contentfulPrivacyNotice, p => p
                            .ExcludingMissingMembers());
        }
コード例 #2
0
        public void GetPrivacyNotice_ShouldReturnAPrivacyNotice()
        {
            // Arrange
            const string slug = "test-slug";
            var          contentfulPrivacyNotice = new ContentfulPrivacyNotice()
            {
                Slug = slug
            };
            var privacyNotice = new PrivacyNotice()
            {
                Slug = slug
            };
            var contentfulCollection = new ContentfulCollection <ContentfulPrivacyNotice>()
            {
                Items = new List <ContentfulPrivacyNotice> {
                    contentfulPrivacyNotice
                }
            };

            _contentfulClient.Setup(_ => _.GetEntries(It.IsAny <QueryBuilder <ContentfulPrivacyNotice> >(), It.IsAny <CancellationToken>())).ReturnsAsync(contentfulCollection);
            _contentfulFactory.Setup(_ => _.ToModel(contentfulPrivacyNotice)).Returns(privacyNotice);

            // Act
            var result = AsyncTestHelper.Resolve(_repository.GetPrivacyNotice(slug));

            // Assert
            result.Should().BeOfType <PrivacyNotice>();
        }
        public void ToModel_ShouldReturnPrivacyNotice()
        {
            // Arrange
            var contentfulPrivacyNotice = new ContentfulPrivacyNotice();

            // Act
            var privacyNotice = _privacyNoticeContentfulFactory.ToModel(contentfulPrivacyNotice);

            // Assert
            privacyNotice
            .Should()
            .BeOfType <PrivacyNotice>();
        }