public void Setup()
 {
     _htmlElement             = new Mock <IHtmlElement>();
     _boldenHtmlElement       = new BoldenHtmlElement(_htmlElement.Object);
     _italicizeHtmlElement    = new ItalicizeHtmlElement(_htmlElement.Object);
     _hyperLinkifyHtmlElement = new HyperLinkifyHtmlElement("www.google.com", _htmlElement.Object);
     _htmlElement.Setup(htmlElement => htmlElement.GetHtmlElement()).Returns("Google");
 }
Exemple #2
0
        public void HyperlinkHtmlElement_WhenUsingHyperlinkifyDecorator()
        {
            // Arrange
            var hyperlinked = new HyperLinkifyHtmlElement(_DummyLink, _htmlElement);
            // Act
            var result = hyperlinked.GetHtmlElement();

            // Assert
            using (new FluentAssertions.Execution.AssertionScope("hyperlinked html element"))
            {
                result.Should().Be($"<a href=\"{_DummyLink}\">{_DummyElement}</a>");
                Mock.Get(_htmlElement).Verify(htmlElement => htmlElement.GetHtmlElement(), Times.Once);
            }
        }
Exemple #3
0
        public void HyperlinkItalicizeAndBoldenHtmlElement_WhenUsingHyperlinkifyItalicizeBoldenDecorator()
        {
            // Arrange
            var hyperlinked                   = new HyperLinkifyHtmlElement(_DummyLink, _htmlElement);
            var italicizedHyperlinked         = new ItalicizeHtmlElement(hyperlinked);
            var boldenedItalicizedHyperlinked = new BoldenHtmlElement(italicizedHyperlinked);

            // Act
            var result = boldenedItalicizedHyperlinked.GetHtmlElement();

            // Assert
            using (new FluentAssertions.Execution.AssertionScope("hyperlinked and boldened html element"))
            {
                result.Should().Be($"<b><em><a href=\"{_DummyLink}\">{_DummyElement}</a></em></b>");
                Mock.Get(_htmlElement).Verify(htmlElement => htmlElement.GetHtmlElement(), Times.Once);
            }
        }