Пример #1
0
 public static void Approve(Func <FileReportModel> model, IReportBuilder reportBuilder)
 {
     // setting the culture to make sure the date is formatted the same on all machines
     using (new TemporaryCulture("en-GB"))
     {
         var result = reportBuilder.CreateReport(model());
         Approvals.Verify(result, s => Scrub(StackTraceScrubber.ScrubLineNumbers(StackTraceScrubber.ScrubPaths(s))));
     }
 }
Пример #2
0
 string Scrubber(string s)
 {
     s = StackTraceScrubber.ScrubLineNumbers(s);
     s = StackTraceScrubber.ScrubPaths(s);
     //the throwhelper seems to be present on some environments' stack traces but not others, cut it out to make tha approvals pass on most machines
     s = Regex.Replace(s, @"\n.*ThrowHelper.*\n", "\n");
     s = Regex.Replace(s, @"\r?\n", "\n");
     // replace line number in polyassert headers
     s = Regex.Replace(s, @"(?<=^ERROR in.*:)\d+(?=:$)", "<line>", RegexOptions.Multiline);
     return(s);
 }