public IActionResult Index(string doc = "doc1") { var model = new IndexViewModel(); try { var client = new WebClient(); string html = client.DownloadString($"{HttpContext.Request.Scheme}://{HttpContext.Request.Host}/documents/{doc}.html"); var startTime = DateTime.Now.Millisecond; var output = _htmlToAmp.ConvertToAmp(html); model.Messages = output.Messages; model.Content = output.Result; model.Timer = (DateTime.Now.Millisecond - startTime); } catch { model.Content = "Erreur lors de la récupération du document"; } return(View(model)); }
public void Test1() { string outputHtml = _service.ConvertToAmp("<img src=\"https://test.jpg\" width=\"540\" height=\"480\">").Result; Assert.AreEqual(outputHtml, "<amp-img src=\"https://test.jpg\" width=\"540\" height=\"480\"></amp-img>"); }