([^<]+)
").Groups[1].Value; } [Fact] public void Render_matches_the_golden_file() { var html = LetterHtml.Render(FixtureBrief(), Template, At, watermark: true); var golden = File.ReadAllText(GoldenPath); Assert.Equal(golden, html); } [Fact] public void Render_resolves_the_body_datum_placeholder_from_the_given_at_not_the_wall_clock() { const string historicalAt = "2019-03-14T08:00:00.0000000+00:00"; var html = LetterHtml.Render(FixtureBriefWithDatumInBody(), Template, historicalAt, watermark: false); Assert.Equal("14 maart 2019", ExtractBodyDatumParagraph(html)); } [Fact] public void Render_keeps_the_letterhead_date_and_the_body_datum_in_agreement_for_a_historical_at() { // A historical `at` (an archive re-render, a back-dated letter) is the case // where the letterhead and the body datum placeholder could disagree within // one document, if the body still read the wall clock (TE-007). const string historicalAt = "2019-03-14T08:00:00.0000000+00:00"; var html = LetterHtml.Render(FixtureBriefWithDatumInBody(), Template, historicalAt, watermark: false); Assert.Equal(ExtractLetterheadDate(html), ExtractBodyDatumParagraph(html)); } [Fact] public void Every_letter_prefixed_class_exists_in_letter_css() { var html = LetterHtml.Render(FixtureBrief(), Template, At, watermark: true); var classes = Regex.Matches(html, "class=\"([^\"]+)\"") .SelectMany(m => m.Groups[1].Value.Split(' ')) .Where(c => c.StartsWith("letter")) .Distinct(); Assert.NotEmpty(classes); Assert.All(classes, c => Assert.Contains($".{c}", LetterHtml.StyleSheet)); } }