public void Process(IConventionFormatContext context, params ConventionResult[] results) { Reports.AddRange(results.Except(Reports)); var outputContent = Process(context); File.WriteAllText(output, outputContent); }
public void Process(IConventionFormatContext context, params ConventionResult[] results) { foreach (var conventionResult in results) { Trace.WriteLine(context.TestResultProcessor.Process(context, conventionResult)); } }
static void RenderItems(ConventionResult resultInfo, StringBuilder stringBuilder, IConventionFormatContext context) { foreach (var conventionFailure in resultInfo.Data) { stringBuilder.Append("\t"); stringBuilder.AppendLine(context.FormatDataAsString(conventionFailure)); } }
public void Process(IConventionFormatContext context, params ConventionResult[] results) { var invalidResults = results.Where(r => r.HasData).Select(r => context.TestResultProcessor.Process(context, r)).ToArray(); if (invalidResults.None()) { return; } throw new ConventionFailedException(string.Join(Environment.NewLine, invalidResults)); }
public string Process(IConventionFormatContext context, ConventionResult result) { StringBuilder sb = new StringBuilder(); sb.Append("Il y a ").Append(result.Data.Length).AppendLine(" types en erreur : "); foreach(var t in result.Data) { sb.AppendLine(((Type)t).Name); } return sb.ToString(); }
public string Process(IConventionFormatContext context, ConventionResult result) { var formatter = new DefaultFormatter(result.DataType); var message = new StringBuilder(); message.AppendLine(string.Join(",", formatter.DesribeType())); foreach (var item in result.Data) { message.AppendLine(string.Join(",", formatter.DesribeItem(item, context))); } return message.ToString(); }
public string Process(IConventionFormatContext context, ConventionResult result) { var description = new StringBuilder(); var title = string.Format("'{0}' for '{1}'", result.ConventionTitle, result.DataDescription); description.AppendLine(title); description.AppendLine(string.Empty.PadRight(title.Length, '-')); description.AppendLine(); RenderItems(result, description, context); return description.ToString(); }
public string Process(IConventionFormatContext context, ConventionResult result) { var formatter = new DefaultFormatter(result.DataType); var message = new StringBuilder(); message.AppendLine(string.Join(",", formatter.DesribeType())); foreach (var item in result.Data) { message.AppendLine(string.Join(",", formatter.DesribeItem(item, context))); } return(message.ToString()); }
public string Process(IConventionFormatContext context, ConventionResult result) { var description = new StringBuilder(); var title = string.Format("'{0}' for '{1}'", result.ConventionTitle, result.DataDescription); description.AppendLine(title); description.AppendLine(string.Empty.PadRight(title.Length, '-')); description.AppendLine(); RenderItems(result, description, context); return(description.ToString()); }
public void Process(IConventionFormatContext context, params ConventionResult[] results) { var failedApprovals = results.Select(result => context.TestResultProcessor.Process(context, result)).ToList(); switch (failedApprovals.Count) { case 0: Failures = string.Empty; break; case 1: Failures = failedApprovals[0]; break; default: Failures = string.Join(Environment.NewLine, failedApprovals); break; } }
protected override string Process(IConventionFormatContext context, IEnumerable<IGrouping<string, ConventionResult>> resultsGroupedByDataType) { var sb = new StringBuilder(); sb.AppendLine("# Project Conventions"); foreach (var conventionReport in resultsGroupedByDataType) { sb.Append("## "); sb.AppendLine(conventionReport.Key); foreach (var conventionResult in conventionReport) { sb.Append(" - **"); sb.Append(conventionResult.ConventionTitle); sb.AppendLine("** "); sb.AppendLine(conventionResult.ConventionReason); } } return sb.ToString(); }
protected override string Process(IConventionFormatContext context, IEnumerable <IGrouping <string, ConventionResult> > resultsGroupedByDataType) { var sb = new StringBuilder(); sb.AppendLine("# Project Conventions"); foreach (var conventionReport in resultsGroupedByDataType) { sb.Append("## "); sb.AppendLine(conventionReport.Key); foreach (var conventionResult in conventionReport) { sb.Append(" - **"); sb.Append(conventionResult.ConventionTitle); sb.AppendLine("** "); sb.AppendLine(conventionResult.ConventionReason); } } return(sb.ToString()); }
public void Process(IConventionFormatContext context, params ConventionResult[] results) { var failedApprovals = new List<ApprovalException>(); for (var count = 0; count < results.Length; count++) { var result = results[count]; try { //TODO Law of Demeter var formattedResult = context.TestResultProcessor.Process(context, result); var recommendedFileExtension = context.TestResultProcessor.RecommendedFileExtension; Approvals.Verify(new ConventionTestsApprovalTextWriter(formattedResult, count, recommendedFileExtension)); } catch (ApprovalException ex) { failedApprovals.Add(ex); } } if (failedApprovals.Count == 0) { return; } if (failedApprovals.Count == 1) { var ex = failedApprovals[0]; throw new ConventionFailedException("Approved exceptions for convention differs" + Environment.NewLine + Environment.NewLine + ex.Message, ex); } throw new ConventionFailedException("Approved exceptions for convention differs" + Environment.NewLine + Environment.NewLine + string.Join(Environment.NewLine, failedApprovals.Select(x => x.Message)), new AggregateException(failedApprovals.ToArray())); }
protected override string Process(IConventionFormatContext context) { return(Process(context, AggregatedReports.OrderBy(c => c.ConventionTitle).GroupBy(r => r.DataDescription))); }
protected abstract string Process(IConventionFormatContext context);
protected override string Process(IConventionFormatContext context, IEnumerable <IGrouping <string, ConventionResult> > resultsGroupedByDataType) { var sb = new StringBuilder(); sb.Append("<!DOCTYPE html>"); sb.Append("<html>"); // <html> sb.Append("<head>"); // <head> sb.AppendLine(@"<link href=""http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css"" rel=""stylesheet"" />"); sb.AppendLine(@"<link href=""http://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css"" rel=""stylesheet"" />"); sb.Append(@" <style type=""text/css""> h1 { color: #3c6eb4; border-bottom: 1px solid #3c6eb4; } </style>"); sb.AppendLine("</head>"); sb.AppendLine("<body>"); sb.AppendLine("<h1>Project Conventions</h1>"); // foreach (var conventionReport in resultsGroupedByDataType) // { // html.RenderBeginTag(HtmlTextWriterTag.Div); // html.AddAttribute("style", "margin-left:20px;border-bottom: 1px solid"); // html.RenderBeginTag(HtmlTextWriterTag.H2); // html.Write("Conventions for '<strong>{0}</strong>'", conventionReport.Key); // html.RenderEndTag(); // foreach (var conventionResult in conventionReport) // { // var targetId = // conventionResult.ConventionTitle.Replace("'", string.Empty).Replace(" ", string.Empty).Replace(".", string.Empty) + // conventionResult.DataDescription.Replace("'", string.Empty).Replace(" ", string.Empty).Replace(".", string.Empty); // html.AddAttribute("style", "margin-left:20px;"); // html.RenderBeginTag(HtmlTextWriterTag.H4); // html.Write(conventionResult.ConventionTitle); // html.RenderEndTag(); // html.AddAttribute("style", "margin-left:20px;"); // html.RenderBeginTag(HtmlTextWriterTag.Div); // html.Write(conventionResult.ConventionReason); // html.RenderEndTag(); // if (conventionResult.Data.Any()) // { // html.AddAttribute("style", "margin-left:20px;"); // html.RenderBeginTag(HtmlTextWriterTag.Div); // html.AddAttribute("class", "menu-toggle"); // html.AddAttribute("data-toggle", "collapse"); // html.AddAttribute("data-target", "." + targetId); // html.RenderBeginTag(HtmlTextWriterTag.A); // html.AddAttribute("class", "icon-angle-down"); // html.RenderBeginTag(HtmlTextWriterTag.I); // html.RenderEndTag(); // html.Write("With the exception of the following {0}: ", conventionResult.DataType.GetSentenceCaseName()); // html.RenderEndTag(); // html.AddAttribute("class", targetId + " collapse"); // html.AddAttribute("style", "margin-left:20px;"); // html.RenderBeginTag(HtmlTextWriterTag.Div); // html.RenderBeginTag(HtmlTextWriterTag.Ul); // foreach (var o in conventionResult.Data) // { // html.RenderBeginTag(HtmlTextWriterTag.Li); // html.Write(context.FormatDataAsHtml(o)); // html.RenderEndTag(); // } // html.RenderEndTag(); // html.RenderEndTag(); // } // } // html.RenderEndTag(); // } // html.AddAttribute("src", "http://code.jquery.com/jquery.js"); // html.RenderBeginTag(HtmlTextWriterTag.Script); // html.RenderEndTag(); // html.AddAttribute("src", "http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"); // html.RenderBeginTag(HtmlTextWriterTag.Script); // html.RenderEndTag(); // html.RenderEndTag(); // </body> // html.RenderEndTag(); // </html> // html.Flush(); return(sb.ToString()); }
protected abstract string Process(IConventionFormatContext context, IEnumerable<IGrouping<string, ConventionResult>> resultsGroupedByDataType);
protected override string Process(IConventionFormatContext context) { return Process(context, AggregatedReports.OrderBy(c => c.ConventionTitle).GroupBy(r => r.DataDescription)); }
public string[] DesribeItem(object result, IConventionFormatContext context) { return properties.Select(p => context.FormatDataAsString(p.GetValue(result, null)).ToString()).ToArray(); }
public string[] DesribeItem(object result, IConventionFormatContext context) { return(properties.Select(p => context.FormatDataAsString(p.GetValue(result, null)).ToString()).ToArray()); }
protected abstract string Process(IConventionFormatContext context, IEnumerable <IGrouping <string, ConventionResult> > resultsGroupedByDataType);