コード例 #1
0
        public void TestGetContentWithHtmlRemoved_Returns_Empty_String_If_Content_Item_Is_Null()
        {
            // Arrange
            _contentReader.Setup(x => x.GetContentForProfile(ProfileId, ContentKey))
                .Returns((ContentItem)null);

            // Act
            var content = new ContentProvider(_contentReader.Object, _htmlCleaner.Object)
                .GetContentWithHtmlRemoved(ProfileId, ContentKey);

            // Assert
            Assert.AreEqual(string.Empty, content);
            VerifyAll();
        }
コード例 #2
0
        public void TestGetContentWithHtmlRemoved_Html_Is_Removed_For_Html_Content()
        {
            // Arrange
            var htmlContentItem = new ContentItem
            {
                Content = ContentWithHtml,
                IsPlainText = false
            };

            _htmlCleaner.Setup(x => x.RemoveHtml(ContentWithHtml))
                .Returns(ContentWithHtmlRemoved);

            _contentReader.Setup(x => x.GetContentForProfile(ProfileId, ContentKey))
                .Returns(htmlContentItem);

            // Act
            var content = new ContentProvider(_contentReader.Object, _htmlCleaner.Object)
                .GetContentWithHtmlRemoved(ProfileId, ContentKey);

            // Assert
            Assert.AreEqual(ContentWithHtmlRemoved, content);
            VerifyAll();
        }