public void ThisExpression() { var e = new ThisExpression(); Assert.IsTrue(e.IsTrivial); Assert.AreEqual("this", e.ToString()); }
/// <summary> /// Outputs a user-friendly representation of this expression. /// </summary> /// <returns></returns> public override string ToString() { var delimiter = ""; switch (Delimiter) { case IdDelimiter.Dollar: delimiter = "$"; break; case IdDelimiter.Dot: delimiter = "."; break; case IdDelimiter.Hash: delimiter = "#"; break; case IdDelimiter.SingleArrow: delimiter = "->"; break; case IdDelimiter.Slash: delimiter = "/"; break; } return($"{ThisExpression.ToString()}{delimiter}{MemberName}"); }
public void ThisExpressionProducesThis() { var expression = new ThisExpression(); Assert.AreEqual("this;", expression.ToString()); }