コード例 #1
0
        public Task <ActionResult <string> > ConvertToHtml([FromBody] string markDown)
        {
            PageHtml result = _textMiddlewareBuilder.Execute(markDown);
            ActionResult <string> actionResult = Ok(result.Html);

            return(Task.FromResult(actionResult));
        }
コード例 #2
0
        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);
        }
コード例 #3
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);
        }
コード例 #4
0
        public Task <string> ConvertToHtml(string markDown)
        {
            PageHtml result = _textMiddlewareBuilder.Execute(markDown);

            return(Task.FromResult(result.Html));
        }