public void should_render_razor_template() { var fileStore = new FileStore(); var renderService = new PresentationService(_batches, _templates, new LatexEngine(), new RazorEngine(), fileStore); try { var fileId = renderService.RenderLatex(TemplateId, BatchId); File.ReadAllText(fileStore.GetPath(fileId)).ShouldEqual(@"\documentclass[12pt]{article} \begin{document} Hello yada. \end{document}"); } catch (PresentationService.RenderException exception) { Debug.WriteLine(exception.Details); throw; } }
public void should_render_latex_pdf() { var fileStore = new FileStore(); var renderService = new PresentationService(_batches, _templates, new LatexEngine(), new RazorEngine(), fileStore); Guid id; try { id = renderService.RenderPdf(TemplateId, BatchId); } catch (PresentationService.RenderException exception) { Debug.WriteLine(exception.Details); throw; } var path = fileStore.GetPath(id); Debug.WriteLine(path); File.Exists(path).ShouldBeTrue(); new FileInfo(path).Length.ShouldNotEqual(0); Directory.Delete(Path.GetDirectoryName(path), true); }
public void should_throw_render_exception_when_latex_malformed() { var renderService = new PresentationService(_batches, _templates, new LatexEngine(), new RazorEngine(), new FileStore()); Assert.Throws<PresentationService.RenderException>(() => renderService.RenderPdf(BadLatexTemplateId, BatchId)); }
public void should_throw_render_exception_when_razor_binding_error() { var renderService = new PresentationService(_batches, _templates, new LatexEngine(), new RazorEngine(), new FileStore()); Assert.Throws<PresentationService.RenderException>(() => renderService.RenderLatex(BadBindingRazorTemplateId, BatchId)); }
public PresentationPostHandler(PresentationService presentationService) { _presentationService = presentationService; }