protected override Expression VisitConstant(ConstantExpression node) { Token token; if (node.Value == null) { token = new Token { TokenType = TokenType.Null, Value = "null" }; } else { token = new Token { TokenType = LiteralTokenTypes.Lookup(node.Type), Value = _typeFormatter.Format(node.Type, node.Value) }; } _expression.Push(token); return(base.VisitConstant(node)); }
public override string ToString() { var result = (Value == null) ? "Null" : Formatter.Format(Type, Value); return(result); }
public void WriteRow([NotNull] T value) { if (value == null) { throw new ArgumentNullException("value"); } var values = _formatter.Format(value); _writer.WriteRow(values); }
public void Format_NullType_ThrowsException() { var value = "HelloWorld"; Assert.That(() => _formatter.Format(null, value), Throws.Exception); }
public void Format_NullType_ThrowsException() { var value = DateTimeOffset.Now; Assert.That(() => _formatter.Format(null, value), Throws.Exception); }
public void Format_NullType_ThrowsException() { var value = Guid.NewGuid(); Assert.That(() => _formatter.Format(null, value), Throws.Exception); }
public static string Format <T>(this ITypeFormatter formatter, T value) { return(formatter.Format(typeof(T), value)); }
public static void Format(this ITypeFormatter formatter, object instance, TextWriter writer) { formatter.Format(new FormatContext(), instance, writer); }
public void Format_NullType_ThrowsException() { var value = typeof(string); Assert.That(() => _formatter.Format(null, value), Throws.Exception); }