public async Task ConvertToHtml()
        {
            // given
            string expectedHtml = "<html>";
            string markdown     = "a bit of markdown";

            _textMiddlewareMock.Execute(markdown)
            .Returns(new PageHtml(expectedHtml));

            // when
            string actualHtml = await _markdownController.ConvertToHtml(markdown);

            // then
            actualHtml.ShouldBe(expectedHtml);
            _textMiddlewareMock
            .Received(1)
            .Execute(markdown);
        }
Ejemplo n.º 2
0
        public async Task ConvertToHtml()
        {
            // given
            string expectedHtml = "<html>";
            string markdown     = "a bit of markdown";

            _textMiddlewareMock.Execute(markdown)
            .Returns(new PageHtml(expectedHtml));

            // when
            ActionResult <string> actionResult = await _markdownController.ConvertToHtml(markdown);

            // then
            actionResult.ShouldBeOkObjectResult();

            string actualHtml = actionResult.GetOkObjectResultValue();

            actualHtml.ShouldBe(expectedHtml);
        }