コード例 #1
0
 public DefaultPrintContextFactory(
   Logger logger,
   VariableFormatter variableFormatter,
   IEnumerable<Formatter> formatters)
 {
   logger.Debug(string.Format("using default formatter: {0}", variableFormatter.GetType().Name));
   logger.Debug(string.Format("using other formatters: {0}",
     string.Join(", ", formatters
       .Select(f => f.GetType().Name)
       .ToArray())));
   this.variableFormatter = variableFormatter;
   this.formatters = formatters;
 }
コード例 #2
0
    public PrintContextImpl(NameEnumeratorFactory nameEnumeratorFac, StringBuilder builder, CalledMethodInfo info, VariableFormatter variableFormatter, IEnumerable<Formatter> customFormatters, string subjectName, string serializerVarName, int spaceIndentation, string[] writtenVars) {
      if (nameEnumeratorFac == null) throw new ArgumentNullException("nameEnumeratorFac");

      SpaceIndentation = spaceIndentation;
      Builder = builder;
      Info = info;
      SubjectName = subjectName;
      VariableFormatter = variableFormatter;
      WrittenVars = writtenVars;
      this.customFormatters = new LinkedList<Formatter>(customFormatters);
      SerializerName = serializerVarName;
      this.nameEnumeratorFac = nameEnumeratorFac;
    }
コード例 #3
0
 public DefaultPrintContextFactory(
     Logger logger,
     VariableFormatter variableFormatter,
     IEnumerable <Formatter> formatters)
 {
     logger.Debug(string.Format("using default formatter: {0}", variableFormatter.GetType().Name));
     logger.Debug(string.Format("using other formatters: {0}",
                                string.Join(", ", formatters
                                            .Select(f => f.GetType().Name)
                                            .ToArray())));
     this.variableFormatter = variableFormatter;
     this.formatters        = formatters;
 }
コード例 #4
0
        public PrintContextImpl(NameEnumeratorFactory nameEnumeratorFac, StringBuilder builder, CalledMethodInfo info, VariableFormatter variableFormatter, IEnumerable <Formatter> customFormatters, string subjectName, string serializerVarName, int spaceIndentation, string[] writtenVars)
        {
            if (nameEnumeratorFac == null)
            {
                throw new ArgumentNullException("nameEnumeratorFac");
            }

            SpaceIndentation       = spaceIndentation;
            Builder                = builder;
            Info                   = info;
            SubjectName            = subjectName;
            VariableFormatter      = variableFormatter;
            WrittenVars            = writtenVars;
            this.customFormatters  = new LinkedList <Formatter>(customFormatters);
            SerializerName         = serializerVarName;
            this.nameEnumeratorFac = nameEnumeratorFac;
        }
コード例 #5
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="VariableFormatterTests" /> class.
 /// </summary>
 public VariableFormatterTests()
 {
     this.formatterMock = new Mock <IMessageFormatter>();
     this.subject       = new VariableFormatter();
 }