public void ToStringIsImplemented() { var sut = new VariableReference { Identifier = "xyz" }; var actual = sut.ToString(); const string expected = "VariableReference(xyz)"; Assert.AreEqual(expected, actual); }
public static string GetName(this VariableReference self, MethodBody body) { if (self == null) { return(String.Empty); } var def = self.Resolve(); if (def == null) { return(self.ToString()); } return(GetVariableName(def, body)); }
public static string GetName(this VariableReference self, MethodDebugInformation debugInfo) { if (self == null) { return(String.Empty); } // as per commit 7cde491752861a331e091dca601748e9f0741e95 of Mono.Cecil, VariableReference do not have Name anymore if (debugInfo != null) { if (debugInfo.TryGetName((VariableDefinition)self, out var name)) { return(name); } } return(self.ToString()); }
public void Visit(VariableReference variableReference) { _result += variableReference.ToString(); }
public void It_has_a_useful_ToString_method() { var a = new VariableReference("a"); Assert.AreEqual("VariableReference(\"a\")", a.ToString()); }