Ejemplo n.º 1
0
 /// <summary>
 /// Renders matches and mismatches to string
 /// </summary>
 /// <typeparam name="TType"></typeparam>
 /// <param name="report"></param>
 /// <param name="tagRenderer"></param>
 /// <returns></returns>
 public static string RenderMatchesAndMismatches <TType>(
     this ComparisonReport <TType> report,
     Func <Tag <TType>, string> tagRenderer)
 {
     return("{0}\n{1}"
            .FormatWith(
                report.RenderMatches(tagRenderer),
                report.RenderMismatches(tagRenderer)));
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Renders <paramref name="report"/>'s matches to string
        /// </summary>
        /// <typeparam name="TType"></typeparam>
        /// <param name="report"></param>
        /// <param name="tagRenderer"></param>
        /// <returns></returns>
        public static string RenderMatches <TType>(
            this ComparisonReport <TType> report,
            Func <Tag <TType>, string> tagRenderer)
        {
            return(@"
#####################################################################################################
###################################MATCHES###########################################################
#####################################################################################################
{0}"
                   .FormatWith(
                       report.Matches[report.Undefined]
                       .OrderBy(p => p.Expected.Tag.Type)
                       .ThenByDescending(p => p.Actual.Score)
                       .Aggregate(
                           new StringBuilder(),
                           (acc, t) => acc.AppendLine(t.Render(c => tagRenderer(c.Tag))))));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Renders <paramref name="report"/>'s mismatches to string
        /// </summary>
        /// <typeparam name="TType"></typeparam>
        /// <param name="report"></param>
        /// <param name="tagRenderer"></param>
        /// <returns></returns>
        public static string RenderMismatches <TType>(
            this ComparisonReport <TType> report,
            Func <Tag <TType>, string> tagRenderer)
        {
            return(@"
#####################################################################################################
##################################MISMATCHES#########################################################
#####################################################################################################
Expected  <<>>  Actual
{0}"
                   .FormatWith(
                       report.Mismatches.Aggregate(
                           new StringBuilder(),
                           (acc, t) =>
            {
                foreach (var error in t.Value.OrderBy(m => m.ActualType))
                {
                    acc.AppendLine(error.Render(tagRenderer));
                }
                return acc;
            })));
        }