コード例 #1
0
        public async Task Build_GeneralInformation_Present()
        {
            // Arrange
            var layout = BuildLayout();

            _layoutDataService
            .Setup(x => x.Get())
            .ReturnsAsync(layout);
            _postDataService
            .Setup(x => x.GetAll(true))
            .ReturnsAsync(new PostDto[0]);

            // Act
            var result = await _target.BuildFeed();

            var feed = result?.Feed;

            // Assert
            Assert.IsNotNull(feed);
            Assert.AreEqual(1, feed.Links.Count);
            Assert.AreEqual(layout.Uri, feed.Links.Single().Uri.AbsoluteUri);

            Assert.AreEqual(layout.Title, feed.Title.Text);
            Assert.AreEqual(layout.Description, feed.Description.Text);
            Assert.AreEqual(layout.Language, feed.Language);

            Assert.AreEqual(1, feed.Authors.Count);
            Assert.AreEqual(layout.Author, feed.Authors.Single().Email);

            _layoutDataService.Verify(x => x.Get(), Times.Once);
            _postDataService.Verify(x => x.GetAll(true), Times.Once);
        }