public Task <ActionResult <string> > ConvertToHtml([FromBody] string markDown) { PageHtml result = _textMiddlewareBuilder.Execute(markDown); ActionResult <string> actionResult = Ok(result.Html); return(Task.FromResult(actionResult)); }
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); }
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); }
public Task <string> ConvertToHtml(string markDown) { PageHtml result = _textMiddlewareBuilder.Execute(markDown); return(Task.FromResult(result.Html)); }