public void FieldImplicitBaseWhenSubclassHasCtor(string code, object expected) { var syntaxTree = CSharpSyntaxTree.ParseText(@" namespace RoslynSandbox { internal class FooBase { protected int value = 1; internal FooBase() { var temp1 = this.value; this.value = 2; var temp2 = this.value; } } internal class Foo : FooBase { internal Foo() { var temp3 = this.value; this.value = 3; var temp4 = this.value; this.value = 4; var temp5 = this.value; } internal void Bar(int arg) { var temp6 = this.value; this.value = 5; var temp7 = this.value; this.value = arg; var temp8 = this.value; } } }"); var compilation = CSharpCompilation.Create("test", new[] { syntaxTree }, MetadataReferences.FromAttributes()); var semanticModel = compilation.GetSemanticModel(syntaxTree); var value = syntaxTree.FindEqualsValueClause(code).Value; using (var assignedValues = AssignedValueWalker.Borrow(value, semanticModel, CancellationToken.None)) { var actual = string.Join(", ", assignedValues); Assert.AreEqual(expected, actual); } }
public void AssignedInLock() { var syntaxTree = CSharpSyntaxTree.ParseText(@" namespace RoslynSandbox { using System; public class Foo : IDisposable { private readonly object gate; public IDisposable disposable; private bool disposed; public void Dispose() { if (this.disposed) { return; } var toDispose = (IDisposable)null; lock (this.gate) { if (this.disposed) { return; } this.disposed = true; toDispose = this.disposable; this.disposable = null; } var temp = toDispose; } } }"); var compilation = CSharpCompilation.Create("test", new[] { syntaxTree }, MetadataReferences.FromAttributes()); var semanticModel = compilation.GetSemanticModel(syntaxTree); var value = syntaxTree.EqualsValueClause("var temp = toDispose;").Value; using (var assignedValues = AssignedValueWalker.Borrow(value, semanticModel, CancellationToken.None)) { var actual = string.Join(", ", assignedValues); Assert.AreEqual("(IDisposable)null, this.disposable", actual); } }
public void FieldCtorCallingProtectedInitializeMethod(string code, string expected) { var syntaxTree = CSharpSyntaxTree.ParseText(@" namespace RoslynSandbox { internal class Foo { public int value = 1; internal Foo() { var temp1 = this.value; this.Initialize(2); var temp4 = this.value; this.value = 3; var temp5 = this.value; this.Initialize(4); var temp6 = this.value; } internal void Bar(int arg) { var temp7 = this.value; this.value = 5; var temp8 = this.value; this.value = arg; var temp9 = this.value; } protected void Initialize(int initArg) { var temp2 = this.value; this.value = initArg; var temp3 = this.value; } } }"); var compilation = CSharpCompilation.Create("test", new[] { syntaxTree }, MetadataReferences.FromAttributes()); var semanticModel = compilation.GetSemanticModel(syntaxTree); var value = syntaxTree.FindEqualsValueClause(code).Value; using (var assignedValues = AssignedValueWalker.Borrow(value, semanticModel, CancellationToken.None)) { var actual = string.Join(", ", assignedValues); Assert.AreEqual(expected, actual); } }
public void InitializedInExplicitBaseCtorWithLiteral(string code, string expected) { var syntaxTree = CSharpSyntaxTree.ParseText(@" namespace RoslynSandbox { internal class FooBase { protected int value = 1; public FooBase() { this.value = -1; } public FooBase(int value) { this.value = value; } } internal class Foo : FooBase { internal Foo() : base(2) { this.value = 3; var temp1 = this.value; this.value = 4; } internal void Bar() { var temp2 = this.value; } } }"); var compilation = CSharpCompilation.Create("test", new[] { syntaxTree }, MetadataReferences.FromAttributes()); var semanticModel = compilation.GetSemanticModel(syntaxTree); var value = syntaxTree.FindEqualsValueClause(code).Value; using (var assignedValues = AssignedValueWalker.Borrow(value, semanticModel, CancellationToken.None)) { var actual = string.Join(", ", assignedValues); Assert.AreEqual(expected, actual); } }
public static void FieldChainedCtor(string code, string expected) { var syntaxTree = CSharpSyntaxTree.ParseText(@" namespace N { internal class C { public int value = 1; internal C() { var temp1 = this.value; this.value = 2; var temp2 = this.value; } internal C(string text) : this() { var temp3 = this.value; this.value = 3; var temp4 = this.value; this.value = 4; var temp5 = this.value; } internal void M(int arg) { var temp6 = this.value; this.value = 5; var temp7 = this.value; this.value = arg; var temp8 = this.value; } } }"); var compilation = CSharpCompilation.Create("test", new[] { syntaxTree }, MetadataReferences.FromAttributes()); var semanticModel = compilation.GetSemanticModel(syntaxTree); var value = syntaxTree.FindEqualsValueClause(code).Value; using var assignedValues = AssignedValueWalker.Borrow(value, semanticModel, CancellationToken.None); var actual = string.Join(", ", assignedValues); Assert.AreEqual(expected, actual); }
public void FieldCtorCallingPrivateInitializeMethod(string code, string expected) { var syntaxTree = CSharpSyntaxTree.ParseText(@" internal class Foo { public int value = 1; internal Foo() { var temp1 = this.value; this.Initialize(2); var temp4 = this.value; this.value = 3; var temp5 = this.value; this.Initialize(4); var temp6 = this.value; } internal void Bar(int arg) { var temp7 = this.value; this.value = 5; var temp8 = this.value; this.value = arg; var temp9 = this.value; } private void Initialize(int initArg) { var temp2 = this.value; this.value = initArg; var temp3 = this.value; } }"); var compilation = CSharpCompilation.Create("test", new[] { syntaxTree }, MetadataReferences.All); var semanticModel = compilation.GetSemanticModel(syntaxTree); var value = syntaxTree.EqualsValueClause(code).Value; using (var pooled = AssignedValueWalker.Create(value, semanticModel, CancellationToken.None)) { var actual = string.Join(", ", pooled.Item); Assert.AreEqual(expected, actual); } }
public void FieldChainedCtorGenericClass(string code, string expected) { var syntaxTree = CSharpSyntaxTree.ParseText(@" internal class Foo<T> { public int value = 1; internal Foo() { var temp1 = this.value; this.value = 2; var temp2 = this.value; } internal Foo(string text) : this() { var temp3 = this.value; this.value = 3; var temp4 = this.value; this.value = 4; var temp5 = this.value; } internal void Bar(int arg) { var temp6 = this.value; this.value = 5; var temp7 = this.value; this.value = arg; var temp8 = this.value; } }"); var compilation = CSharpCompilation.Create("test", new[] { syntaxTree }, MetadataReferences.FromAttributes()); var semanticModel = compilation.GetSemanticModel(syntaxTree); var value = syntaxTree.EqualsValueClause(code).Value; using (var pooled = AssignedValueWalker.Create(value, semanticModel, CancellationToken.None)) { var actual = string.Join(", ", pooled.Item); Assert.AreEqual(expected, actual); } }
public void InitializedInBaseCtorWithDefaultGenericGeneric(string code, string expected) { var syntaxTree = CSharpSyntaxTree.ParseText(@" namespace RoslynSandbox { internal class FooBase<T> { protected readonly T value; internal FooBase() { this.value = default(T); } internal FooBase(T value) { this.value = value; } } internal class Foo<T> : FooBase<T> { internal Foo() { var temp1 = this.value; } internal void Bar() { var temp2 = this.value; } } }"); var compilation = CSharpCompilation.Create("test", new[] { syntaxTree }, MetadataReferences.FromAttributes()); var semanticModel = compilation.GetSemanticModel(syntaxTree); var value = syntaxTree.FindEqualsValueClause(code).Value; using (var assignedValues = AssignedValueWalker.Borrow(value, semanticModel, CancellationToken.None)) { var actual = string.Join(", ", assignedValues); Assert.AreEqual(expected, actual); } }
public void InitializedInBaseCtorWithLiteral(string code, string expected) { var syntaxTree = CSharpSyntaxTree.ParseText(@" internal class FooBase { protected readonly int value = 1; internal FooBase() { this.value = 2; } internal FooBase(int value) { this.value = value; } } internal class Foo : FooBase { internal Foo() { this.value = 3; var temp1 = this.value; this.value = 4; } internal void Bar() { var temp2 = this.value; } }"); var compilation = CSharpCompilation.Create("test", new[] { syntaxTree }, MetadataReferences.FromAttributes()); var semanticModel = compilation.GetSemanticModel(syntaxTree); var value = syntaxTree.EqualsValueClause(code).Value; using (var pooled = AssignedValueWalker.Create(value, semanticModel, CancellationToken.None)) { var actual = string.Join(", ", pooled.Item); Assert.AreEqual(expected, actual); } }
public void BackingFieldPublicSetInitializedAndAssignedInCtor(string code, string expected) { var syntaxTree = CSharpSyntaxTree.ParseText(@" namespace RoslynSandbox { public sealed class Foo { private int bar = 1; public Foo() { var temp1 = this.bar; var temp2 = this.Bar; this.bar = 2; var temp3 = this.bar; var temp4 = this.Bar; } public int Bar { get { return this.bar; } set { this.bar = value; } } public void Meh() { var temp5 = this.bar; var temp6 = this.Bar; } } }"); var compilation = CSharpCompilation.Create("test", new[] { syntaxTree }, MetadataReferences.FromAttributes()); var semanticModel = compilation.GetSemanticModel(syntaxTree); var value = syntaxTree.EqualsValueClause(code).Value; using (var assignedValues = AssignedValueWalker.Borrow(value, semanticModel, CancellationToken.None)) { var actual = string.Join(", ", assignedValues); Assert.AreEqual(expected, actual); } }
public void AssignedWithArg() { var syntaxTree = CSharpSyntaxTree.ParseText(@" internal class Foo { internal Foo(int meh) { var temp = meh; var value = temp; } }"); var compilation = CSharpCompilation.Create("test", new[] { syntaxTree }, MetadataReferences.FromAttributes()); var semanticModel = compilation.GetSemanticModel(syntaxTree); var value = syntaxTree.EqualsValueClause("var value = temp").Value; using (var assignedValues = AssignedValueWalker.Borrow(value, semanticModel, CancellationToken.None)) { var actual = string.Join(", ", assignedValues); Assert.AreEqual("meh", actual); } }
public void AssignedWithArgGenericClass() { var syntaxTree = CSharpSyntaxTree.ParseText(@" internal class Foo<T> { internal Foo(T meh) { var temp = meh; var value = temp; } }"); var compilation = CSharpCompilation.Create("test", new[] { syntaxTree }, MetadataReferences.All); var semanticModel = compilation.GetSemanticModel(syntaxTree); var value = syntaxTree.EqualsValueClause("var value = temp").Value; using (var pooled = AssignedValueWalker.Create(value, semanticModel, CancellationToken.None)) { var actual = string.Join(", ", pooled.Item); Assert.AreEqual("meh", actual); } }
public void InitializedWithDefaultGeneric() { var syntaxTree = CSharpSyntaxTree.ParseText(@" internal class Foo<T> { internal Foo() { var value = default(T); var temp = value; } }"); var compilation = CSharpCompilation.Create("test", new[] { syntaxTree }, MetadataReferences.FromAttributes()); var semanticModel = compilation.GetSemanticModel(syntaxTree); var value = syntaxTree.EqualsValueClause("var temp = value;").Value; using (var assignedValues = AssignedValueWalker.Borrow(value, semanticModel, CancellationToken.None)) { var actual = string.Join(", ", assignedValues); Assert.AreEqual("default(T)", actual); } }
public static void VerbatimIdentifierAssignedWithArg() { var syntaxTree = CSharpSyntaxTree.ParseText(@" namespace N { internal class C { internal C(int meh) { var @operator = meh; var value = @operator; } } }"); var compilation = CSharpCompilation.Create("test", new[] { syntaxTree }, MetadataReferences.FromAttributes()); var semanticModel = compilation.GetSemanticModel(syntaxTree); var value = syntaxTree.FindEqualsValueClause("var value = @operator").Value; using var assignedValues = AssignedValueWalker.Borrow(value, semanticModel, CancellationToken.None); Assert.AreEqual("meh", assignedValues.Single().ToString()); }
public static void BackingFieldPrivateSetInitializedAndAssignedInCtor(string code1, string expected) { var syntaxTree = CSharpSyntaxTree.ParseText(@" namespace N { public sealed class C { private int p = 1; public C() { var temp1 = this.p; var temp2 = this.P; this.p = 2; var temp3 = this.p; var temp4 = this.P; } public int P { get { return this.p; } private set { this.p = value; } } public void M() { var temp5 = this.p; var temp6 = this.P; } } }"); var compilation = CSharpCompilation.Create("test", new[] { syntaxTree }, MetadataReferences.FromAttributes()); var semanticModel = compilation.GetSemanticModel(syntaxTree); var value = syntaxTree.FindEqualsValueClause(code1).Value; using var assignedValues = AssignedValueWalker.Borrow(value, semanticModel, CancellationToken.None); var actual = string.Join(", ", assignedValues); Assert.AreEqual(expected, actual); }
public void FieldAssignedWithRefParameterArgument(string code, string expected) { var syntaxTree = CSharpSyntaxTree.ParseText(@" namespace RoslynSandbox { internal class Foo { private int value = 1; public Foo() { var temp1 = this.value; this.Assign(ref this.value, 2); var temp2 = this.value; } internal void Bar() { var temp3 = this.value; this.Assign(ref this.value, 3); var temp4 = this.value; } private void Assign(ref int refValue, int arg) { refValue = arg; } } }"); var compilation = CSharpCompilation.Create("test", new[] { syntaxTree }, MetadataReferences.FromAttributes()); var semanticModel = compilation.GetSemanticModel(syntaxTree); var value = syntaxTree.FindEqualsValueClause(code).Value; using (var pooled = AssignedValueWalker.Borrow(value, semanticModel, CancellationToken.None)) { var actual = string.Join(", ", pooled); Assert.AreEqual(expected, actual); } }
public static void InitializedArrayIndexer(string code, string expected) { var syntaxTree = CSharpSyntaxTree.ParseText(@" internal class C { internal C() { var ints = new int[] { 1, 2 }; var temp1 = ints[0]; ints[0] = 3; var temp2 = ints[0]; } }"); var compilation = CSharpCompilation.Create("test", new[] { syntaxTree }, MetadataReferences.FromAttributes()); var semanticModel = compilation.GetSemanticModel(syntaxTree); var value = syntaxTree.FindEqualsValueClause(code).Value; using var assignedValues = AssignedValueWalker.Borrow(value, semanticModel, CancellationToken.None); var actual = string.Join(", ", assignedValues); Assert.AreEqual(expected, actual); }
public static void MethodInjectedWithOptional(string statement, string expected) { var syntaxTree = CSharpSyntaxTree.ParseText(@" namespace N { internal class C { private int value; internal C() { var temp1 = this.value; this.Update(1); var temp2 = this.value; this.Update(2, ""abc""); var temp3 = this.value; } internal void M() { var temp4 = this.value; } internal void Update(int arg, string text = null) { this.value = arg; } } }"); var compilation = CSharpCompilation.Create("test", new[] { syntaxTree }, MetadataReferences.FromAttributes()); var semanticModel = compilation.GetSemanticModel(syntaxTree); var value = syntaxTree.FindEqualsValueClause(statement).Value; using var assignedValues = AssignedValueWalker.Borrow(value, semanticModel, CancellationToken.None); var actual = string.Join(", ", assignedValues); Assert.AreEqual(expected, actual); }
public void InitializedInChainedWithLiteralGeneric(string code, string expected) { var syntaxTree = CSharpSyntaxTree.ParseText(@" namespace RoslynSandbox { internal class Foo<T> { internal Foo() { this.Value = 2; } internal Foo(string text) : this() { this.Value = 3; var temp1 = this.Value; this.Value = 4; } public int Value { get; set; } = 1; internal void Bar() { var temp2 = this.Value; } } }"); var compilation = CSharpCompilation.Create("test", new[] { syntaxTree }, MetadataReferences.FromAttributes()); var semanticModel = compilation.GetSemanticModel(syntaxTree); var value = syntaxTree.FindEqualsValueClause(code).Value; using (var assignedValues = AssignedValueWalker.Borrow(value, semanticModel, CancellationToken.None)) { var actual = string.Join(", ", assignedValues); Assert.AreEqual(expected, actual); } }
public static void FieldAssignedWithOutParameter(string code, string expected) { var syntaxTree = CSharpSyntaxTree.ParseText(@" namespace N { internal class C { private int value = 1; public C() { var temp1 = this.value; this.Assign(out this.value, 2); var temp2 = this.value; } internal void M() { var temp3 = this.value; this.Assign(out this.value, 3); var temp4 = this.value; } private void Assign(out int outValue, int arg) { outValue = arg; } } }"); var compilation = CSharpCompilation.Create("test", new[] { syntaxTree }, MetadataReferences.FromAttributes()); var semanticModel = compilation.GetSemanticModel(syntaxTree); var value = syntaxTree.FindEqualsValueClause(code).Value; using var assignedValues = AssignedValueWalker.Borrow(value, semanticModel, CancellationToken.None); var actual = string.Join(", ", assignedValues); Assert.AreEqual(expected, actual); }
public static void DiscardedOutAssignedWithArgument(string expression) { var syntaxTree = CSharpSyntaxTree.ParseText(@" namespace N { public static class C { public static bool M() => TryGet(1, out _); private static bool TryGet(int arg, out int i) { i = arg; return true; } } }".AssertReplace("out _", expression)); var compilation = CSharpCompilation.Create("test", new[] { syntaxTree }, MetadataReferences.FromAttributes()); var semanticModel = compilation.GetSemanticModel(syntaxTree); var value = syntaxTree.FindArgument(expression).Expression; using var assignedValues = AssignedValueWalker.Borrow(value, semanticModel, CancellationToken.None); CollectionAssert.AreEqual("1", string.Join(", ", assignedValues)); }
public void NotInitialized(string code, string expected) { var syntaxTree = CSharpSyntaxTree.ParseText(@" internal class Foo { internal Foo() { int value; var temp1 = value; value = 1; var temp2 = value; } }"); var compilation = CSharpCompilation.Create("test", new[] { syntaxTree }, MetadataReferences.FromAttributes()); var semanticModel = compilation.GetSemanticModel(syntaxTree); var value = syntaxTree.EqualsValueClause(code).Value; using (var assignedValues = AssignedValueWalker.Borrow(value, semanticModel, CancellationToken.None)) { var actual = string.Join(", ", assignedValues); Assert.AreEqual(expected, actual); } }
public void FieldInitializedlWithLiteralAndAssignedInCtor(string code, string expected) { var syntaxTree = CSharpSyntaxTree.ParseText(@" namespace RoslynSandbox { internal class Foo { private readonly int value = 1; private readonly int temp1; internal Foo() { this.temp1 = this.value; var temp1 = this.value; var temp2 = this.temp1; this.value = 2; var temp3 = this.value; var temp4 = this.temp1; } internal void Bar() { var temp5 = this.value; var temp6 = this.temp1; } } }"); var compilation = CSharpCompilation.Create("test", new[] { syntaxTree }, MetadataReferences.FromAttributes()); var semanticModel = compilation.GetSemanticModel(syntaxTree); var value = syntaxTree.FindEqualsValueClause(code).Value; using (var assignedValues = AssignedValueWalker.Borrow(value, semanticModel, CancellationToken.None)) { var actual = string.Join(", ", assignedValues); Assert.AreEqual(expected, actual); } }
public void RecursiveOutAssigned() { var syntaxTree = CSharpSyntaxTree.ParseText(@" namespace RoslynSandbox { internal class Foo { internal Foo() { int value; RecursiveOut(out value); var temp = value; } public static bool RecursiveOut(out int value) { value = 0; if (value < 0) { return RecursiveOut(out value); } value = 1; return true; } } }"); var compilation = CSharpCompilation.Create("test", new[] { syntaxTree }, MetadataReferences.FromAttributes()); var semanticModel = compilation.GetSemanticModel(syntaxTree); var value = syntaxTree.FindEqualsValueClause("var temp = value").Value; using (var assignedValues = AssignedValueWalker.Borrow(value, semanticModel, CancellationToken.None)) { var actual = string.Join(", ", assignedValues); Assert.AreEqual("0, 1", actual); } }
public void InitializedTypedArrayIndexer(string code, string expected) { var syntaxTree = CSharpSyntaxTree.ParseText(@" internal class Foo { internal Foo() { int[] ints = { 1, 2 }; var temp1 = ints[0]; ints[0] = 3; var temp2 = ints[0]; } }"); var compilation = CSharpCompilation.Create("test", new[] { syntaxTree }, MetadataReferences.All); var semanticModel = compilation.GetSemanticModel(syntaxTree); var value = syntaxTree.EqualsValueClause(code) .Value; using (var pooled = AssignedValueWalker.Create(value, semanticModel, CancellationToken.None)) { var actual = string.Join(", ", pooled.Item); Assert.AreEqual(expected, actual); } }
public void LocalAssignedWithChainedOutParameter(string code, string expected) { var syntaxTree = CSharpSyntaxTree.ParseText(@" namespace RoslynSandbox { internal class Foo { internal Foo() { int value; var temp1 = value; Assign1(out value, 1); var temp2 = value; } internal void Assign1(out int value1, int arg1) { Assign2(out value1, arg1); } internal void Assign2(out int value2, int arg2) { value2 = arg2; } } }"); var compilation = CSharpCompilation.Create("test", new[] { syntaxTree }, MetadataReferences.FromAttributes()); var semanticModel = compilation.GetSemanticModel(syntaxTree); var value = syntaxTree.EqualsValueClause(code).Value; using (var pooled = AssignedValueWalker.Create(value, semanticModel, CancellationToken.None)) { var actual = string.Join(", ", pooled.Item); Assert.AreEqual(expected, actual); } }
public void MethodInjectedWithOptionalAssigningOptional(string code, string expected) { var syntaxTree = CSharpSyntaxTree.ParseText(@" internal class Foo { private string text; internal Foo() { var temp1 = this.text; this.Update(1); var temp2 = this.text; this.Update(2, ""abc""); var temp3 = this.text; } internal void Bar() { var temp4 = this.text; } internal void Update(int arg, string textArg = null) { this.text = textArg; } }"); var compilation = CSharpCompilation.Create("test", new[] { syntaxTree }, MetadataReferences.All); var semanticModel = compilation.GetSemanticModel(syntaxTree); var value = syntaxTree.EqualsValueClause(code).Value; using (var pooled = AssignedValueWalker.Create(value, semanticModel, CancellationToken.None)) { var actual = string.Join(", ", pooled.Item); Assert.AreEqual(expected, actual); } }
public void LocalAssignedWithOutParameter(string code, string expected) { var syntaxTree = CSharpSyntaxTree.ParseText(@" internal class Foo { internal Foo() { int value; var temp1 = value; Assign(out value, 1); var temp2 = value; } internal void Bar() { int value; var temp3 = value; Assign(out value, 2); var temp4 = value; } internal void Assign(out int outValue, int arg) { outValue = arg; } }"); var compilation = CSharpCompilation.Create("test", new[] { syntaxTree }, MetadataReferences.FromAttributes()); var semanticModel = compilation.GetSemanticModel(syntaxTree); var value = syntaxTree.FindEqualsValueClause(code).Value; using (var pooled = AssignedValueWalker.Borrow(value, semanticModel, CancellationToken.None)) { var actual = string.Join(", ", pooled); Assert.AreEqual(expected, actual); } }
public void LambdaInCtor(string code, string expected) { var syntaxTree = CSharpSyntaxTree.ParseText(@" namespace RoslynSandbox { using System; internal class Foo { private int value; public Foo() { var temp1 = this.value; this.Meh += (o, e) => this.value = 1; var temp2 = this.value; } public event EventHandler Meh; internal void Bar() { var temp3 = this.value; } } }"); var compilation = CSharpCompilation.Create("test", new[] { syntaxTree }, MetadataReferences.FromAttributes()); var semanticModel = compilation.GetSemanticModel(syntaxTree); var value = syntaxTree.FindEqualsValueClause(code).Value; using (var assignedValues = AssignedValueWalker.Borrow(value, semanticModel, CancellationToken.None)) { var actual = string.Join(", ", assignedValues); Assert.AreEqual(expected, actual); } }
public void MethodInjected(string code, string expected) { var syntaxTree = CSharpSyntaxTree.ParseText(@" internal class Foo { private int value; internal Foo() { var temp1 = this.value; this.Update(1); var temp2 = this.value; this.Update(2); var temp3 = this.value; } internal void Bar() { var temp4 = this.value; } internal void Update(int arg) { this.value = arg; } }"); var compilation = CSharpCompilation.Create("test", new[] { syntaxTree }, MetadataReferences.FromAttributes()); var semanticModel = compilation.GetSemanticModel(syntaxTree); var value = syntaxTree.FindEqualsValueClause(code).Value; using (var assignedValues = AssignedValueWalker.Borrow(value, semanticModel, CancellationToken.None)) { var actual = string.Join(", ", assignedValues); Assert.AreEqual(expected, actual); } }