Base:
2586 references to ToString
ILLink.RoslynAnalyzer (2)
TrimAnalysis\TrimDataFlowAnalysis.cs (2)
116 TraceWriteLine (firstBlockOp.Syntax.ToString ()); 118 TraceWriteLine (branchOp.Syntax.ToString ());
Microsoft.Analyzers.Extra (1)
CallAnalysis\Fixers\LegacyLoggingFixer.cs (1)
343var nspace = ns.Name.ToString();
Microsoft.Analyzers.Extra.Tests (2)
SyntaxNodeExtensionsTests.cs (2)
191Assert.Equal(writeline.ToString(), expression.GetExpressionName()?.ToString()); 201Assert.Equal(b.ToString(), expression.GetExpressionName()?.ToString());
Microsoft.Analyzers.Local (1)
InternalReferencedInPublicDocAnalyzer.cs (1)
138var referencedName = crefNode.Cref.ToString();
Microsoft.AspNetCore.App.Analyzers (1)
RenderTreeBuilder\RenderTreeBuilderAnalyzer.cs (1)
48argument.Syntax.ToString()));
Microsoft.AspNetCore.App.CodeFixes (1)
Kestrel\ListenOnIPv6AnyFixer.cs (1)
67.WithExpression(SyntaxFactory.ParseExpression($"{instanceVariableInvoked.ToString()}.ListenAnyIP"))
Microsoft.AspNetCore.Mvc.Api.Analyzers (1)
AddResponseTypeAttributeCodeFixAction.cs (1)
116var declaredUsings = new HashSet<string>(compilationUnit.Usings.Select(x => x.Name.ToString()));
Microsoft.AspNetCore.SignalR.Client.SourceGenerator (1)
HubServerProxyGenerator.Parser.cs (1)
243proxyType.ToString()));
Microsoft.CodeAnalysis (4)
Syntax\SyntaxList`1.cs (1)
200return _node != null ? _node.ToString() : string.Empty;
Syntax\SyntaxNode.cs (1)
53return GetType().Name + " " + KindText + " " + ToString();
Syntax\SyntaxNodeOrToken.cs (1)
307return _nodeOrParent.ToString();
Syntax\SyntaxNodeOrTokenList.cs (1)
185? _node.ToString()
Microsoft.CodeAnalysis.CodeStyle (4)
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (1)
301id = idNode.ToString();
src\Analyzers\Core\Analyzers\ValidateFormatString\AbstractValidateFormatStringDiagnosticAnalyzer.cs (1)
147var formatString = formatStringLiteralExpressionSyntax.ToString();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\AbstractDocumentationCommentService.cs (2)
67.FirstOrDefault(e => GetName(e).ToString() == "summary"); 131sb.Append(GetCref(xmlCref).ToString());
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
src\Analyzers\Core\CodeFixes\AliasAmbiguousType\AbstractAliasAmbiguousTypeCodeFixProvider.cs (1)
72string.Format(CodeFixesResources.Alias_ambiguous_type_0, diagnosticNode.ToString()),
Microsoft.CodeAnalysis.CSharp (6)
Binder\Binder.cs (1)
943var lines = scope.ScopeDesignator.ToString().Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
BoundTree\BoundNode.cs (1)
430result += " " + Syntax.ToString();
BoundTree\Formatting.cs (1)
155=> (Type is null) ? FormattableStringFactory.Create("stackalloc {0}[{1}]", ElementType, Count.WasCompilerGenerated ? null : Count.Syntax.ToString()) : base.Display;
FlowAnalysis\ControlFlowPass.cs (1)
381new SourceLocation(syntax), syntax.ToString());
Symbols\Source\SourceLabelSymbol.cs (1)
56return node.ToString();
Syntax\CSharpSyntaxNode.cs (1)
538return ToString();
Microsoft.CodeAnalysis.CSharp.CodeStyle (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (1)
838name = (memberDeclaration as ConversionOperatorDeclarationSyntax)?.Type.ToString();
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (2)
src\Analyzers\CSharp\CodeFixes\ReplaceDefaultLiteral\CSharpReplaceDefaultLiteralCodeFixProvider.cs (1)
103return (newLiteral, newLiteral.ToString());
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (1)
2739invocation.Expression.ToString() == "var";
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (216)
CodeGen\CodeGenCheckedTests.cs (3)
2916Assert.Equal("x", xNode.ToString()); 2923Assert.Equal("checked(x)", checkedNode.ToString()); 2948Assert.Equal("x", xNode.ToString());
CodeGen\CodeGenDeconstructTests.cs (68)
97Assert.Equal(@"(x, y)", lhs.ToString()); 102Assert.Equal(@"new C()", right.ToString()); 256Assert.Equal("(x, y) = new C()", deconstruction.ToString()); 279Assert.Equal("a = 1", assignment.ToString()); 312Assert.Equal(@"foreach (char in s) { }", foreachDeconstruction.ToString()); 1129Assert.Equal(@"(i, ""hello"")", tuple.ToString()); 1470Assert.Equal("(x, y)", xy.ToString()); 1511Assert.Equal("(x, y) = new C(1)", tuple1.Parent.ToString()); 1516Assert.Equal("(x, y) = new C(2)", tuple2.Parent.ToString()); 1564Assert.Equal("(x, y) = new C()", tuple.Parent.ToString()); 2288Assert.Equal(@"(x, (y, z)) = Tuple.Create(1, Tuple.Create(""hello"", ""world""))", deconstruction.ToString()); 2689Assert.Equal(@"(x, (y, z))", lhs.ToString()); 3131Assert.Equal(@"var (x1, (x2, x3))", lhs.ToString()); 3136Assert.Equal(@"(x2, x3)", lhsNested.ToString()); 3179Assert.Equal(@"(int x1, var (x2, (x3, x4)), var x5)", lhs.ToString()); 3185Assert.Equal(@"var (x2, (x3, x4))", x234.ToString()); 3190Assert.Equal(@"(x3, x4)", x34.ToString()); 3243Assert.Equal(@"(x1, (x2, x3))", x123.ToString()); 3249Assert.Equal(@"(x2, x3)", x23.ToString()); 3281Assert.Equal("(var x1, var (x2, x3))", lhs.ToString()); 3287Assert.Equal("var (x2, x3)", lhsNested.ToString()); 3331Assert.Equal("(var x1, byte _, var (x2, x3))", lhs.ToString()); 3337Assert.Equal("var (x2, x3)", lhsNested.ToString()); 3444Assert.Equal(@"(string x1, byte x2, var x3)", lhs.ToString()); 3448Assert.Equal(@"(null, 2, 3)", literal.ToString()); 3480Assert.Equal(@"(string x1, var x2)", lhs.ToString()); 3484Assert.Equal(@"(null, (1, 2))", literal.ToString()); 3490Assert.Equal(@"(1, 2)", nestedLiteral.ToString()); 3758Assert.Equal("var", x34Var.Type.ToString()); 3852Assert.Equal("var", x12Var.Type.ToString()); 4037Assert.Equal("var", x12Var.Type.ToString()); 4145Assert.Equal("var", x12Var.Type.ToString()); 4228Assert.Equal("var", x12Var.Type.ToString()); 4339Assert.Equal("var", x12Var.Type.ToString()); 4406Assert.Equal("x", collection.ToString()); 4460Assert.Equal("var", x23Var.Type.ToString()); 4606Assert.Equal("var", x23Var.Type.ToString()); 5193Assert.Equal("var", x23Var.Type.ToString()); 5740Assert.Equal("var", x123Var.Type.ToString()); 5782Assert.Equal("var", x123Var.Type.ToString()); 5912Assert.Equal("int _", declaration1.ToString()); 5920Assert.Equal("var _", declaration2.ToString()); 5926Assert.Equal("var (_, z)", declaration3.ToString()); 6255Assert.Equal("(_, var x)", discard.Parent.Parent.ToString()); 6310Assert.Equal("(_, x)", tuple1.ToString()); 6340Assert.Equal("var (_, x)", tuple1.ToString()); 6368Assert.Equal("(_, x)", discard.Parent.Parent.ToString()); 6399Assert.Equal("var (_, x)", declaration1.ToString()); 6404Assert.Equal("(_, (var y, int z))", discard2.Parent.Parent.ToString()); 6409Assert.Equal("(var y, int z)", yz.ToString()); 6414Assert.Equal("var y", y.ToString()); 6445Assert.Equal("(_, _)", tuple.ToString()); 6862Assert.Equal("string _", declaration1.ToString()); 6868Assert.Equal("alias _", declaration2.ToString()); 6873Assert.Equal("(string _, alias _)", tuple.ToString()); 6934Assert.Equal("var (_, x3)", nestedDeclaration.ToString()); 6941Assert.Equal("(var _, var (_, x3))", tuple.ToString()); 6980Assert.Equal("var _", declaration1.ToString()); 6989Assert.Equal("int _", declaration2.ToString()); 6994Assert.Equal("_", discard3.Parent.ToString()); 7008Assert.Equal("var (_, _)", nestedDeclaration.ToString()); 7239Assert.Equal(@"(int x1, z)", lhs.ToString()); 7521Assert.Equal(@"(int x, (y, var z))", lhs.ToString()); 8360Assert.Equal("((int, int))(y, b)", node.ToString()); 8587Assert.Equal("((byte, byte))(new C(), new D())", node.ToString()); 8631Assert.Equal("((int, int))(1L, 2L)", node.ToString()); 8651Assert.Equal("((short, short))((int, int))(1L, 2L)", node.Parent.ToString()); 9011Assert.Equal("var (y1, y2) =", node.ToString());
CodeGen\CodeGenFunctionPointersTests.cs (1)
7417Assert.Equal("a => a", lambda.ToString());
CodeGen\CodeGenTupleEqualityTests.cs (68)
363Assert.Equal("(x, x)", tupleX.ToString()); 368Assert.Equal("x", lastX.ToString()); 382Assert.Equal("(y, y)", tupleY.ToString()); 386Assert.Equal("y", lastY.ToString()); 717Assert.Equal("t", t.ToString()); 727Assert.Equal("(1L, 2)", tuple.ToString()); 794Assert.Equal("(s, null)", tuple1.ToString()); 807Assert.Equal("(null, s)", tuple2.ToString()); 858Assert.Equal("t1", t1.ToString()); 867Assert.Equal("(1L, 2)", tuple.ToString()); 875Assert.Equal("2", two.ToString()); 906Assert.Equal("t1", t1.ToString()); 915Assert.Equal("(1L, 2)", tuple.ToString()); 923Assert.Equal("2", two.ToString()); 955Assert.Equal("t1", t1.ToString()); 965Assert.Equal("(1L, t2)", tuple.ToString()); 971Assert.Equal("t2", t2.ToString()); 1002Assert.Equal("(null, null)", tuple.ToString()); 1010Assert.Equal("(1, (null, null))", lastTuple.ToString()); 1060Assert.Equal("default", literal.ToString()); 1094Assert.Equal("default", literal.ToString()); 1126Assert.Equal("default", literal.ToString()); 1157Assert.Equal("default", literal.ToString()); 1313Assert.Equal("(default, default)", lastTuple.ToString()); 1318Assert.Equal("default", lastDefault.ToString()); 1400Assert.Equal("null", nullLiteral.ToString()); 1404Assert.Equal("null", nullLiteral2.ToString()); 1413Assert.Equal("default", defaultLiteral.ToString()); 1469Assert.Equal("default", defaultLiteral.ToString()); 1498Assert.Equal("((null, null), t)", tuple.ToString()); 1507Assert.Equal("t", t.ToString()); 1518Assert.Equal("(null, null)", nestedTuple.ToString()); 1529Assert.Equal("null", nestedNull.ToString()); 1560Assert.Equal("null", literal.ToString()); 1569Assert.Equal("(null, null)", tuple.ToString()); 1595Assert.Equal("2", lastLiteral.ToString()); 1620Assert.Equal("((null, 2), null)", rightTuple.ToString()); 1626Assert.Equal("(null, 2)", nestedTuple.ToString()); 1632Assert.Equal("2", two.ToString()); 1676Assert.Equal("(null, null, null, null)", tuple1.ToString()); 1684Assert.Equal("(null, x => x, Main, (int i) => { int j = 0; return i + j; })", tuple2.ToString()); 1708Assert.Equal("i + j", addition.ToString()); 1777Assert.Equal("(s, s)", tuple1.ToString()); 1783Assert.Equal("(1, () => { })", tuple2.ToString()); 1919Assert.Equal("(d1, null)", tuple1.ToString()); 1925Assert.Equal("(null, d2)", tuple2.ToString()); 2576Assert.Equal("(0, 1)", intTuple.ToString()); 2584Assert.Equal("(this, this)", lastTuple.ToString()); 2644Assert.Equal("t1", t1.ToString()); 3281Assert.Equal("nt1", nt1.ToString()); 3287Assert.Equal("nt2", nt2.ToString()); 3687Assert.Equal("nt1", nt1.ToString()); 3693Assert.Equal("nt2", nt2.ToString()); 3811Assert.Equal("nt1", nt1.ToString()); 3817Assert.Equal("nt2", nt2.ToString()); 3914Assert.Equal("nt1", nt1.ToString()); 3920Assert.Equal("nt2", nt2.ToString()); 4039Assert.Equal("(1, 2)", tuple.ToString()); 4045Assert.Equal("nt", nt.ToString()); 4084Assert.Equal("(1, 2) == nt", comparison.ToString()); 4087Assert.Equal("(1, 2)", tuple.ToString()); 4093Assert.Equal("nt", nt.ToString()); 4185Assert.Equal("null", lastNull.ToString()); 4277Assert.Equal("t.Rest == t.Rest", comparison.ToString()); 5162Assert.Equal("((string, (byte, long))) (null, (1, 2L))", leftCast.ToString()); 5170Assert.Equal("(null, (1, 2L))", leftTuple.ToString()); 5178Assert.Equal("null", leftNull.ToString()); 5186Assert.Equal("(1, 2L)", leftNestedTuple.ToString());
CodeGen\CodeGenTupleTest.cs (72)
1612Assert.Equal(@"(1, ""hello"", c: 2)", node.ToString()); 4156var node = nodes.OfType<MemberAccessExpressionSyntax>().Where(n => n.ToString() == "x.Rest").First(); 4840Assert.Equal("i.M((null, null))", invocation1.ToString()); 4845Assert.Equal("c.M((null, null))", invocation2.ToString()); 5076Assert.Equal("d.M((1, 2))", invocation.ToString()); 5120Assert.Equal("d.M((1, 2))", invocation.ToString()); 5161Assert.Equal("d.P", memberAccess.ToString()); 5165Assert.Equal("this.P", memberAccess2.ToString()); 5169Assert.Equal("base.P", memberAccess3.ToString()); 5205Assert.Equal("d.E()", invocation.ToString()); 7499Assert.Equal("((int, string)?) (1, null)", value.ToString()); 7503Assert.Equal("(1, null)", tuple.ToString()); 7532Assert.Equal("(1, null)", value.ToString()); 7571Assert.Equal("(1, null)", tuple1.ToString()); 7580Assert.Equal("(2, null)", tuple2.ToString()); 7589Assert.Equal("(3, null)", tuple3.ToString()); 7637Assert.Equal(expected, tuple.ToString()); 8294Assert.Equal(@"(e: 1, f: ""hello"")", node.ToString()); 8326Assert.Equal(@"11", l11.ToString()); 8333Assert.Equal(@"(e: 1, f: ""hello"")", node.ToString()); 8380Assert.Equal(@"(1, ""hello"")", node.ToString()); 8409Assert.Equal(@"(e: 1, f: ""hello"")", node.ToString()); 8438Assert.Equal(@"(e: 1, f: ""hello"")", node.ToString()); 8486Assert.Equal(@"((long c, string d))(x)", node.ToString()); 8493Assert.Equal(@"(x)", node.ToString()); 8520Assert.Equal(@"((long c, string d))(x)", node.ToString()); 8527Assert.Equal(@"(x)", node.ToString()); 8553Assert.Equal(@"(e: 1, f: ""hello"")", node.ToString()); 8582Assert.Equal(@"(e: 1, f: ""hello"")", node.ToString()); 8629Assert.Equal(@"(e: 1, f: ""hello"")", node.ToString()); 8664Assert.Equal(@"(e: 1, f: ""hello"")", node.ToString()); 8693Assert.Equal(@"(e: 1, f: ""hello"")", node.ToString()); 8722Assert.Equal(@"(e: 1, f: ""hello"")", node.ToString()); 8753Assert.Equal(@"11", l11.ToString()); 8760Assert.Equal(@"(e: 1, f: ""hello"")", node.ToString()); 8807Assert.Equal(@"(e: 1, f: null)", node.ToString()); 8838Assert.Equal(@"null", lnull.ToString()); 8845Assert.Equal(@"(e: 1, f: null)", node.ToString()); 8896Assert.Equal(@"(e: 1, f: new C1(""qq""))", node.ToString()); 8943Assert.Equal(@"(e: 1, f: new C1(""qq""))", node.ToString()); 9016Assert.Equal(@"(1, ""qq"")", node.ToString()); 9073Assert.Equal(@"(""1"", ""qq"")", node.ToString()); 9145Assert.Equal(@"(1, ""qq"")", node.ToString()); 9226Assert.Equal(@"(1, ""qq"")", node.ToString()); 9309Assert.Equal(@"(1, null)", node.ToString()); 16542Assert.Equal(@"(1, ""hello"")", node.ToString()); 17214Assert.Equal(@"(1, ""hello"")", n1.ToString()); 17221Assert.Equal(@"(2, null)", n2.ToString()); 17228Assert.Equal(@"11", n3.ToString()); 17235Assert.Equal(@"null", n4.ToString()); 17242Assert.Equal(@"() => 12", n5.ToString()); 17275Assert.Equal(@"(1, ""hello"")", n1.ToString()); 17282Assert.Equal(@"(2, null)", n2.ToString()); 17289Assert.Equal(@"11", n3.ToString()); 17296Assert.Equal(@"null", n4.ToString()); 17303Assert.Equal(@"() => 12", n5.ToString()); 17334Assert.Equal(@"(1, ""hello"")", n1.ToString()); 17341Assert.Equal(@"(2, null)", n2.ToString()); 17404Assert.Equal("x1.Bob", x1Bob.ToString()); 17437Assert.Equal("x1 = (Bob, Bob)", x1.ToString()); 24184Assert.Equal("tuple.elem2 = 23", nodes[0].Parent.Parent.ToString()); 24187Assert.Equal("elem2 = 10", nodes[1].Parent.ToString()); 24190Assert.Equal("(tuple.elem2)", nodes[2].Parent.Parent.Parent.ToString()); 24193Assert.Equal("(elem2)", nodes[3].Parent.Parent.ToString()); 25054Assert.Equal("()", y.ToString()); 25059Assert.Equal("(int a)", z.ToString()); 25085Assert.Equal("(Alice: 1)", tuple.ToString()); 26226Assert.Equal("(A: 0, B: null)", node.ToString()); 26296Assert.Equal("impl.Do(((int x, int y) a) => a.x * a.y)", doSyntax.ToString()); 26329Assert.Equal("impl.Do(((int x, int y) a) => a.x * a.y)", doSyntax.ToString()); 26362Assert.Equal("impl.Do(((int, int) a) => a.Item1 * a.Item2)", doSyntax.ToString()); 26395Assert.Equal("impl.Do((dynamic a) => 1)", doSyntax.ToString());
CodeGen\IndexAndRangeTests.cs (2)
3861Assert.Equal("c", receivers[0].ToString()); 3864Assert.Equal("c", receivers[1].ToString());
CodeGen\ObjectAndCollectionInitializerTests.cs (2)
1108Assert.Equal("new A {[x++] = { } }", node.ToString()); 3590Assert.Equal("new C(pp) { X = {[Index] = {[0] = 2, [1] = 3} } }", node.ToString());
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (23)
CodeGen\IndexAndRangeTests.cs (18)
92Assert.Equal("new Buffer10() { [Id(^1)] = Id(2) }", node.ToString()); 333Assert.Equal("new Buffer10() { [Id(^1)] = { F = { } } }", node.ToString()); 420Assert.Equal("new Buffer10() { [Id(^1)] = { F = { } } }", node.ToString()); 507Assert.Equal("new Buffer10() { [Id(^1)] = { F = { } } }", node.ToString()); 625Assert.Equal("new C() { F = {[Id(^1)] = Id(42), [Id(^2)] = Id(43)} }", node.ToString()); 1574Assert.Equal("new Buffer10Container() { [i1] = { [i2] = 42, [i3] = 43 } }", node.ToString()); 1809Assert.Equal("new Buffer10() { [Id(i1)] = { X = Id(1) }, [Id(i2)] = { }, [Id(i3)] = { X = Id(2) } }", node.ToString()); 2264Assert.Equal("new C() { F = { [Id(r)] = { [Id(1)] = Id(42), [Id(2)] = Id(43) } } }", node.ToString()); 2679Assert.Equal("new C() { F = { [Id(r)] = { [Id(r2)] = { } } } }", node.ToString()); 2842Assert.Equal("new C() { F = { [Id(r)] = { [Id(r2)] = { }, [Id(r3)] = { [Id(i4)] = Id(i5) } } } }", node.ToString()); 3020Assert.Equal("new C() { F = { [Id(i1)] = { [Id(i2)] = { } } } }", node.ToString()); 3134Assert.Equal("new C() { F = { [Id(i1)] = { [Id(i2)] = { }, [Id(i3)] = { [Id(i4)] = Id(i5) } } } }", node.ToString()); 3305Assert.Equal("new C() { F = { [Id(r1)] = { [Id(r2)] = { } } } }", node.ToString()); 3456Assert.Equal("new C() { F = { [Id(r1)] = { [Id(0)] = { X = Id(42) } } } }", node.ToString()); 3642Assert.Equal("new C(pp) { F = { [Id(0)] = { [Id(1)] = { } } } }", node.ToString()); 3732Assert.Equal("new C() { F = { [Id(0)] = { [Id(1)] = { } } } }", node.ToString()); 3818Assert.Equal("new C() { [Id(0)] = { [Id(1)] = { } } }", node.ToString()); 3891Assert.Equal("new C() { [Id(0)] = { [Id(1)] = { }, [Id(2)] = { F = Id(3) } } }", node.ToString());
Emit\NumericIntPtrTests.cs (5)
11174Assert.Equal(type, cref.ToString()); 11197Assert.Equal("nint", cref.ToString()); 11225Assert.Equal(fieldName, cref.ToString()); 11250Assert.Equal("@nint", cref.ToString()); 11295Assert.Equal("nint.Zero", cref.ToString());
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (355)
Attributes\AttributeTests.cs (31)
591Assert.Equal("a: true", attributeData.GetAttributeArgumentSyntax(parameterIndex: 0).ToString()); 592Assert.Equal(@"b: new object[] { ""Hello"", ""World"" }", attributeData.GetAttributeArgumentSyntax(parameterIndex: 1).ToString()); 622Assert.Equal("a: 2", attributeData.GetAttributeArgumentSyntax(parameterIndex: 0).ToString()); 623Assert.Equal("b: 0", attributeData.GetAttributeArgumentSyntax(parameterIndex: 1).ToString()); 624Assert.Equal("c: 1", attributeData.GetAttributeArgumentSyntax(parameterIndex: 2).ToString()); 1125Assert.Equal(@"a: true", attributeData.GetAttributeArgumentSyntax(parameterIndex: 0).ToString()); 1126Assert.Equal(@"b: new object[] { ""Hello"", ""World"" }", attributeData.GetAttributeArgumentSyntax(parameterIndex: 1).ToString()); 1129Assert.Equal(@"true", attributeData.GetAttributeArgumentSyntax(parameterIndex: 0).ToString()); 1130Assert.Equal(@"""Hello""", attributeData.GetAttributeArgumentSyntax(parameterIndex: 1).ToString()); 1133Assert.Equal(@"false", attributeData.GetAttributeArgumentSyntax(parameterIndex: 0).ToString()); 1134Assert.Equal(@"""World""", attributeData.GetAttributeArgumentSyntax(parameterIndex: 1).ToString()); 1137Assert.Equal(@"true", attributeData.GetAttributeArgumentSyntax(parameterIndex: 0).ToString()); 1138Assert.Equal(@"Mark", attributeData.GetAttributeArgumentSyntax(parameterIndex: 1).ToString()); 1141Assert.Equal(@"a: true", attributeData.GetAttributeArgumentSyntax(parameterIndex: 0).ToString()); 1142Assert.Equal(@"Mark", attributeData.GetAttributeArgumentSyntax(parameterIndex: 1).ToString()); 1145Assert.Equal(@"a: false", attributeData.GetAttributeArgumentSyntax(parameterIndex: 0).ToString()); 1146Assert.Equal(@"b: ""M5""", attributeData.GetAttributeArgumentSyntax(parameterIndex: 1).ToString()); 1149Assert.Equal(@"a: true", attributeData.GetAttributeArgumentSyntax(parameterIndex: 0).ToString()); 1150Assert.Equal(@"b: ""M6""", attributeData.GetAttributeArgumentSyntax(parameterIndex: 1).ToString()); 1189Assert.Equal(@"a: true", attributeData.GetAttributeArgumentSyntax(parameterIndex: 0).ToString()); 1190Assert.Equal(@"b: ""Hello""", attributeData.GetAttributeArgumentSyntax(parameterIndex: 1).ToString()); 1228Assert.Equal(@"true", attributeData.GetAttributeArgumentSyntax(parameterIndex: 0).ToString()); 1229Assert.Equal(@"new object[] { ""Hello"" }", attributeData.GetAttributeArgumentSyntax(parameterIndex: 1).ToString()); 1267Assert.Equal(@"a: true", attributeData.GetAttributeArgumentSyntax(parameterIndex: 0).ToString()); 1268Assert.Equal(@"new object[] { ""Hello"" }", attributeData.GetAttributeArgumentSyntax(parameterIndex: 1).ToString()); 1305Assert.Equal(@"a: true", attributeData.GetAttributeArgumentSyntax(parameterIndex: 0).ToString()); 1306Assert.Equal(@"b: null", attributeData.GetAttributeArgumentSyntax(parameterIndex: 1).ToString()); 7581Assert.Equal("T", typeofArgSyntax.ToString()); 11638Assert.Equal("SomeProperty = 1", firstArgument.ToString()); 11642Assert.Equal("F = null", secondArgument.ToString()); 11646Assert.Equal("G = 0 switch { _ => 1 }", thirdArgument.ToString());
Diagnostics\DiagnosticAnalyzerTests.cs (2)
2323sortedCallbackEntityNames.Add($"Node: {syntaxContext.Node.ToString()}"); 2343ReportDiagnosticsCore(addDiagnostic, node.Location, $"Node: {node.ToString()}");
Diagnostics\GetDiagnosticsTests.cs (5)
1550Assert.Equal("int x11 = 0;", localDecl.ToString()); 1637AssertEx.SetEqual(expectedSyntaxNodeCallbacks, analyzer.AnalyzedSyntaxNodes.Select(s => s.ToString()).ToHashSet()); 1641AssertEx.SetEqual(expectedSyntaxNodeInsideBlockCallbacks, analyzer.AnalyzedSyntaxNodesInsideCodeBlock.Select(s => s.ToString()).ToHashSet()); 1646AssertEx.SetEqual(expectedOperationCallbacks, analyzer.AnalyzedOperations.Select(op => op.Syntax.ToString()).ToHashSet()); 1650AssertEx.SetEqual(expectedOperationInsideBlockCallbacks, analyzer.AnalyzedOperationsInsideOperationBlock.Select(op => op.Syntax.ToString()).ToHashSet());
FieldKeywordTests.cs (2)
10496Assert.Equal("return field;", expr.Parent.ToString()); 10530Assert.Equal("return field;", expr.Parent.ToString());
FirstClassSpanTests.cs (4)
2824Assert.Equal("arg", arg!.ToString()); 2861Assert.Equal("(ReadOnlySpan<T>)x", cast.ToString()); 2877Assert.Equal("(ReadOnlySpan<U>)x", cast.ToString()); 5004.First(s => s.Expression.ToString() == "a");
FlowAnalysis\RegionAnalysisTests.cs (3)
4526var stmt1 = tree.GetCompilationUnitRoot().DescendantNodesAndSelf().OfType<StatementSyntax>().Where(n => n.ToString() == "IntPtr p;").Single(); 4527var stmt2 = tree.GetCompilationUnitRoot().DescendantNodesAndSelf().OfType<StatementSyntax>().Where(n => n.ToString().StartsWith(keyword)).First(); 6382Assert.Equal("this.EditorOperations = 1;", statement.ToString());
RefStructInterfacesTests.cs (5)
7985Assert.Equal("new S()", foreachSyntax.Expression.ToString()); 11067Assert.Equal("new S1()", foreachSyntax.Expression.ToString()); 14966AssertEx.Equal("new S()", foreachSyntax.Expression.ToString()); 18183AssertEx.Equal("new S()", foreachSyntax.Expression.ToString()); 21306AssertEx.Equal("x = default", declarator.ToString());
Semantics\CollectionExpressionTests.cs (5)
28880Assert.Equal("[..values]", collection.ToString()); 29203Assert.Equal("[]", collection.ToString()); 29246Assert.Equal("[1, 2, 3]", collections[0].ToString()); 29251Assert.Equal("[]", collections[1].ToString()); 29293Assert.Equal("[1, 2, 3]", collection.ToString());
Semantics\InlineArrayTests.cs (17)
2360Assert.Equal("b[c]", c.Parent.Parent.Parent.ToString()); 2395Assert.Equal("b[c]", c.Parent.Parent.Parent.ToString()); 2429Assert.Equal("b[c]", c.Parent.Parent.Parent.ToString()); 2509Assert.Equal("x.F[0]", f.Parent.Parent.ToString()); 6034Assert.Equal("x.F[^10]", f.Parent.Parent.ToString()); 6200Assert.Equal("x.F[..5]", f.Parent.Parent.ToString()); 8119Assert.Equal("[0]", f.ToString()); 8836Assert.Equal("M3()[0]", m3.Parent.ToString()); 9204Assert.Equal("M3()[..]", m3.Parent.Parent.ToString()); 10548Assert.Equal("c.F[0]", f.Parent.Parent.ToString()); 11292Assert.Equal("c.F[..5]", f.Parent.Parent.ToString()); 15210Assert.Equal("=> x.F", f[^2].Parent.Parent.ToString()); 15217Assert.Equal("=> x.F", f[^1].Parent.Parent.ToString()); 16497Assert.Equal("M3()", m3.ToString()); 18584Assert.Equal("x.F", f.ToString()); 18910Assert.Equal("x.F", f.ToString()); 19247Assert.Equal("GetBuffer(x)", collection.ToString());
Semantics\OutVarTests.cs (44)
20052Assert.Equal("System.Console.WriteLine(y)", yRef[2].Parent.Parent.Parent.ToString()); 32983Assert.Equal("int _", declaration1.ToString()); 32992Assert.Equal("var _", declaration2.ToString()); 33067Assert.Equal("int _", declaration1.ToString()); 33071Assert.Equal("int", declaration1.Type.ToString()); 33083Assert.Equal("var _", declaration2.ToString()); 33087Assert.Equal("var", declaration2.Type.ToString()); 33139Assert.Equal("long _", declaration1.ToString()); 33143Assert.Equal("long", declaration1.Type.ToString()); 33181Assert.Equal("alias1 _", declaration1.ToString()); 33185Assert.Equal("alias1", declaration1.Type.ToString()); 33197Assert.Equal("var _", declaration2.ToString()); 33201Assert.Equal("var", declaration2.Type.ToString()); 33245Assert.Equal("alias1 _", declaration1.ToString()); 33249Assert.Equal("alias1", declaration1.Type.ToString()); 33261Assert.Equal("var _", declaration2.ToString()); 33266Assert.Equal("var", declaration2.Type.ToString()); 33506var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.ToString() == "x").Single(); 33507Assert.Equal("x", x.ToString()); 35180Assert.Equal("var", varType.ToString()); 35219Assert.Equal("var", varType.ToString()); 35263Assert.Equal("var", varType.ToString()); 35294Assert.Equal("var", varType.ToString()); 35333Assert.Equal("var", varType.ToString()); 35365Assert.Equal("var", varType.ToString()); 35401Assert.Equal("var", varType.ToString()); 35440Assert.Equal("var", varType.ToString()); 35470Assert.Equal("var", varType.ToString()); 35507Assert.Equal("var", varType.ToString()); 35854Assert.Equal("new T(out var z)", node.ToString()); 35900Assert.Equal("new T(out var z) {F1 = 1}", node.ToString()); 35984Assert.Equal(": this(out var x)", initializerSyntax.ToString()); 36003Assert.Equal("{ M(out var y); }", blockBodySyntax.ToString()); 36028Assert.Equal("=> M(out var z)", expressionBodySyntax.ToString()); 36124Assert.Equal("=> M(out var y)", expressionBodySyntax.ToString()); 36148Assert.Equal("{return M(out var x);}", blockBodySyntax.ToString()); 36172Assert.Equal("=> M(out var z)", propertyExpressionBodySyntax.ToString()); 36232Assert.Equal("=> M(out var z)", node3.ToString()); 36367Assert.Equal("M2(out var x)", invocation.ToString()); 36413Assert.Equal("M2(out var x)", invocation.ToString()); 36453Assert.Equal("M2(out var x)", invocation.ToString()); 36495Assert.Equal(@"M2(out var a, ""b"")", invocation.ToString()); 36530Assert.Equal("M2(out var x)", invocation.ToString()); 36568Assert.Equal(@"M2(out var a, ""b"")", invocation.ToString());
Semantics\ParamsCollectionTests.cs (3)
121Assert.Equal("Test()", nodes[0].ToString()); 134Assert.Equal("Test(1)", nodes[1].ToString()); 150Assert.Equal("Test(2, 3)", nodes[2].ToString());
Semantics\PatternMatchingTests.cs (5)
3579Assert.Equal("o.Equals is()", node.ToString()); 4294Assert.Equal("int _", declaration1.ToString()); 4302Assert.Equal("var _", declaration2.ToString()); 4308Assert.Equal("int _", declaration3.ToString()); 4315Assert.Equal("var _", declaration4.ToString());
Semantics\PatternMatchingTests_ListPatterns.cs (5)
3643Assert.Equal(syntax, designation.ToString()); 3688Assert.Equal(syntax, clause.Parent.Parent.ToString()); 3723Assert.Equal("item", itemDesignation.ToString()); 3738Assert.Equal("slice", sliceDesignation.ToString()); 4413Assert.Equal(syntax, designation.ToString());
Semantics\PatternMatchingTests2.cs (17)
2021Assert.Equal("return obj is global::Class1 @class && this.i == @class.i;", returnStatement.ToString()); 2023Assert.Equal("return obj is Class1 @class && this.i == @class.i;", modifiedReturnStatement.ToString()); 2062Assert.Equal("return obj is global::Class1 @class;", returnStatement.ToString()); 2064Assert.Equal("return obj is Class1 @class;", modifiedReturnStatement.ToString()); 2164Assert.Equal(ex.Source, pat.ToString()); 2254Assert.Equal("T2 (var t3, t4: T4 t4) { V5 : T6 t5 }", patterns[0].ToString()); 2259Assert.Equal("var t3", patterns[1].ToString()); 2264Assert.Equal("T4 t4", patterns[2].ToString()); 2269Assert.Equal("T6 t5", patterns[3].ToString()); 2298Assert.Equal("Point(3, 4.0)", patterns[0].ToString()); 2303Assert.Equal("3", patterns[1].ToString()); 2308Assert.Equal("4.0", patterns[2].ToString()); 2344Assert.Equal("Point(3, 4.0) { Missing: Xyzzy }", patterns[0].ToString()); 2349Assert.Equal("3", patterns[1].ToString()); 2355Assert.Equal("4.0", patterns[2].ToString()); 2361Assert.Equal("Xyzzy", patterns[3].ToString()); 2368Assert.Equal("Q7 t", patterns[4].ToString());
Semantics\PatternMatchingTests3.cs (53)
4116Assert.Equal("((N, N))", pattern.ToString()); 4122Assert.Equal("(N, N)", pattern.ToString()); 4129Assert.Equal("N", pattern.ToString()); 4138Assert.Equal("(((long), (long)))", pattern.ToString()); 4144Assert.Equal("((long), (long))", pattern.ToString()); 4151Assert.Equal("(long)", pattern.ToString()); 4158Assert.Equal("long", pattern.ToString()); 4165Assert.Equal("(int, int)", pattern.ToString()); 4173Assert.Equal("int", pattern.ToString()); 4180Assert.Equal("(System.Int64, System.Int32)", pattern.ToString()); 4186Assert.Equal("System.Int64", pattern.ToString()); 4193Assert.Equal("System.Int32", pattern.ToString()); 4200Assert.Equal("(>= A and <= Z) or (>= a and <= z)", pattern.ToString()); 4206Assert.Equal("(>= A and <= Z)", pattern.ToString()); 4212Assert.Equal(">= A and <= Z", pattern.ToString()); 4218Assert.Equal(">= A", pattern.ToString()); 4225Assert.Equal("<= Z", pattern.ToString()); 4232Assert.Equal("(>= a and <= z)", pattern.ToString()); 4238Assert.Equal(">= a and <= z", pattern.ToString()); 4244Assert.Equal(">= a", pattern.ToString()); 4251Assert.Equal("<= z", pattern.ToString()); 4258Assert.Equal("not (> c0 and < c9)", pattern.ToString()); 4264Assert.Equal("(> c0 and < c9)", pattern.ToString()); 4270Assert.Equal("> c0 and < c9", pattern.ToString()); 4276Assert.Equal("> c0", pattern.ToString()); 4283Assert.Equal("< c9", pattern.ToString()); 4343Assert.Equal("((N, N))", pattern.ToString()); 4349Assert.Equal("(N, N)", pattern.ToString()); 4356Assert.Equal("N", pattern.ToString()); 4365Assert.Equal("(((long), (long)))", pattern.ToString()); 4371Assert.Equal("((long), (long))", pattern.ToString()); 4378Assert.Equal("(long)", pattern.ToString()); 4385Assert.Equal("long", pattern.ToString()); 4392Assert.Equal("((N))", pattern.ToString()); 4400Assert.Equal("(int, int)", pattern.ToString()); 4407Assert.Equal("int", pattern.ToString()); 4414Assert.Equal("(System.Int64, System.Int32)", pattern.ToString()); 4420Assert.Equal("System.Int64", pattern.ToString()); 4427Assert.Equal("System.Int32", pattern.ToString()); 4434Assert.Equal("(>= A and <= Z) or (>= a and <= z)", pattern.ToString()); 4440Assert.Equal("(>= A and <= Z)", pattern.ToString()); 4446Assert.Equal(">= A and <= Z", pattern.ToString()); 4452Assert.Equal(">= A", pattern.ToString()); 4459Assert.Equal("<= Z", pattern.ToString()); 4466Assert.Equal("(>= a and <= z)", pattern.ToString()); 4472Assert.Equal(">= a and <= z", pattern.ToString()); 4478Assert.Equal(">= a", pattern.ToString()); 4485Assert.Equal("<= z", pattern.ToString()); 4492Assert.Equal("not (> c0 and < c9)", pattern.ToString()); 4498Assert.Equal("(> c0 and < c9)", pattern.ToString()); 4504Assert.Equal("> c0 and < c9", pattern.ToString()); 4510Assert.Equal("> c0", pattern.ToString()); 4517Assert.Equal("< c9", pattern.ToString());
Semantics\PatternMatchingTests4.cs (1)
4829Assert.Equal("x", x.ToString());
Semantics\PatternSwitchTests.cs (4)
1515var sRef = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.ToString() == "s").Single(); 1517var iRef = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.ToString() == "i").Single(); 1519var s2Ref = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.ToString() == "s2").Single(); 1521var i2Ref = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.ToString() == "i2").Single();
Semantics\PrimaryConstructorTests.cs (82)
422Assert.Equal("int x", parameters[0].ToString()); 425Assert.Equal("string y", parameters[1].ToString()); 1008Assert.Equal("= X", x.Parent.ToString()); 1073Assert.Equal("Base(X, Y)", x.Parent.Parent.Parent.ToString()); 1086Assert.Equal("Base(X, Y)", baseWithargs.ToString()); 1186Assert.Equal("= 123", equalsValue.ToString()); 1195Assert.Equal(": this(X, Y)", baseWithargs.ToString()); 1222Assert.Equal("= 124", equalsValue.ToString()); 1301Assert.Equal("Test(X, out var y)", x.Parent.Parent.Parent.ToString()); 1312Assert.Equal("y", y.Parent.ToString()); 1313Assert.Equal("(Test(X, out var y), y)", y.Parent.Parent.ToString()); 1314Assert.Equal("Base(Test(X, out var y), y)", y.Parent.Parent.Parent.ToString()); 1325Assert.Equal("(Test(X, out var y), y)", test.Parent.Parent.Parent.ToString()); 1366Assert.Equal("Base(X, Y)", x.Parent.Parent.Parent.ToString()); 1412Assert.Equal("Base(X, Y)", x.Parent.Parent.Parent.ToString()); 1472Assert.Equal("Base(X, Y)", x.Parent.Parent.Parent.ToString()); 1530Assert.Equal("Base(X, Y)", x.Parent.Parent.Parent.ToString()); 1541Assert.Equal("Base(X, Y)", x.Parent.Parent.Parent.ToString()); 1619Assert.Equal("Base(X, Y)", x.Parent.Parent.Parent.ToString()); 1630Assert.Equal("Base(X, Y)", x.Parent.Parent.Parent.ToString()); 1815Assert.Equal("Base(X)", x.Parent.Parent.Parent.ToString()); 1855Assert.Equal("Base(X)", x.Parent.Parent.Parent.ToString()); 1898Assert.Equal("Base(X)", x.Parent.Parent.Parent.ToString()); 1968Assert.Equal("Base(X, Y)", x.Parent.Parent.Parent.ToString()); 2119Assert.Equal("Base(GetInt(X, out var xx) + xx, Y)", baseWithargs.ToString()); 2222Assert.Equal(": this(X, Y, Z, 1)", baseWithargs.ToString()); 2301Assert.Equal("Base(GetInt(X, out var xx) + xx, Y)", baseWithargs.ToString()); 2361Assert.Equal(": base(X, Y, Z, 1)", baseWithargs.ToString()); 2426Assert.Equal("Base(X)", x.Parent.Parent.Parent.ToString()); 2475Assert.Equal("Error1(0, 1)", baseWithargs.ToString()); 2479Assert.Equal("Error1(0)", speculativeBase.ToString()); 2485Assert.Equal("Error2()", baseWithoutargs.ToString()); 2490Assert.Equal("Error3", baseWithoutParens.ToString()); 2642Assert.Equal("= X + 1", x.Parent.Parent.ToString()); 2680Assert.Equal("= X + 1", x.Parent.Parent.ToString()); 2717Assert.Equal("= X + 1", x.Parent.Parent.ToString()); 2753Assert.Equal("() => X + 1", x.Parent.Parent.ToString()); 3770switch (literal.ToString()) 3809switch (equalsValue.ToString()) 3835switch (initializer.ToString()) 3859switch (baseType.ToString()) 3914switch (identifier.Parent.ToString()) 3949switch (baseType.ToString()) 3993switch (parameterList.ToString()) 4019switch (argumentList.ToString()) 4386switch (context.Operation.Syntax.ToString()) 4432switch (context.Operation.Syntax.ToString()) 4516Assert.Equal("= 0", context.OperationBlocks[0].Syntax.ToString()); 4519Assert.Equal("Attr1(100)", context.OperationBlocks[1].Syntax.ToString()); 4527Assert.Equal("= 1", context.OperationBlocks[0].Syntax.ToString()); 4530Assert.Equal("Attr2(200)", context.OperationBlocks[1].Syntax.ToString()); 4533Assert.Equal("A(2)", context.OperationBlocks[2].Syntax.ToString()); 4541Assert.Equal("= 4", context.OperationBlocks[0].Syntax.ToString()); 4544Assert.Equal("Attr3(300)", context.OperationBlocks[1].Syntax.ToString()); 4549Assert.Equal(": base(5)", context.OperationBlocks[3].Syntax.ToString()); 4650Assert.Equal("= 0", context.OperationBlocks[0].Syntax.ToString()); 4653Assert.Equal("Attr1(100)", context.OperationBlocks[1].Syntax.ToString()); 4663Assert.Equal("= 1", context.OperationBlocks[0].Syntax.ToString()); 4666Assert.Equal("Attr2(200)", context.OperationBlocks[1].Syntax.ToString()); 4669Assert.Equal("A(2)", context.OperationBlocks[2].Syntax.ToString()); 4679Assert.Equal("= 4", context.OperationBlocks[0].Syntax.ToString()); 4682Assert.Equal("Attr3(300)", context.OperationBlocks[1].Syntax.ToString()); 4687Assert.Equal(": base(5)", context.OperationBlocks[3].Syntax.ToString()); 4724Assert.Equal("= 0", context.OperationBlocks[0].Syntax.ToString()); 4727Assert.Equal("Attr1(100)", context.OperationBlocks[1].Syntax.ToString()); 4735Assert.Equal("= 1", context.OperationBlocks[0].Syntax.ToString()); 4738Assert.Equal("Attr2(200)", context.OperationBlocks[1].Syntax.ToString()); 4741Assert.Equal("A(2)", context.OperationBlocks[2].Syntax.ToString()); 4749Assert.Equal("= 4", context.OperationBlocks[0].Syntax.ToString()); 4752Assert.Equal("Attr3(300)", context.OperationBlocks[1].Syntax.ToString()); 4757Assert.Equal(": base(5)", context.OperationBlocks[3].Syntax.ToString()); 5272switch (literal.ToString()) 5298switch (equalsValue.ToString()) 5316switch (initializer.ToString()) 5376switch (baseType.ToString()) 5403switch (parameterList.ToString()) 5425switch (argumentList.ToString()) 5713switch (context.Operation.Syntax.ToString()) 5731switch (context.Operation.Syntax.ToString()) 5791Assert.Equal("= 0", context.OperationBlocks[0].Syntax.ToString()); 5794Assert.Equal("Attr1(100)", context.OperationBlocks[1].Syntax.ToString()); 19773Assert.Equal("c[2]", indexer.ToString());
Semantics\RecordTests.cs (67)
2490Assert.Equal("X", x.ToString()); 8610var xId = withExpr.DescendantNodes().Single(id => id.ToString() == "X"); 21145Assert.Equal("Base(X, Y)", x.Parent!.Parent!.Parent!.ToString()); 21158Assert.Equal("Base(X, Y)", baseWithargs.ToString()); 21259Assert.Equal("= 123", equalsValue.ToString()); 21269Assert.Equal(": this(X, Y)", baseWithargs.ToString()); 21296Assert.Equal("= 124", equalsValue.ToString()); 21375Assert.Equal("Test(X, out var y)", x.Parent!.Parent!.Parent!.ToString()); 21386Assert.Equal("y", y.Parent!.ToString()); 21387Assert.Equal("(Test(X, out var y), y)", y.Parent!.Parent!.ToString()); 21388Assert.Equal("Base(Test(X, out var y), y)", y.Parent!.Parent!.Parent!.ToString()); 21399Assert.Equal("(Test(X, out var y), y)", test.Parent!.Parent!.Parent!.ToString()); 21440Assert.Equal("Base(X, Y)", x.Parent!.Parent!.Parent!.ToString()); 21486Assert.Equal("Base(X, Y)", x.Parent!.Parent!.Parent!.ToString()); 21546Assert.Equal("Base(X, Y)", x.Parent!.Parent!.Parent!.ToString()); 21604Assert.Equal("Base(X, Y)", x.Parent!.Parent!.Parent!.ToString()); 21615Assert.Equal("Base(X, Y)", x.Parent!.Parent!.Parent!.ToString()); 21693Assert.Equal("Base(X, Y)", x.Parent!.Parent!.Parent!.ToString()); 21704Assert.Equal("Base(X, Y)", x.Parent!.Parent!.Parent!.ToString()); 21889Assert.Equal("Base(X)", x.Parent!.Parent!.Parent!.ToString()); 21926Assert.Equal("Base(X)", x.Parent!.Parent!.Parent!.ToString()); 21966Assert.Equal("Base(X)", x.Parent!.Parent!.Parent!.ToString()); 22001Assert.Equal("Base(X)", x.Parent!.Parent!.Parent!.ToString()); 22080Assert.Equal("Base(X, Y)", x.Parent!.Parent!.Parent!.ToString()); 22231Assert.Equal("Base(GetInt(X, out var xx) + xx, Y)", baseWithargs.ToString()); 22334Assert.Equal(": this(X, Y, Z, 1)", baseWithargs.ToString()); 22413Assert.Equal("Base(GetInt(X, out var xx) + xx, Y)", baseWithargs.ToString()); 22473Assert.Equal(": base(X, Y, Z, 1)", baseWithargs.ToString()); 24644Assert.Equal("= X + 1", x.Parent!.Parent!.ToString()); 24679Assert.Equal("= X + 1", x.Parent!.Parent!.ToString()); 24713Assert.Equal("= X + 1", x.Parent!.Parent!.ToString()); 24748Assert.Equal("() => X + 1", x.Parent!.Parent!.ToString()); 26210switch (literal.ToString()) 26249switch (equalsValue.ToString()) 26275switch (initializer.ToString()) 26299switch (baseType.ToString()) 26350switch (identifier.Parent!.ToString()) 26385switch (baseType.ToString()) 26429switch (parameterList.ToString()) 26455switch (argumentList.ToString()) 26849switch (context.Operation.Syntax.ToString()) 26895switch (context.Operation.Syntax.ToString()) 26979Assert.Equal("= 0", context.OperationBlocks[0].Syntax.ToString()); 26982Assert.Equal("Attr1(100)", context.OperationBlocks[1].Syntax.ToString()); 26990Assert.Equal("= 1", context.OperationBlocks[0].Syntax.ToString()); 26993Assert.Equal("Attr2(200)", context.OperationBlocks[1].Syntax.ToString()); 26996Assert.Equal("A(2)", context.OperationBlocks[2].Syntax.ToString()); 27004Assert.Equal("= 4", context.OperationBlocks[0].Syntax.ToString()); 27007Assert.Equal("Attr3(300)", context.OperationBlocks[1].Syntax.ToString()); 27012Assert.Equal(": base(5)", context.OperationBlocks[3].Syntax.ToString()); 27113Assert.Equal("= 0", context.OperationBlocks[0].Syntax.ToString()); 27116Assert.Equal("Attr1(100)", context.OperationBlocks[1].Syntax.ToString()); 27126Assert.Equal("= 1", context.OperationBlocks[0].Syntax.ToString()); 27129Assert.Equal("Attr2(200)", context.OperationBlocks[1].Syntax.ToString()); 27132Assert.Equal("A(2)", context.OperationBlocks[2].Syntax.ToString()); 27142Assert.Equal("= 4", context.OperationBlocks[0].Syntax.ToString()); 27145Assert.Equal("Attr3(300)", context.OperationBlocks[1].Syntax.ToString()); 27150Assert.Equal(": base(5)", context.OperationBlocks[3].Syntax.ToString()); 27187Assert.Equal("= 0", context.OperationBlocks[0].Syntax.ToString()); 27190Assert.Equal("Attr1(100)", context.OperationBlocks[1].Syntax.ToString()); 27198Assert.Equal("= 1", context.OperationBlocks[0].Syntax.ToString()); 27201Assert.Equal("Attr2(200)", context.OperationBlocks[1].Syntax.ToString()); 27204Assert.Equal("A(2)", context.OperationBlocks[2].Syntax.ToString()); 27212Assert.Equal("= 4", context.OperationBlocks[0].Syntax.ToString()); 27215Assert.Equal("Attr3(300)", context.OperationBlocks[1].Syntax.ToString()); 27220Assert.Equal(": base(5)", context.OperationBlocks[3].Syntax.ToString()); 28345Assert.Equal("I1", cref.ToString());
Microsoft.CodeAnalysis.CSharp.Features (20)
ChangeSignature\CSharpChangeSignatureService.cs (3)
779.Where(e => e.StartTag.Name.ToString() == DocumentationCommentXmlNames.ParameterElementName); 814var nameAttribute = paramNode.StartTag.Attributes.FirstOrDefault(a => a.Name.ToString().Equals("name", StringComparison.OrdinalIgnoreCase)); 821if (identifier == null || identifier.ToString() != declaredParameters.ElementAt(i).Name)
CodeFixes\Suppression\CSharpSuppressionCodeFixProvider.cs (1)
229return pragmaWarning.ErrorCodes.Any(n => n.ToString() == id);
DocumentationComments\CSharpDocumentationCommentSnippetService.cs (1)
176var exception = exceptionType.ToString();
ExtractMethod\CSharpMethodExtractor.PostProcessor.cs (2)
256if (returnStatement.Expression.ToString() != variableName) 291assignmentExpression.Left.ToString() != variableName)
GenerateType\CSharpGenerateTypeService.cs (1)
763.Select(n => n.Name.ToString())
MoveToNamespace\CSharpMoveToNamespaceService.cs (1)
24BaseNamespaceDeclarationSyntax namespaceSyntax => namespaceSyntax.Name.ToString(),
SignatureHelp\ElementAccessExpressionSignatureHelpProvider.cs (1)
157var newBracketedArgumentList = ParseBracketedArgumentList(openBracket.Parent!.ToString());
Snippets\AbstractCSharpAutoPropertySnippetProvider.cs (1)
85new SnippetPlaceholder(type.ToString(), type.SpanStart),
Snippets\AbstractCSharpForLoopSnippetProvider.cs (2)
102placeholderBuilder.Add(left.ToString(), left.SpanStart); 107placeholderBuilder.Add(operand.ToString(), operand.SpanStart);
Snippets\CSharpForEachLoopSnippetProvider.cs (1)
118arrayBuilder.Add(new SnippetPlaceholder(node.Expression.ToString(), node.Expression.SpanStart));
Snippets\CSharpForLoopSnippetProvider.cs (1)
38placeholderBuilder.Add(rightOfCondition.ToString(), rightOfCondition.SpanStart);
Snippets\CSharpLockSnippetProvider.cs (1)
31return [new SnippetPlaceholder(expression.ToString(), expression.SpanStart)];
Snippets\CSharpReversedForLoopSnippetProvider.cs (1)
44placeholderBuilder.Add(left.ToString(), left.SpanStart);
src\Analyzers\CSharp\CodeFixes\ReplaceDefaultLiteral\CSharpReplaceDefaultLiteralCodeFixProvider.cs (1)
103return (newLiteral, newLiteral.ToString());
Structure\Providers\DocumentationCommentStructureProvider.cs (1)
34var endPos = documentationComment.SpanStart + documentationComment.ToString().TrimEnd().Length;
Structure\Providers\RegionDirectiveStructureProvider.cs (1)
20var text = simpleDirective.ToString()[prefixLength..].Trim();
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (4)
EditAndContinue\SyntaxUtilitiesTests.cs (4)
107Assert.Equal("0", leftNode.ToString()); 157Assert.Equal("3", leftNode.ToString()); 258AssertEx.Equal(["yield return 1;"], SyntaxUtilities.GetSuspensionPoints(m1.Body).Select(n => n.ToString())); 270], SyntaxUtilities.GetSuspensionPoints(f.Body).Select(n => n.ToString()));
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (6)
IOperation\IOperationTests.cs (4)
464Assert.Equal("(x, y, z) = (1, 2, 3)", assignments[0].ToString()); 470Assert.Equal("(x, y, z) = new C()", assignments[1].ToString()); 476Assert.Equal("var (a, b) = (1, 2)", assignments[2].ToString()); 559Assert.Equal("a.b", expr.ToString());
IOperation\IOperationTests_IVariableDeclaration.cs (2)
929Assert.Equal(@"10", literalExpr.ToString()); 936Assert.Equal(@"M2()", invocExpr.ToString());
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (521)
Semantics\AwaitExpressionTests.cs (1)
85Assert.Equal("await x", awaitExpression.ToString());
Semantics\BindingTests.cs (24)
2728Assert.Equal("A.B<string>.M0", identifierNameM0.Parent.ToString()); 2740Assert.Equal("A.B<string>.M1", identifierNameM1.Parent.ToString()); 2786Assert.Equal("(MyDelegate<int>)MyMethod", identifiers[0].Parent.ToString()); 2789Assert.Equal("(MyDelegate<long>)MyMethod", identifiers[1].Parent.ToString()); 2792Assert.Equal("(MyDelegate<float>)MyMethod", identifiers[2].Parent.ToString()); 2795Assert.Equal("(MyDelegate<double>)MyMethod", identifiers[3].Parent.ToString()); 2839Assert.Equal("b.M0", identifierNameM0.Parent.ToString()); 2851Assert.Equal("b.M1", identifierNameM1.Parent.ToString()); 3038Assert.Equal("app.Use", node1.ToString()); 3053Assert.Equal("ctx.Authentication.AuthenticateAsync", node.ToString()); 3118Assert.Equal("app.Use", node1.ToString()); 3133Assert.Equal("ctx.Authentication.AuthenticateAsync", node.ToString()); 3191Assert.Equal("app.Use", node1.ToString()); 3207Assert.Equal("ctx.Authentication.AuthenticateAsync", node.ToString()); 3276Assert.Equal("app.Use", node1.ToString()); 3292Assert.Equal("ctx.Authentication.AuthenticateAsync", node.ToString()); 3381Assert.Equal("MathMin(0, 1)", node1.ToString()); 3733Assert.Equal("x.E1.E", node1.ToString()); 3737Assert.Equal("x.E1", node2.ToString()); 3912var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.ToString() == "G").First(); 3989Assert.Equal("b", id.ToString()); 3994Assert.Equal("a", id.ToString()); 4030Assert.Equal("b", id.ToString()); 4035Assert.Equal("a", id.ToString());
Semantics\ColorColorTests.cs (14)
1818Assert.Equal("Lifetime", memberAccess.Expression.ToString()); 1819Assert.Equal("Lifetime.Persistent", memberAccess.ToString()); 1883Assert.Equal("E.A", node1.ToString()); 1884Assert.Equal("E", node1.Expression.ToString()); 1894Assert.Equal("= E", node2.Parent.ToString()); 1940Assert.Equal("E.A", node1.ToString()); 1941Assert.Equal("E", node1.Expression.ToString()); 1951Assert.Equal("= E", node2.Parent.ToString()); 1997Assert.Equal("E.A", node1.ToString()); 1998Assert.Equal("E", node1.Expression.ToString()); 2008Assert.Equal("= E", node2.Parent.ToString()); 2047Assert.Equal("E.A", node1.ToString()); 2048Assert.Equal("E", node1.Expression.ToString()); 2057Assert.Equal("= E", node2.Parent.ToString());
Semantics\ConditionalOperatorTests.cs (7)
1349Assert.Equal(".test", memberBinding.ToString()); 1350Assert.Equal("receiver?.test", access.ToString()); 1404Assert.Equal(".test", memberBinding.ToString()); 1405Assert.Equal(".test()", invocation.ToString()); 1406Assert.Equal("receiver?.test()", access.ToString()); 1450Assert.Equal(".test", memberBinding.ToString()); 1451Assert.Equal("receiver?.test", access.ToString());
Semantics\DeconstructionTests.cs (45)
4259Assert.Equal("var (a,b)", declarations[0].ToString()); 4282Assert.Equal("var c", declarations[1].ToString()); 4300Assert.Equal("int d", declarations[2].ToString()); 4394Assert.Equal("var (a,b)", declarations[0].ToString()); 4413Assert.Equal("var c", declarations[1].ToString()); 4431Assert.Equal("int d", declarations[2].ToString()); 4518Assert.Equal("var (_, _)", declarations[0].ToString()); 4541Assert.Equal("var _", declarations[1].ToString()); 4562Assert.Equal("int _", declarations[2].ToString()); 4668Assert.Equal("var (a,b)", declarations[0].ToString()); 4687Assert.Equal("var c", declarations[1].ToString()); 4725Assert.Equal("var (a, a)", aa.ToString()); 4762Assert.Equal("var (a,b)", declarations[0].ToString()); 4781Assert.Equal("var c", declarations[1].ToString()); 4840Assert.Equal("var (_, _)", declarations[0].ToString()); 4859Assert.Equal("var _", declarations[1].ToString()); 4944Assert.Equal("al c", declaration.ToString()); 4990Assert.Equal("al c", declaration.ToString()); 5048Assert.Equal("al _", declaration.ToString()); 5208Assert.Equal("var (a,b)", declarations[0].ToString()); 5227Assert.Equal("var c", declarations[1].ToString()); 5245Assert.Equal("int d", declarations[2].ToString()); 5262Assert.Equal("((var (a,b), var c), int d)", tuples[0].ToString()); 5272Assert.Equal("(var (a,b), var c)", tuples[1].ToString()); 5352Assert.Equal("var (a,b)", declarations[0].ToString()); 5371Assert.Equal("var c", declarations[1].ToString()); 5389Assert.Equal("int d", declarations[2].ToString()); 5406Assert.Equal("((var (a,b), var c), int d)", tuples[0].ToString()); 5416Assert.Equal("(var (a,b), var c)", tuples[1].ToString()); 5489Assert.Equal("var (_, _)", declarations[0].ToString()); 5508Assert.Equal("var _", declarations[1].ToString()); 5529Assert.Equal("int _", declarations[2].ToString()); 5549Assert.Equal("((var (_, _), var _), int _)", tuples[0].ToString()); 5559Assert.Equal("(var (_, _), var _)", tuples[1].ToString()); 5676Assert.Equal("var ((a,b), c)", declarations[0].ToString()); 5695Assert.Equal("int d", declarations[1].ToString()); 5786Assert.Equal("var ((a,b), c)", declarations[0].ToString()); 5805Assert.Equal("int d", declarations[1].ToString()); 5889Assert.Equal("var ((_, _), _)", declarations[0].ToString()); 5908Assert.Equal("int _", declarations[1].ToString()); 5986var mainCall = tree.GetRoot().DescendantNodes().OfType<ExpressionSyntax>().Where(n => n.ToString() == "Main()").Single(); 6029var mainCall = tree.GetRoot().DescendantNodes().OfType<ExpressionSyntax>().Where(n => n.ToString() == "Main()").Single(); 6069var mainCall = tree.GetRoot().DescendantNodes().OfType<ExpressionSyntax>().Where(n => n.ToString() == "Main()").Single(); 6111var two = tree.GetRoot().DescendantNodes().OfType<ExpressionSyntax>().Where(n => n.ToString() == "2").Single(); 6151var mainCall = tree.GetRoot().DescendantNodes().OfType<ExpressionSyntax>().Where(n => n.ToString() == "Main()").Single();
Semantics\DynamicTests.cs (18)
4986AssertEx.Equal(@"i1.Test(""name"", value)", call.ToString()); 5110AssertEx.Equal(@"i1.Test(""name"", value)", call.ToString()); 5233AssertEx.Equal(@"i1.Test(""name"", value)", call.ToString()); 5347AssertEx.Equal(@"new C().Test(""name"", d)", call.ToString()); 5388AssertEx.Equal(@"Test(name: ""name"", d)", call.ToString()); 5432AssertEx.Equal(@"Test(&name, d)", call.ToString()); 5476AssertEx.Equal(@"Test(""name"", d)", call.ToString()); 5520AssertEx.Equal(@"Test(""name"", d)", call.ToString()); 5697AssertEx.Equal(@"i1(""name"", value)", call.ToString()); 5738AssertEx.Equal(@"Test(name: ""name"", d)", call.ToString()); 5783AssertEx.Equal(@"Test(&name, d)", call.ToString()); 5828AssertEx.Equal(@"Test(""name"", d)", call.ToString()); 5873AssertEx.Equal(@"Test(""name"", d)", call.ToString()); 11327AssertEx.Equal(@"i1.Test(""name"", value)", call.ToString()); 11380AssertEx.Equal(@"i1.Test(""name"", value)", call.ToString()); 11456AssertEx.Equal(@"Test(""name"", d)", call.ToString()); 11500AssertEx.Equal(@"i1(""name"", value)", call.ToString()); 11541AssertEx.Equal(@"Test(""name"", d)", call.ToString());
Semantics\ExpressionBodiedMemberTests.cs (16)
477Assert.Equal("P1", node.ToString()); 508Assert.Equal("P1", node.ToString()); 537Assert.Equal("P1", node.ToString()); 546Assert.Equal("P1", node2.ToString()); 577Assert.Equal("P1", node.ToString()); 586Assert.Equal("P1", node2.ToString()); 651Assert.Equal("P1", node.ToString()); 682Assert.Equal("P1", node.ToString()); 713Assert.Equal("P1", node.ToString()); 744Assert.Equal("P1", node.ToString()); 779Assert.Equal("P1", node.ToString()); 810Assert.Equal("P1", node.ToString()); 845Assert.Equal("P1", node.ToString()); 880Assert.Equal("P1", node.ToString()); 919Assert.Equal("P1", node.ToString()); 1026Assert.Equal($"{i}", nodes[i].ToString());
Semantics\FunctionPointerTests.cs (2)
2089AssertEx.Equal("ptr = M(C.Field)", localSyntax.ToString()); 3965Assert.Equal("delegate*<__arglist, void>", parameterDecls[1].ToString());
Semantics\GlobalUsingDirectiveTests.cs (38)
3853Assert.Equal("global using alias1 = C1;", aliases[0].ToString()); 3856Assert.Equal("global using alias1 = C2;", aliases[1].ToString()); 3859Assert.Equal("using alias1 = C3;", aliases[2].ToString()); 3862Assert.Equal("using alias1 = C4;", aliases[3].ToString()); 3879Assert.Equal("global using alias1 = C1;", aliases[0].ToString()); 3882Assert.Equal("using alias1 = C3;", aliases[1].ToString()); 3885Assert.Equal("using alias1 = C4;", aliases[2].ToString()); 3893Assert.Equal("global using alias1 = C2;", aliases[0].ToString()); 3910Assert.Equal("using alias1 = C3;", aliases[0].ToString()); 3913Assert.Equal("using alias1 = C4;", aliases[1].ToString()); 3921Assert.Equal("global using alias1 = C1;", aliases[0].ToString()); 3924Assert.Equal("global using alias1 = C2;", aliases[1].ToString()); 3943Assert.Equal("global using alias1 = C1;", aliases[0].ToString()); 3946Assert.Equal("global using alias1 = C2;", aliases[1].ToString()); 3963Assert.Equal("global using alias1 = C1;", aliases[0].ToString()); 3971Assert.Equal("global using alias1 = C2;", aliases[0].ToString()); 3993Assert.Equal("global using alias1 = C1;", aliases[0].ToString()); 3996Assert.Equal("global using alias1 = C2;", aliases[1].ToString()); 4009Assert.Equal("global using alias1 = C1;", aliases[0].ToString()); 4012Assert.Equal("global using alias1 = C2;", aliases[1].ToString()); 4015Assert.Equal("using alias1 = C3;", aliases[2].ToString()); 4018Assert.Equal("using alias1 = C4;", aliases[3].ToString()); 4029Assert.Equal("global using alias1 = C1;", aliases[0].ToString()); 4032Assert.Equal("using alias1 = C3;", aliases[1].ToString()); 4035Assert.Equal("using alias1 = C4;", aliases[2].ToString()); 4043Assert.Equal("global using alias1 = C2;", aliases[0].ToString()); 4054Assert.Equal("using alias1 = C3;", aliases[0].ToString()); 4057Assert.Equal("using alias1 = C4;", aliases[1].ToString()); 4065Assert.Equal("global using alias1 = C1;", aliases[0].ToString()); 4068Assert.Equal("global using alias1 = C2;", aliases[1].ToString()); 4081Assert.Equal("global using alias1 = C1;", aliases[0].ToString()); 4084Assert.Equal("global using alias1 = C2;", aliases[1].ToString()); 4095Assert.Equal("global using alias1 = C1;", aliases[0].ToString()); 4103Assert.Equal("global using alias1 = C2;", aliases[0].ToString()); 4122Assert.Equal("using alias1 = C3;", aliases[0].ToString()); 4125Assert.Equal("using alias1 = C4;", aliases[1].ToString()); 4154Assert.Equal("using alias1 = C3;", aliases[0].ToString()); 4157Assert.Equal("using alias1 = C4;", aliases[1].ToString());
Semantics\ImplicitObjectCreationTests.cs (12)
1714Assert.Equal(expression, invocation.ToString()); 1981Assert.Equal("new(x)", def.ToString()); 2039Assert.Equal("new()", @new.ToString()); 2046Assert.Equal("new object()", newObject.ToString()); 2074Assert.Equal("new()", @new.ToString()); 2081Assert.Equal("new object()", newObject.ToString()); 2220Assert.Equal("new()", def.ToString()); 2568Assert.Equal("new()", def.ToString()); 3218Assert.Equal("(o, new())", first.Parent.Parent.ToString()); 3222Assert.Equal("(new(), o)", second.Parent.Parent.ToString()); 3226Assert.Equal("(c, new())", third.Parent.Parent.ToString()); 3230Assert.Equal("(new(), c)", fourth.Parent.Parent.ToString());
Semantics\InitOnlyMemberTests.cs (1)
3198Assert.Equal("P1", node.ToString());
Semantics\InterceptorsTests.cs (2)
7873var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(i => i.ToString() == "RS().M()"); 7937var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(i => i.ToString() == "new S().M()");
Semantics\InterpolationTests.cs (1)
4832Assert.Equal(expression, syntax.ToString());
Semantics\IteratorTests.cs (3)
580Assert.Equal("yield return;", node.ToString()); 611Assert.Equal("new KeyValuePair<TKey, TValue>(kvp.Key, kvp.Value)", node.ToString()); 649Assert.Equal("new KeyValuePair<TKey, TValue>(kvp, kvp.Value)", node.ToString());
Semantics\LambdaDiscardParametersTests.cs (6)
417var underscoreParameters = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Where(p => p.ToString() == "_").ToArray(); 422var underscore = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(p => p.ToString() == "_").Single(); 448var underscores = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(p => p.ToString() == "_").ToArray(); 482var underscore = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(p => p.ToString() == "_").Single(); 513var underscores = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(p => p.ToString() == "_").ToArray(); 566var underscoreParameters = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Where(p => p.ToString() == "_").ToArray();
Semantics\LambdaTests.cs (32)
1515Assert.Equal("a.", node.Parent.ToString().Trim()); 1550Assert.Equal("a.", node.Parent.ToString().Trim()); 1584Assert.Equal("a.", node.Parent.ToString().Trim()); 1616Assert.Equal("a.", node.Parent.ToString().Trim()); 1981Assert.Equal("async delegate { await Task.Delay(0); }", node1.ToString()); 2122Assert.Equal("e", eReference.ToString()); 2168Assert.Equal("x", eReference.ToString()); 2214Assert.Equal("x", eReference.ToString()); 2260Assert.Equal("x", eReference.ToString()); 2306Assert.Equal("x", eReference.ToString()); 2336Assert.Equal("c", eReference.ToString()); 2363Assert.Equal("a", eReference.ToString()); 2418Assert.Equal("x", reference.ToString()); 2464Assert.Equal("x", reference.ToString()); 2510Assert.Equal("x", reference.ToString()); 2543Assert.Equal("x", reference.ToString()); 2576Assert.Equal("x", reference.ToString()); 2613Assert.Equal("x", reference.ToString()); 3000Assert.Equal("ContentType", contentType.ToString()); 3007Assert.Equal("b", b.ToString()); 3042Assert.Equal("ContentType", contentType.ToString()); 3049Assert.Equal("b", b.ToString()); 7110Assert.Equal("r1 => r1", lambdas[0].ToString()); 7115Assert.Equal("r2 => r2", lambdas[1].ToString()); 8017Assert.Equal("(int a, int b = 1) => a + b", lambdas[0].Node.ToString()); 8027Assert.Equal("([Optional] int x) => x", lambdas[1].Node.ToString()); 8034Assert.Equal("([DefaultParameterValue(2)] int x) => x", lambdas[2].Node.ToString()); 8041Assert.Equal("([Optional, DefaultParameterValue(3)] int x) => x", lambdas[3].Node.ToString()); 8060Assert.Equal("= 1", equalsValue.ToString()); 8121Assert.Equal("const int N = 10;", decls[0].ToString()); 8125Assert.Equal("var lam = (int a = N) => a;", decls[1].ToString()); 8131Assert.Equal("var x = N;", decls[2].ToString());
Semantics\LocalFunctionTests.cs (3)
4727Assert.Equal("int n = N", parameter.ToString()); 6552Where(n => n.Expression.ToString() == "nameof"). 8743Assert.Equal("nameof(parameter)", invocation.ToString());
Semantics\LookupPositionTests.cs (1)
3132position, token.ToString(), token.Parent.ToString(), keyPositionNum, KeyPositionMarker));
Semantics\LookupTests.cs (4)
682Assert.Equal("base", baseExprNode.ToString()); 1501var node = tree.GetRoot().DescendantNodes().OfType<ExpressionSyntax>().Where(n => n.ToString() == "m.M").Single(); 1643var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "returne<double>").First(); 1670var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "System.Object").First();
Semantics\NameOfTests.cs (17)
685var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "SomeClass.Goo").OfType<ExpressionSyntax>().First(); 711var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "SomeClass.Goo").OfType<ExpressionSyntax>().First(); 746var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "a.Extension").OfType<ExpressionSyntax>().First(); 793var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "a.Extension").OfType<ExpressionSyntax>().First(); 830var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "a.Extension").OfType<ExpressionSyntax>().First(); 866var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "a.Nested").OfType<ExpressionSyntax>().First(); 912var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "A.Extension").OfType<ExpressionSyntax>().First(); 945var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "a.Extension").OfType<ExpressionSyntax>().First(); 993Assert.Equal(expression, argument.ToString()); 998Assert.Equal(expression, argument2.ToString()); 1064Assert.Equal(expression, argument.ToString()); 1069Assert.Equal(expression, argument2.ToString()); 1150Assert.Equal(expression, argument.ToString()); 1155Assert.Equal(expression, argument2.ToString()); 1228Assert.Equal(expression, argument.ToString()); 1233Assert.Equal(expression, argument2.ToString()); 1422var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "X1.Extension").OfType<ExpressionSyntax>().First();
Semantics\NativeIntegerTests.cs (6)
15318Assert.Equal(type, cref.ToString()); 15339Assert.Equal("System.IntPtr", cref.ToString()); 15362Assert.Equal("nint", cref.ToString()); 15390Assert.Equal(fieldName, cref.ToString()); 15413Assert.Equal("nint", cref.ToString()); 15443Assert.Equal("nint", cref.ToString());
Semantics\NonTrailingNamedArgumentsTests.cs (18)
47Assert.Equal("M(a: 1, 2)", firstInvocation.ToString()); 52Assert.Equal("a: 1", firstNamedArgA.Parent.ToString()); 59Assert.Equal("M(3, a: 4)", secondInvocation.ToString()); 64Assert.Equal("a: 4", secondNamedArgA.Parent.ToString()); 369Assert.Equal("M(1, first: 2)", invocation.ToString()); 395Assert.Equal(@"C.M(a: 1, ""hi"")", invocation.ToString()); 425Assert.Equal("M(c: 1, 2)", invocation.ToString()); 457Assert.Equal("M(x: 1, 2)", invocation.ToString()); 486Assert.Equal("M(1, x: 2)", invocation.ToString()); 536Assert.Equal("M(x: 1, x: 2)", invocation.ToString()); 571Assert.Equal("M(x: 1, x: 2, 3)", invocation.ToString()); 600Assert.Equal("M(y: 1, 2)", invocation.ToString()); 654Assert.Equal("M(x: 1, 2)", invocation.ToString()); 681Assert.Equal("M(y: 1, x: 2)", invocation.ToString()); 712Assert.Equal("M(c: valueC, valueB)", firstInvocation.ToString()); 746Assert.Equal("M(c: valueC, valueB)", invocation.ToString()); 778Assert.Equal("M(c: valueC, valueB)", invocation.ToString()); 985Assert.Equal("MyAttribute(condition: true, 42)", invocation.ToString());
Semantics\NullableContextTests.cs (10)
351Assert.Equal("return obj;", syntax.ToString()); 390Assert.Equal("A.F = null", syntax.ToString()); 425Assert.Equal("(F = null)", syntax.ToString()); 1774Assert.Equal("return o1;", syntax.ToString()); 1779Assert.Equal("return o2;", syntax.ToString()); 1842Assert.Equal("obj", syntax.ToString()); 1888Assert.Equal(expectedText, syntax.ToString()); 1943Assert.Equal(expectedText, syntax.ToString()); 1980Assert.Equal(expectedText, value.ToString()); 2255key is Symbol symbol ? symbol.MetadataName : ((SyntaxNode)key).ToString();
Semantics\NullableReferenceTypesTests.cs (60)
1755Assert.Equal(@"$""hello ""!", suppression.ToString()); 1759Assert.Equal(@"$""hello """, interpolated.ToString()); 1790Assert.Equal(@"$""hello ""!", suppression.ToString()); 1794Assert.Equal(@"$""hello """, interpolated.ToString()); 1964Assert.Equal("M2!", suppression.ToString()); 2277Assert.Equal("(string? x) => { return null; }!", suppression.ToString()); 2281Assert.Equal("(string? x) => { return null; }", lambda.ToString()); 2316Assert.Equal("(string? x) => { return null; }!", suppression.ToString()); 2320Assert.Equal("(string? x) => { return null; }", lambda.ToString()); 2348Assert.Equal("(string x) => { return string.Empty; }!", suppression.ToString()); 2353Assert.Equal("(string x) => { return string.Empty; }", lambda.ToString()); 2382Assert.Equal("(string x) => { return string.Empty; }!", suppression.ToString()); 2386Assert.Equal("(string x) => { return string.Empty; }", lambda.ToString()); 2480Assert.Equal(@"(string? x) => { return null; }!", suppression.ToString()); 3337Assert.Equal("x", reference.ToString()); 7770Assert.Equal("[]", specifier.ToString()); 7777Assert.Equal("[3]", newSpecifier.ToString()); 10537Assert.Equal("string", type1.ToString()); 10541Assert.Equal("string?", type2.ToString()); 56077Assert.Equal("null", nullNode.ToString()); 56107Assert.Equal("null", nullNode.ToString()); 56140Assert.Equal("default", defaultNode.ToString()); 56177Assert.Equal("default", defaultNode.ToString()); 56305Assert.Equal("null", nullNode.ToString()); 56438Assert.Equal("new()", newNode.ToString()); 56473Assert.Equal("new(null)", newNode.ToString()); 56509Assert.Equal("null", nullNode.ToString()); 56620Assert.Equal("() => { }", lambdaNode.ToString()); 65901Assert.Equal("object?", object2.Parent.ToString()); 71877Assert.Equal("var _", discard1.ToString()); 71882Assert.Equal("_", discard2.ToString()); 71887Assert.Equal("var _", discard3.ToString()); 71892Assert.Equal("_", discard4.ToString()); 71925Assert.Equal("var _", discard1.ToString()); 71935Assert.Equal("_", discard2.ToString()); 71963Assert.Equal("_", discardPattern1.ToString()); 71970Assert.Equal("_", discardPattern2.ToString()); 145383Assert.Equal("c.Extension()", invocation.ToString()); 145502Assert.Equal("c.Extension()", invocation.ToString()); 145540Assert.Equal("c.Extension()", invocation.ToString()); 145573Assert.Equal("c.Extension()", invocation.ToString()); 145606Assert.Equal("c.Extension()", invocation.ToString()); 155997var identifiers = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "global::Program").ToArray(); 157582Assert.Equal("field", declarators[0].Value.ToString()); 157584Assert.Equal("C<T>.field", declarators[1].Value.ToString()); 157586Assert.Equal("C<T>.field", declarators[2].Value.ToString()); 157632Assert.Equal("M<T>(out x)", invocations[0].ToString()); 157635Assert.Equal("M<T>(out x)", invocations[1].ToString()); 158062Assert.Equal("i.Item", item.ToString()); 158098Assert.Equal("i[0]", item.ToString()); 158193Assert.Equal("i.Get()", item.ToString()); 158231Assert.Equal("i.Item", item.ToString()); 158383Assert.Equal("i[0]", item.ToString()); 158478Assert.Equal("i.Get()", item.ToString()); 161247Assert.Equal("s", identifiers[0].ToString()); 161248Assert.Equal("Length", identifiers[1].ToString()); 161249Assert.Equal("s", identifiers[2].ToString()); 161293Assert.Equal("s", identifiers[0].ToString()); 161294Assert.Equal("Length", identifiers[1].ToString()); 161295Assert.Equal("s", identifiers[2].ToString());
Semantics\ObjectAndCollectionInitializerTests.cs (6)
3695Assert.Equal("List", listAssignment.Left.ToString()); 3745Assert.Equal("List", listAssignment.Left.ToString()); 3789Assert.Equal("[0]", listAssignment.Left.ToString()); 4022Assert.Equal("List<string>", name.ToString()); 4096var nodes = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Where(n => n.ToString() == "2"); 4168var nodes = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Where(n => n.ToString() == "2");
Semantics\OperatorTests.cs (4)
2986Assert.Equal("!1", negOne.ToString()); 2992Assert.Equal("b++", boolPlusPlus.ToString()); 2998Assert.Equal("error++", errorPlusPlus.ToString()); 11338Assert.Equal("!invalidExpression", negNode.ToString());
Semantics\OverloadResolutionPerfTests.cs (1)
983Assert.Equal("o.F( ", expr.ToString());
Semantics\QueryTests.cs (6)
2385var fromClause1 = tree.GetCompilationUnitRoot().DescendantNodes().Where(n => (n.IsKind(SyntaxKind.FromClause)) && (n.ToString().Contains("num1"))).Single() as FromClauseSyntax; 2386var fromClause2 = tree.GetCompilationUnitRoot().DescendantNodes().Where(n => (n.IsKind(SyntaxKind.FromClause)) && (n.ToString().Contains("num2"))).Single() as FromClauseSyntax; 3377tree.GetCompilationUnitRoot().DescendantNodes(n => n.ToString().Contains("assem2")) 3378.Where(e => e.ToString() == "assem2") 3386tree.GetCompilationUnitRoot().DescendantNodes(n => n.ToString().Contains("assem1")) 3387.Where(e => e.ToString() == "assem1")
Semantics\RawInterpolationTests_Handler.cs (1)
3133Assert.Equal(expression, syntax.ToString());
Semantics\RecordStructTests.cs (22)
2595Assert.Equal("= X + 1", x.Parent!.Parent!.ToString()); 2630Assert.Equal("= X + 1", x.Parent!.Parent!.ToString()); 2664Assert.Equal("= X + 1", x.Parent!.Parent!.ToString()); 2699Assert.Equal("() => X + 1", x.Parent!.Parent!.ToString()); 3286Assert.Equal("I1", cref.ToString()); 3334Assert.Equal("I2", cref.ToString()); 3385Assert.Equal("I2", cref.ToString()); 5971switch (literal.ToString()) 5997switch (equalsValue.ToString()) 6015switch (initializer.ToString()) 6075switch (baseType.ToString()) 6102switch (parameterList.ToString()) 6124switch (argumentList.ToString()) 6439switch (context.Operation.Syntax.ToString()) 6457switch (context.Operation.Syntax.ToString()) 6517Assert.Equal("= 0", context.OperationBlocks[0].Syntax.ToString()); 6520Assert.Equal("Attr1(100)", context.OperationBlocks[1].Syntax.ToString()); 10651AssertEx.AssertEqualToleratingWhitespaceDifferences(expected, SyntaxFactory.TypeDeclaration(SyntaxKind.RecordStructDeclaration, "Point").NormalizeWhitespace().ToString()); 10773Assert.Equal("Error1(0, 1)", baseWithargs.ToString()); 10777Assert.Equal("Error1(0)", speculativeBase.ToString()); 10783Assert.Equal("Error2()", baseWithoutargs.ToString()); 10788Assert.Equal("Error3", baseWithoutParens.ToString());
Semantics\RefEscapingTests.cs (16)
5718Assert.Equal(@"(local, """")", tuple2.ToString()); 5719Assert.Equal(@"(global, s) = (local, """")", tuple2.Parent.ToString()); 5724Assert.Equal(@"(local, null)", tuple3.ToString()); 5725Assert.Equal(@"(global, s) = (local, null)", tuple3.Parent.ToString()); 5730Assert.Equal(@"(local, """")", tuple6.ToString()); 5731Assert.Equal(@"(c, s) = (local, """")", tuple6.Parent.ToString()); 5736Assert.Equal("(local, null)", tuple7.ToString()); 5737Assert.Equal("(c, s) = (local, null)", tuple7.Parent.ToString()); 5818Assert.Equal(@"(local, """")", tuple2.ToString()); 5819Assert.Equal(@"(global, s) = (local, """")", tuple2.Parent.ToString()); 5824Assert.Equal(@"(local, null)", tuple3.ToString()); 5825Assert.Equal(@"(global, s) = (local, null)", tuple3.Parent.ToString()); 5830Assert.Equal(@"(local, """")", tuple6.ToString()); 5831Assert.Equal(@"(c, s) = (local, """")", tuple6.Parent.ToString()); 5836Assert.Equal("(local, null)", tuple7.ToString()); 5837Assert.Equal("(c, s) = (local, null)", tuple7.Parent.ToString());
Semantics\RefFieldTests.cs (7)
16552Assert.Equal("M2(r => r)", invocations[0].ToString()); 16555Assert.Equal("M2((scoped R r) => r)", invocations[1].ToString()); 16593Assert.Equal("delegate { }", anonymousMethod.ToString()); 16632Assert.Equal("delegate { }", anonymousMethod.ToString()); 16728Assert.Equal("(r1, t1) => F((r2, t2) => r2, t1)", lambdas[0].ToString()); 16735Assert.Equal("(r2, t2) => r2", lambdas[1].ToString()); 16776Assert.Equal("o2 => throw null!", lambda.ToString());
Semantics\ScriptSemanticsTests.cs (13)
1184Assert.Equal("WriteLine", node5.Name.ToString()); 1196Assert.Equal("WriteLine", node5.Name.ToString()); 1211Assert.Equal("WriteLine", node5.Name.ToString()); 1220Assert.Equal("WriteLine", node5.Name.ToString()); 1229Assert.Equal("WriteLine", node5.Name.ToString()); 1241Assert.Equal("WriteLine", node5.Name.ToString()); 1253Assert.Equal("WriteLine", node5.Name.ToString()); 1272Assert.Equal("WriteLine", node1.Name.ToString()); 1273Assert.Equal("WriteLine", node2.Name.ToString()); 1311Assert.Equal("WriteLine", node5.Name.ToString()); 1325Assert.Equal("WriteLine", node5.Name.ToString()); 1340Assert.Equal("WriteLine", node5.Name.ToString()); 1355Assert.Equal("WriteLine", node5.Name.ToString());
Semantics\SemanticErrorTests.cs (3)
7490Assert.Equal("i[1,2]", node.ToString()); 13329Assert.Equal("i.R[1]", node.ToString()); 24226Assert.Equal("base?.ToString()", node.ToString());
Semantics\TargetTypedDefaultTests.cs (36)
197Assert.Equal("default", def.ToString()); 245Assert.Equal("default", def.ToString()); 254Assert.Equal("null", nullSyntax.ToString()); 282Assert.Equal("default", def.ToString()); 291Assert.Equal("null", nullSyntax.ToString()); 327Assert.Equal("default", default1.ToString()); 333Assert.Equal("default", default2.ToString()); 521Assert.Equal("default", def.ToString()); 530Assert.Equal("null", nullSyntax.ToString()); 567Assert.Equal("default", def.ToString()); 576Assert.Equal("null", nullSyntax.ToString()); 610Assert.Equal("default", def.ToString()); 619Assert.Equal("null", nullSyntax.ToString()); 668Assert.Equal("default", def.ToString()); 749Assert.Equal("default", def.ToString()); 758Assert.Equal("null", nullSyntax.ToString()); 1143Assert.Equal("default", def.ToString()); 1632Assert.Equal("s += default", defaultLiteral.Parent.ToString()); 1736var defaults = nodes.OfType<LiteralExpressionSyntax>().Where(l => l.ToString() == "default"); 1740Assert.Equal("default", @default.ToString()); 1802var defaults = nodes.OfType<LiteralExpressionSyntax>().Where(l => l.ToString() == "default"); 1806Assert.Equal("default", @default.ToString()); 1873var defaults = nodes.OfType<LiteralExpressionSyntax>().Where(l => l.ToString() == "default"); 1877Assert.Equal("default", @default.ToString()); 1912Assert.Equal("default", first.ToString()); 2090Assert.Equal("default", def.ToString()); 2334Assert.Equal("default", def.ToString()); 2341Assert.Equal("null", nullSyntax.ToString()); 2415Assert.Equal("(o, default)", first.Parent.Parent.ToString()); 2420Assert.Equal("(default, o)", second.Parent.Parent.ToString()); 2425Assert.Equal("(s, default)", third.Parent.Parent.ToString()); 2430Assert.Equal("(default, s)", fourth.Parent.Parent.ToString()); 2458Assert.Equal("default", def.ToString()); 3345Assert.Equal("default", def.ToString()); 3384Assert.Equal("default", def.ToString()); 3515Assert.Equal("default", def.ToString());
Semantics\TopLevelStatementsTests.cs (62)
1709Assert.Equal("System.Console.WriteLine(Test)", nameRef.Parent.Parent.Parent.ToString()); 1717Assert.Equal("using alias1 = Test;", nameRef.Parent.ToString()); 1733Assert.Equal(": Test", nameRef.Parent.Parent.ToString()); 1739Assert.Equal("System.Console.WriteLine(Test)", nameRef.Parent.Parent.Parent.ToString()); 1744Assert.Equal("using alias2 = Test;", nameRef.Parent.ToString()); 1749Assert.Equal(": Test", nameRef.Parent.Parent.ToString()); 1755Assert.Equal("System.Console.WriteLine(Test)", nameRef.Parent.Parent.Parent.ToString()); 1885Assert.Equal("using alias1 = Test;", nameRef.Parent.ToString()); 1901Assert.Equal(": Test", nameRef.Parent.Parent.ToString()); 1907Assert.Equal("System.Console.WriteLine(Test)", nameRef.Parent.Parent.Parent.ToString()); 1912Assert.Equal("using alias2 = Test;", nameRef.Parent.ToString()); 1917Assert.Equal(": Test", nameRef.Parent.Parent.ToString()); 1923Assert.Equal("System.Console.WriteLine(Test)", nameRef.Parent.Parent.Parent.ToString()); 2103Assert.Equal("using alias1 = Test;", nameRef.Parent.ToString()); 2116Assert.Equal(": Test", nameRef.Parent.Parent.ToString()); 2121Assert.Equal("System.Console.WriteLine(Test())", nameRef.Parent.Parent.Parent.Parent.ToString()); 2126Assert.Equal("using alias2 = Test;", nameRef.Parent.ToString()); 2131Assert.Equal(": Test", nameRef.Parent.Parent.ToString()); 2136Assert.Equal("System.Console.WriteLine(Test())", nameRef.Parent.Parent.Parent.Parent.ToString()); 2269Assert.Equal("using alias1 = Test;", nameRef.Parent.ToString()); 2282Assert.Equal(": Test", nameRef.Parent.Parent.ToString()); 2287Assert.Equal("System.Console.WriteLine(Test())", nameRef.Parent.Parent.Parent.Parent.ToString()); 2292Assert.Equal("using alias2 = Test;", nameRef.Parent.ToString()); 2297Assert.Equal(": Test", nameRef.Parent.Parent.ToString()); 2302Assert.Equal("System.Console.WriteLine(Test())", nameRef.Parent.Parent.Parent.Parent.ToString()); 2449Assert.Equal("using alias1 = Test;", nameRef.Parent.ToString()); 2464Assert.Equal("goto Test;", nameRef.Parent.ToString()); 2479Assert.Equal(": Test", nameRef.Parent.Parent.ToString()); 2484Assert.Equal("goto Test;", nameRef.Parent.ToString()); 2489Assert.Equal("using alias2 = Test;", nameRef.Parent.ToString()); 2494Assert.Equal(": Test", nameRef.Parent.Parent.ToString()); 2500Assert.Equal("goto Test;", nameRef.Parent.ToString()); 3944Assert.Equal("using alias1 = args;", nameRef.Parent.ToString()); 3956Assert.Equal("System.Console.WriteLine(args)", nameRef.Parent.Parent.Parent.ToString()); 3975Assert.Equal(": args", nameRef.Parent.Parent.ToString()); 3980Assert.Equal("System.Console.WriteLine(args)", nameRef.Parent.Parent.Parent.ToString()); 3985Assert.Equal("using alias2 = args;", nameRef.Parent.ToString()); 3990Assert.Equal(": args", nameRef.Parent.Parent.ToString()); 3995Assert.Equal("System.Console.WriteLine(args)", nameRef.Parent.Parent.Parent.ToString()); 4093Assert.Equal("using alias1 = args;", nameRef.Parent.ToString()); 4105Assert.Equal(": args", nameRef.Parent.Parent.ToString()); 4110Assert.Equal("System.Console.WriteLine(args)", nameRef.Parent.Parent.Parent.ToString()); 4115Assert.Equal("using alias2 = args;", nameRef.Parent.ToString()); 4120Assert.Equal(": args", nameRef.Parent.Parent.ToString()); 4125Assert.Equal("System.Console.WriteLine(args)", nameRef.Parent.Parent.Parent.ToString()); 6441switch (globalStatement.ToString()) 6471switch (unit.ToString()) 6537switch (context.Symbol.DeclaringSyntaxReferences.Single().GetSyntax().ToString()) 6613switch (context.Symbol.DeclaringSyntaxReferences.Single().GetSyntax().ToString()) 6637switch (syntaxReference.GetSyntax().ToString()) 6656Assert.Equal("System.Console.WriteLine(1);", context.Symbol.DeclaringSyntaxReferences.Single().GetSyntax().ToString()); 6663Assert.Equal("System.Console.WriteLine(2);", context.Symbol.DeclaringSyntaxReferences.Single().GetSyntax().ToString()); 6725switch (context.Operation.Syntax.ToString()) 6745switch (context.Operation.Syntax.ToString()) 6803switch (context.OperationBlocks.Single().Syntax.ToString()) 6861switch (context.OperationBlocks.Single().Syntax.ToString()) 6919switch (context.CodeBlock.ToString()) 6987switch (context.CodeBlock.ToString()) 7069switch (node.ToString()) 7183switch (node.ToString()) 7355switch (context.OperationBlocks.Single().Syntax.ToString()) 7423switch (context.Operation.Syntax.ToString())
Semantics\TypeOfTests.cs (1)
33var node = (ObjectCreationExpressionSyntax)tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "new C(0)").Last();
Semantics\UnsafeTests.cs (2)
7325Assert.Equal("&()", syntax.ToString()); //NOTE: not actually lambda 7363Assert.Equal("&(()=>5)", syntax.ToString());
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (125)
Compilation\GetSemanticInfoTests.cs (4)
1674var varIdentifier = (IdentifierNameSyntax)tree.GetCompilationUnitRoot().DescendantNodes().First(n => n.ToString() == "var"); 3553Assert.Equal("System", expr.ToString()); 3581Assert.Equal("MessageBox(IntPtr.Zero, \"\", \"\", 1)", expr.ToString()); 4885Single(e => e.ToString() == "Instance.GetList().OfType<D>");
Compilation\SemanticModelAPITests.cs (17)
111.Where(e => e.Name.ToString() == "GenericExtension").First(); 1200var args = descendants.OfType<ArgumentSyntax>().Where(s => s.ToString() == "index").Select(s => s); 4145Assert.Equal(@"$""Number 3""", actual[0].ToString()); 4148Assert.Equal(@"$""{""Level 5""} {S1}""", actual[1].ToString()); 4153Assert.Equal(@"$""Testing""", actual[3].ToString()); 4156Assert.Equal(@"$""ConstantInterpolatedString""", actual[4].ToString()); 4159Assert.Equal(@"$""Level 5""", actual[5].ToString()); 4162Assert.Equal(@"$""Radio Noise""", actual[6].ToString()); 4165Assert.Equal(@"$""Level 5""", actual[7].ToString()); 4278Assert.Equal(@"$""""""Number 3""""""", actual[0].ToString()); 4282Assert.Equal(@"$""""""{""""""Level 5""""""} {S1}""""""", actual[1].ToString()); 4289Assert.Equal(@"$""""""Testing""""""", actual[3].ToString()); 4293Assert.Equal(@"$""""""ConstantInterpolatedString""""""", actual[4].ToString()); 4297Assert.Equal(@"$""""""Level 5""""""", actual[5].ToString()); 4301Assert.Equal(@"$""""""Radio Noise""""""", actual[6].ToString()); 4305Assert.Equal(@"$""""""Level 5""""""", actual[7].ToString()); 4778var expr = exprSyn.ToString();
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (12)
4801Assert.Equal("(1, 2)", type.DeclaringSyntaxReferences.Single().GetSyntax().ToString()); 4824Assert.Equal("(Alice: 1, Bob: 2)", type.DeclaringSyntaxReferences.Single().GetSyntax().ToString()); 4847Assert.Equal("(1, 1)", type.DeclaringSyntaxReferences.Single().GetSyntax().ToString()); 4870Assert.Equal("(1, null)", type.DeclaringSyntaxReferences.Single().GetSyntax().ToString()); 4893Assert.Equal("(Alice:1, Bob:null)", type.DeclaringSyntaxReferences.Single().GetSyntax().ToString()); 4916Assert.Equal("Bob", element.DeclaringSyntaxReferences.Single().GetSyntax().ToString()); 4939Assert.Equal("Bob", element.DeclaringSyntaxReferences.Single().GetSyntax().ToString()); 4962Assert.Equal("Bob", element.DeclaringSyntaxReferences.Single().GetSyntax().ToString()); 4997Assert.Equal("Bob", element.DeclaringSyntaxReferences.Single().GetSyntax().ToString()); 5043Assert.Equal("Bob", element.DeclaringSyntaxReferences.Single().GetSyntax().ToString()); 5092Assert.Equal("Bob", element.DeclaringSyntaxReferences.Single().GetSyntax().ToString()); 5115Assert.Equal("Bob", element.DeclaringSyntaxReferences.Single().GetSyntax().ToString());
DocumentationComments\CrefTests.cs (4)
1181string text = crefSyntax.ToString(); 6047Assert.Equal("T", typeParameterSyntax.ToString()); 6071Assert.Equal("GetValueOrDefault", methodNameSyntax.ToString()); 6675Assert.Equal("U", name.ToString());
SymbolDisplay\SymbolDisplayTests.cs (3)
5451Assert.Equal("this.M(@this)", invocation.ToString()); 5454Assert.Equal("this", actualThis.ToString()); 5464Assert.Equal("@this", escapedThis.ToString());
Symbols\AccessorOverriddenOrHiddenMembersTests.cs (4)
1008Assert.Equal("d.Dispose()", invocationSyntax.ToString()); 1011Assert.Equal("d.Dispose", memberAccessSyntax.ToString()); 1014Assert.Equal("d", identifierSyntax.ToString()); 1019Assert.Equal("Dispose", memberNameSyntax.ToString());
Symbols\AnonymousTypesSemanticsTests.cs (1)
2018var fieldName = node.ToString();
Symbols\DestructorTests.cs (1)
414Assert.Equal(WellKnownMemberNames.DestructorName, finalizeSyntax.ToString());
Symbols\ExtensionMethodTests.cs (7)
3152Assert.Equal("obj.InstanceMethod", firstInvocationExpression.ToString()); 3158Assert.Equal("obj.ExtensionMethod", secondInvocationExpression.ToString()); 3779Assert.Equal("other.GetEnumerableDisposable1<T, TEnumerator>", member.ToString()); 3867Assert.Equal("Instance.SetMember", instance.Parent.ToString()); 3914Assert.Equal("Instance.SetMember", instance.Parent.ToString()); 3959Assert.Equal("Instance.SetMember", instance.Parent.ToString()); 4009Assert.Equal("Instance.SetMember", instance.Parent.ToString());
Symbols\FunctionPointerTypeSymbolTests.cs (4)
1264Assert.Equal("delegate*<C.D>", functionPointerTypeSyntax.ToString()); 1822Assert.Equal("ptr = &M1", decls[0].ToString()); 1831Assert.Equal("ptr2 = &M1", decls[1].ToString()); 1868Assert.Equal("ptr = &M1", variableDeclaratorSyntax.ToString());
Symbols\Metadata\MetadataTypeTests.cs (2)
372var id = newTree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(s => s.ToString() == "StaticModClass").First(); 387id = newTree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(s => s.ToString() == "StaticModClass").First();
Symbols\RelaxedShiftOperatorTests.cs (6)
104Assert.Equal("x " + op + " y", shift.ToString()); 148Assert.Equal("x " + op + " y", shift.ToString()); 192Assert.Equal("x " + op + " y", shift.ToString()); 236Assert.Equal("x " + op + " y", shift.ToString()); 280Assert.Equal("x " + op + " y", shift.ToString()); 324Assert.Equal("x " + op + " y", shift.ToString());
Symbols\Source\BaseClassTests.cs (1)
2031var baseY = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "y").OfType<ExpressionSyntax>().First();
Symbols\Source\DelegateTests.cs (2)
740Assert.Equal("delegate { }", anonymousMethod.ToString()); 767Assert.Equal("delegate { }", anonymousMethod.ToString());
Symbols\Source\LocalTests.cs (1)
61Assert.Equal("x", expressionSyntax.ToString());
Symbols\Source\NullablePublicAPITests.cs (3)
1167if (syntaxContext.Node.ToString() != "o") return; 5053AssertEx.Equal("_ = s", assignmentsInLambda[0].ToString()); 5054AssertEx.Equal("_ = s", assignmentsInLambda[2].ToString());
Symbols\Source\UsingAliasTests.cs (2)
699Assert.Equal("Short.MyClass", node.Parent.ToString()); 742Assert.Equal("Short.MyClass", node.Parent.ToString());
Symbols\StaticAbstractMembersInInterfacesTests.cs (38)
8455Assert.Equal("T.M01()", node.ToString()); 9043Assert.Equal(prefixOp + "x" + postfixOp, node.ToString()); 9358Assert.Equal("x ? true : false", node.ToString()); 9757Assert.Equal("x " + op + " x", node.ToString()); 10752var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(n => n.ToString() == "x " + op + " 1").Single(); 10754Assert.Equal("x " + op + " 1", node.ToString()); 10945var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(n => n.ToString() == "x " + op + " 1").Single(); 10947Assert.Equal("x " + op + " 1", node.ToString()); 11135var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(n => n.ToString() == "x " + op + " y").Single(); 11137Assert.Equal("x " + op + " y", node.ToString()); 11329var node1 = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(n => n.ToString() == "x " + op + op + " y").First(); 11331Assert.Equal("x " + op + op + " y", node1.ToString()); 11583var node1 = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(n => n.ToString() == "x " + op + op + " y").First(); 11585Assert.Equal("x " + op + op + " y", node1.ToString()); 11960var node = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Where(n => n.ToString() == "x " + op + "= 1").Single(); 11962Assert.Equal("x " + op + "= 1", node.ToString()); 12141Assert.Equal("x " + op + " x", node.ToString()); 13182Assert.Equal("T.P01", node.ToString()); 13268Assert.Equal("T.P01", node.ToString()); 13390Assert.Equal("T.P01", node.ToString()); 14091Assert.Equal("T.E01", node.ToString()); 14100Assert.Equal("T.E01", node.ToString()); 14716Assert.Equal("T.M01", node.ToString()); 15122Assert.Equal("T.M01", node.ToString()); 15390Assert.Equal("T.M01", node.ToString()); 19560var node = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Where(l => l.ToString() == "default").First(); 19562Assert.Equal("default", node.ToString()); 19643var node = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Where(l => l.ToString() == "default").First(); 19645Assert.Equal("default", node.ToString()); 19735var node = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Where(l => l.ToString() == "default").First(); 19737Assert.Equal("default", node.ToString()); 19824var node = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Where(l => l.ToString() == "default").First(); 19826Assert.Equal("default", node.ToString()); 28773var node = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Where(l => l.ToString() == "default").First(); 28775Assert.Equal("default", node.ToString()); 30282Assert.Equal("return " + (needCast ? "(int)" : "") + @"x;", node.ToString()); 30473Assert.Equal("x " + op + " x", node.ToString()); 30939Assert.Equal("return " + (needCast ? "(T)" : "") + @"x;", node.ToString());
Symbols\UnsignedRightShiftTests.cs (13)
126Assert.Equal("x >>> y", unsignedShift.ToString()); 127Assert.Equal("x >> y", shift.ToString()); 629Assert.Equal("z1 >>>= y", unsignedShift.ToString()); 630Assert.Equal("z1 >>= y", shift.ToString()); 1179Assert.Equal("x >>> y", unsignedShift.ToString()); 1180Assert.Equal("x >> y", shift.ToString()); 1587Assert.Equal("z1 >>>= y", unsignedShift.ToString()); 1588Assert.Equal("z1 >>= y", shift.ToString()); 1985Assert.Equal("x >>> y", unsignedShift.ToString()); 2237Assert.Equal("x >>> y", unsignedShift.ToString()); 2379Assert.Equal("x >>>= y", unsignedShift.ToString()); 2513Assert.Equal("x >>> y", unsignedShift.ToString()); 2610Assert.Equal("x >>>= y", unsignedShift.ToString());
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (890)
Diagnostics\LineSpanDirectiveTests.cs (1)
477var description = syntax.ToString();
IncrementalParsing\NodeValidators.cs (9)
24Assert.Equal(pointerName.ElementType.ToString(), name); 31Assert.Equal(predefName.ToString(), typeName); 38Assert.Equal(arrayType.ElementType.ToString(), arrayName); 47Assert.Equal(aliasName.Alias.ToString(), alias); 48Assert.Equal(aliasName.Name.ToString(), name); 56Assert.Equal(dottedName.Left.ToString(), left); 57Assert.Equal(dottedName.Right.ToString(), right); 70Assert.Equal(genericName.TypeArgumentList.Arguments[i].ToString(), str); 80Assert.Equal(genericName.ToString(), name);
LexicalAndXml\XmlDocCommentTests.cs (9)
658Assert.Equal("goo.bar", element.Name.ToString()); 680Assert.Equal("goo:bar", element.Name.ToString()); 702Assert.Equal("abc-def", element.Name.ToString()); 724Assert.Equal("goo123", element.Name.ToString()); 766Assert.Equal("goo", element.StartTag.Name.ToString()); 767Assert.Equal("goo", element.EndTag.Name.ToString()); 800Assert.Equal("goo", element.StartTag.Name.ToString()); 801Assert.Equal("goo", element.EndTag.Name.ToString()); 1292Assert.Equal("class C { }", classdecl.ToString());
Parsing\DeclarationParsingTests.cs (319)
36Assert.Equal(text, file.ToString()); 59Assert.Equal(text, file.ToString()); 69Assert.Equal("a", ud.Name.ToString()); 81Assert.Equal(text, file.ToString()); 91Assert.Equal("a", ud.Name.ToString()); 118Assert.Equal(text, file.ToString()); 133Assert.Equal(text, file.ToString()); 148Assert.Equal(text, file.ToString()); 158Assert.Equal("a.b", ud.Name.ToString()); 170Assert.Equal(text, file.ToString()); 180Assert.Equal("a.b", ud.Name.ToString()); 192Assert.Equal(text, file.ToString()); 202Assert.Equal("a<int?>", ud.Name.ToString()); 214Assert.Equal(text, file.ToString()); 223Assert.Equal("a", ud.Alias.Name.ToString()); 226Assert.Equal("b", ud.Name.ToString()); 238Assert.Equal(text, file.ToString()); 247Assert.Equal("a", ud.Alias.Name.ToString()); 250Assert.Equal("b<c>", ud.Name.ToString()); 262Assert.Equal(text, file.ToString()); 275Assert.Equal("a", ad.Attributes[0].Name.ToString()); 288Assert.Equal(text, file.ToString()); 304Assert.Equal("a", ad.Attributes[0].Name.ToString()); 317Assert.Equal(text, file.ToString()); 333Assert.Equal("a", ad.Attributes[0].Name.ToString()); 346Assert.Equal(text, file.ToString()); 360Assert.Equal("a", ad.Attributes[0].Name.ToString()); 373Assert.Equal(text, file.ToString()); 388Assert.Equal("a", ad.Attributes[0].Name.ToString()); 401Assert.Equal(text, file.ToString()); 415Assert.Equal("a", ad.Attributes[0].Name.ToString()); 431Assert.Equal(text, file.ToString()); 444Assert.Equal("a", ad.Attributes[0].Name.ToString()); 448Assert.Equal("b", ad.Attributes[0].ArgumentList.Arguments[0].ToString()); 449Assert.Equal("c", ad.Attributes[0].ArgumentList.Arguments[1].ToString()); 462Assert.Equal(text, file.ToString()); 475Assert.Equal("a", ad.Attributes[0].Name.ToString()); 479Assert.Equal("b = c", ad.Attributes[0].ArgumentList.Arguments[0].ToString()); 482Assert.Equal("b", ad.Attributes[0].ArgumentList.Arguments[0].NameEquals.Name.ToString()); 485Assert.Equal("c", ad.Attributes[0].ArgumentList.Arguments[0].Expression.ToString()); 498Assert.Equal(text, file.ToString()); 512Assert.Equal("a", ad.Attributes[0].Name.ToString()); 516Assert.Equal("b", ad.Attributes[1].Name.ToString()); 530Assert.Equal(text, file.ToString()); 542Assert.Equal("a", ad.Attributes[0].Name.ToString()); 554Assert.Equal("b", ad.Attributes[0].Name.ToString()); 567Assert.Equal(text, file.ToString()); 574Assert.Equal("a", ns.Name.ToString()); 589Assert.Equal(text, file.ToString()); 596Assert.Equal("a", ns.Name.ToString()); 610Assert.Equal(text, file.ToString()); 617Assert.Equal("a.b.c", ns.Name.ToString()); 632Assert.Equal(text, file.ToString()); 639Assert.Equal("a", ns.Name.ToString()); 642Assert.Equal("using b.c;", ns.Usings[0].ToString()); 655Assert.Equal(text, file.ToString()); 662Assert.Equal("a", ns.Name.ToString()); 665Assert.Equal("using b.c;", ns.Usings[0].ToString()); 677Assert.Equal(text, file.ToString()); 684Assert.Equal("a", ns.Name.ToString()); 687Assert.Equal("extern alias b;", ns.Externs[0].ToString()); 700Assert.Equal(text, file.ToString()); 707Assert.Equal("a", ns.Name.ToString()); 710Assert.Equal("extern alias b;", ns.Externs[0].ToString()); 729Assert.Equal("a", ns.Name.ToString()); 732Assert.Equal("using b;", ns.Usings[0].ToString()); 746Assert.Equal(text, file.ToString()); 753Assert.Equal("a", ns.Name.ToString()); 761Assert.Equal("b", ns2.Name.ToString()); 777Assert.Equal(text, file.ToString()); 803Assert.Equal(text, file.ToString()); 830Assert.Equal(text, file.ToString()); 857Assert.Equal(text, file.ToString()); 884Assert.Equal(text, file.ToString()); 911Assert.Equal(text, file.ToString()); 938Assert.Equal(text, file.ToString()); 965Assert.Equal(text, file.ToString()); 971Assert.Equal("[attr]", cs.AttributeLists[0].ToString()); 992Assert.Equal(text, file.ToString()); 998Assert.Equal("[attr1]", cs.AttributeLists[0].ToString()); 999Assert.Equal("[attr2]", cs.AttributeLists[1].ToString()); 1020Assert.Equal(text, file.ToString()); 1026Assert.Equal("[attr1, attr2]", cs.AttributeLists[0].ToString()); 1047Assert.Equal(text, file.ToString()); 1062Assert.Equal("b", cs.BaseList.Types[0].Type.ToString()); 1078Assert.Equal(text, file.ToString()); 1093Assert.Equal("b", cs.BaseList.Types[0].Type.ToString()); 1094Assert.Equal("c", cs.BaseList.Types[1].Type.ToString()); 1110Assert.Equal(text, file.ToString()); 1121Assert.Equal("<b>", cs.TypeParameterList.ToString()); 1128Assert.Equal("b", cs.ConstraintClauses[0].Name.ToString()); 1135Assert.Equal("c", bound.Type.ToString()); 1150Assert.Equal(text, file.ToString()); 1169Assert.Equal("b", cs.ConstraintClauses[0].Name.ToString()); 1176Assert.Equal("c", bound.Type.ToString()); 1213Assert.Equal(text, file.ToString()); 1224Assert.Equal("<b>", cs.TypeParameterList.ToString()); 1231Assert.Equal("b", cs.ConstraintClauses[0].Name.ToString()); 1257Assert.Equal(text, file.ToString()); 1268Assert.Equal("<b>", cs.TypeParameterList.ToString()); 1275Assert.Equal("b", cs.ConstraintClauses[0].Name.ToString()); 1298Assert.Equal(text, file.ToString()); 1309Assert.Equal("<b>", cs.TypeParameterList.ToString()); 1316Assert.Equal("b", cs.ConstraintClauses[0].Name.ToString()); 1339Assert.Equal(text, file.ToString()); 1350Assert.Equal("<b>", cs.TypeParameterList.ToString()); 1357Assert.Equal("b", cs.ConstraintClauses[0].Name.ToString()); 1371Assert.Equal("c", typeBound.Type.ToString()); 1395Assert.Equal(text, file.ToString()); 1405Assert.Equal("<b>", cs.TypeParameterList.ToString()); 1413Assert.Equal("b", cs.ConstraintClauses[0].Name.ToString()); 1420Assert.Equal("c", typeBound.Type.ToString()); 1424Assert.Equal("b", cs.ConstraintClauses[1].Name.ToString()); 1450Assert.Equal(text, file.ToString()); 1460Assert.Equal("<b>", cs.TypeParameterList.ToString()); 1468Assert.Equal("b", cs.ConstraintClauses[0].Name.ToString()); 1475Assert.Equal("c", typeBound.Type.ToString()); 1479Assert.Equal("b", cs.ConstraintClauses[1].Name.ToString()); 1496Assert.Equal(text, file.ToString()); 1506Assert.Equal("<b>", cs.TypeParameterList.ToString()); 1514Assert.Equal("b", cs.ConstraintClauses[0].Name.ToString()); 1521Assert.Equal("c", typeBound.Type.ToString()); 1540Assert.Equal(text, file.ToString()); 1551Assert.Equal("<b>", cs.TypeParameterList.ToString()); 1556Assert.Equal("c", cs.BaseList.Types[0].Type.ToString()); 1557Assert.Equal("d", cs.BaseList.Types[1].Type.ToString()); 1562Assert.Equal("b", cs.ConstraintClauses[0].Name.ToString()); 1576Assert.Equal("e", typeBound.Type.ToString()); 1600Assert.Equal(text, file.ToString()); 1625Assert.Equal(text, file.ToString()); 1636Assert.Equal("<B>", gn.ToString()); 1655Assert.Equal(text, file.ToString()); 1667Assert.Equal("<[B] out C>", gn.ToString()); 1670Assert.Equal("B", gn.Parameters[0].AttributeLists[0].Attributes[0].Name.ToString()); 1687Assert.Equal(text, file.ToString()); 1712Assert.Equal(text, file.ToString()); 1752Assert.Equal(text, file.ToString()); 1793Assert.Equal(text, file.ToString()); 1834Assert.Equal(text, file.ToString()); 1876Assert.Equal(text, file.ToString()); 1918Assert.Equal(text, file.ToString()); 1959Assert.Equal(text, file.ToString()); 2000Assert.Equal(text, file.ToString()); 2007Assert.Equal("a", ds.ReturnType.ToString()); 2027Assert.Equal(text, file.ToString()); 2034Assert.Equal("ref a", ds.ReturnType.ToString()); 2055Assert.Equal(text, file.ToString()); 2062Assert.Equal("ref readonly a", ds.ReturnType.ToString()); 2102Assert.Equal(text, file.ToString()); 2109Assert.Equal(typeText, ds.ReturnType.ToString()); 2148Assert.Equal(text, file.ToString()); 2155Assert.Equal("a", ds.ReturnType.ToString()); 2165Assert.Equal(typeText, ds.ParameterList.Parameters[0].Type.ToString()); 2183Assert.Equal(text, file.ToString()); 2190Assert.Equal("a", ds.ReturnType.ToString()); 2200Assert.Equal("c", ds.ParameterList.Parameters[0].Type.ToString()); 2218Assert.Equal(text, file.ToString()); 2225Assert.Equal("a", ds.ReturnType.ToString()); 2235Assert.Equal("c", ds.ParameterList.Parameters[0].Type.ToString()); 2242Assert.Equal("e", ds.ParameterList.Parameters[1].Type.ToString()); 2260Assert.Equal(text, file.ToString()); 2267Assert.Equal("a", ds.ReturnType.ToString()); 2278Assert.Equal("c", ds.ParameterList.Parameters[0].Type.ToString()); 2296Assert.Equal(text, file.ToString()); 2303Assert.Equal("a", ds.ReturnType.ToString()); 2314Assert.Equal("c", ds.ParameterList.Parameters[0].Type.ToString()); 2332Assert.Equal(text, file.ToString()); 2339Assert.Equal("a", ds.ReturnType.ToString()); 2350Assert.Equal("c", ds.ParameterList.Parameters[0].Type.ToString()); 2368Assert.Equal(text, file.ToString()); 2376Assert.Equal("a", ds.ReturnType.ToString()); 2402Assert.Equal(text, file.ToString()); 2409Assert.Equal("a", ds.ReturnType.ToString()); 2417Assert.Equal("[attr]", ds.ParameterList.Parameters[0].AttributeLists[0].ToString()); 2420Assert.Equal("c", ds.ParameterList.Parameters[0].Type.ToString()); 2438Assert.Equal(text, file.ToString()); 2460Assert.Equal("b", ds.ReturnType.ToString()); 2480Assert.Equal(text, file.ToString()); 2503Assert.Equal("b", ms.ReturnType.ToString()); 2526Assert.Equal(text, file.ToString()); 2548Assert.Equal("ref b", ms.ReturnType.ToString()); 2572Assert.Equal(text, file.ToString()); 2594Assert.Equal("ref readonly b", ms.ReturnType.ToString()); 2617Assert.Equal(text, file.ToString()); 2647Assert.Equal(text, file.ToString()); 2675Assert.Equal(text, file.ToString()); 2702Assert.Equal("b", ms.ReturnType.ToString()); 2743Assert.Equal(text, file.ToString()); 2767Assert.Equal("void", ms.ReturnType.ToString()); 2790Assert.Equal(text, file.ToString()); 2814Assert.Equal("void", ms.ReturnType.ToString()); 2837Assert.Equal(text, file.ToString()); 2864Assert.Equal("int", rt.Type.ToString()); 2887Assert.Equal(text, file.ToString()); 2911Assert.Equal("int", propertySyntax.Type.ToString()); 2928Assert.Equal(text, file.ToString()); 2951Assert.Equal("int", propertySyntax.Type.ToString()); 2973Assert.Equal(text, file.ToString()); 2989Assert.Equal(text, file.ToString()); 3012Assert.Equal("b", ms.ReturnType.ToString()); 3021Assert.Equal("c", ms.ParameterList.Parameters[0].Type.ToString()); 3041Assert.Equal(text, file.ToString()); 3064Assert.Equal("b", ms.ReturnType.ToString()); 3075Assert.Equal("c", ms.ParameterList.Parameters[0].Type.ToString()); 3082Assert.Equal("e", ms.ParameterList.Parameters[1].Type.ToString()); 3102Assert.Equal(text, file.ToString()); 3125Assert.Equal("b", ms.ReturnType.ToString()); 3137Assert.Equal("c", ms.ParameterList.Parameters[0].Type.ToString()); 3167Assert.Equal(text, file.ToString()); 3190Assert.Equal("b", ms.ReturnType.ToString()); 3241Assert.Equal(text, file.ToString()); 3264Assert.Equal(typeText, ms.ReturnType.ToString()); 3306Assert.Equal(text, file.ToString()); 3329Assert.Equal("b", ms.ReturnType.ToString()); 3338Assert.Equal(typeText, ms.ParameterList.Parameters[0].Type.ToString()); 3358Assert.Equal(text, file.ToString()); 3381Assert.Equal("b<c>", ms.ReturnType.ToString()); 3404Assert.Equal(text, file.ToString()); 3427Assert.Equal("b", ms.ReturnType.ToString()); 3431Assert.Equal("<c>", ms.TypeParameterList.ToString()); 3441Assert.Equal("b", ms.ConstraintClauses[0].Name.ToString()); 3448Assert.Equal("d", typeBound.Type.ToString()); 3485Assert.Equal(text, file.ToString()); 3520Assert.Equal(text, file.ToString()); 3567Assert.Equal(text, file.ToString()); 3604Assert.Equal(text, file.ToString()); 3627Assert.Equal("b", fs.Declaration.Type.ToString()); 3664Assert.Equal(text, file.ToString()); 3687Assert.Equal(typeText, fs.Declaration.Type.ToString()); 3704Assert.Equal(text, file.ToString()); 3728Assert.Equal("b", fs.Declaration.Type.ToString()); 3758Assert.Equal(text, file.ToString()); 3783Assert.Equal("b", fs.Declaration.Type.ToString()); 3814Assert.Equal(text, file.ToString()); 3838Assert.Equal("b", fs.Declaration.Type.ToString()); 3846Assert.Equal("d", fs.Declaration.Variables[0].Initializer.Value.ToString()); 3859Assert.Equal(text, file.ToString()); 3882Assert.Equal("b", fs.Declaration.Type.ToString()); 3890Assert.Equal("e", fs.Declaration.Variables[0].Initializer.Value.ToString()); 3903Assert.Equal(text, file.ToString()); 3926Assert.Equal("b", fs.Declaration.Type.ToString()); 3935Assert.Equal("{ }", fs.Declaration.Variables[0].Initializer.Value.ToString()); 3948Assert.Equal(text, file.ToString()); 3971Assert.Equal("b", fs.Declaration.Type.ToString()); 4002Assert.Equal(text, file.ToString()); 4025Assert.Equal("b", fs.Declaration.Type.ToString()); 4035Assert.Equal("x", fs.Declaration.Variables[0].Initializer.Value.ToString()); 4043Assert.Equal("y", fs.Declaration.Variables[1].Initializer.Value.ToString()); 4051Assert.Equal("z", fs.Declaration.Variables[2].Initializer.Value.ToString()); 4065Assert.Equal(text, file.ToString()); 4089Assert.Equal("b", fs.Declaration.Type.ToString()); 4097Assert.Equal("10", fs.Declaration.Variables[0].ArgumentList.Arguments[0].ToString()); 4111Assert.Equal(text, file.ToString()); 4134Assert.Equal("b", ps.Type.ToString()); 4165Assert.Equal(text, file.ToString()); 4188Assert.Equal("ref b", ps.Type.ToString()); 4220Assert.Equal(text, file.ToString()); 4243Assert.Equal("ref readonly b", ps.Type.ToString()); 4293Assert.Equal(text, file.ToString()); 4316Assert.Equal(typeText, ps.Type.ToString()); 4347Assert.Equal(text, file.ToString()); 4370Assert.Equal("b", ps.Type.ToString()); 4401Assert.Equal(text, file.ToString()); 4424Assert.Equal("b", ps.Type.ToString()); 4446Assert.Equal("d", ps.Initializer.Value.ToString()); 4485Assert.Equal(text, file.ToString()); 4508Assert.Equal("b", ps.Type.ToString()); 4541Assert.Equal(text, file.ToString()); 4564Assert.Equal("b", es.Type.ToString()); 4597Assert.Equal(text, file.ToString()); 4621Assert.Equal("b", ps.Type.ToString()); 4681Assert.Equal(text, file.ToString()); 4704Assert.Equal("b", ps.Type.ToString()); 4707Assert.Equal("I", ps.ExplicitInterfaceSpecifier.Name.ToString()); 4737Assert.Equal(text, file.ToString()); 4761Assert.Equal("b", es.Type.ToString()); 4791Assert.Equal(text, file.ToString()); 4816Assert.Equal("b", es.Type.ToString()); 4874Assert.Equal(text, file.ToString()); 4898Assert.Equal("b", es.Type.ToString()); 4901Assert.Equal("I", es.ExplicitInterfaceSpecifier.Name.ToString()); 4931Assert.Equal(text, file.ToString()); 4954Assert.Equal("b", ps.Type.ToString()); 4967Assert.Equal("c", ps.ParameterList.Parameters[0].Type.ToString()); 4998Assert.Equal(text, file.ToString()); 5021Assert.Equal("ref b", ps.Type.ToString()); 5034Assert.Equal("c", ps.ParameterList.Parameters[0].Type.ToString()); 5066Assert.Equal(text, file.ToString()); 5089Assert.Equal("ref readonly b", ps.Type.ToString()); 5102Assert.Equal("c", ps.ParameterList.Parameters[0].Type.ToString()); 5133Assert.Equal(text, file.ToString()); 5156Assert.Equal("b", ps.Type.ToString()); 5171Assert.Equal("c", ps.ParameterList.Parameters[0].Type.ToString()); 5178Assert.Equal("e", ps.ParameterList.Parameters[1].Type.ToString()); 5209Assert.Equal(text, file.ToString()); 5232Assert.Equal("b", ps.Type.ToString()); 5234Assert.Equal("I", ps.ExplicitInterfaceSpecifier.Name.ToString()); 5247Assert.Equal("c", ps.ParameterList.Parameters[0].Type.ToString()); 5277Assert.Equal(text, file.ToString()); 5300Assert.Equal("b", ps.ReturnType.ToString()); 5314Assert.Equal("c", ps.ParameterList.Parameters[0].Type.ToString()); 5321Assert.Equal("e", ps.ParameterList.Parameters[1].Type.ToString()); 5357Assert.Equal(text, file.ToString()); 5380Assert.Equal("b", ps.ReturnType.ToString()); 5394Assert.Equal("c", ps.ParameterList.Parameters[0].Type.ToString()); 5401Assert.Equal("e", ps.ParameterList.Parameters[1].Type.ToString()); 5471Assert.Equal(text, file.ToString()); 5494Assert.Equal("b", ps.ReturnType.ToString()); 5508Assert.Equal("c", ps.ParameterList.Parameters[0].Type.ToString()); 5534Assert.Equal(text, file.ToString()); 5561Assert.Equal("b", ms.Type.ToString()); 5569Assert.Equal("c", ms.ParameterList.Parameters[0].Type.ToString()); 5582Assert.Equal(text, file.ToString()); 5609Assert.Equal("b", ms.Type.ToString()); 5617Assert.Equal("c", ms.ParameterList.Parameters[0].Type.ToString()); 5631Assert.Equal(text, file.ToString()); 5643Assert.Equal(text, file.ToString()); 5655Assert.Equal(text, file.ToString()); 5891var stmtText = statement.ToString();
Parsing\DeconstructionTests.cs (1)
1883Assert.Equal("(T, T)[]", declaration.Type.ToString());
Parsing\ExpressionParsingTests.cs (220)
39Assert.Equal(text, expr.ToString()); 421Assert.Equal("Text with ", expr.Contents[0].ToString()); 422Assert.Equal(" parts and new line expressions!", expr.Contents[2].ToString()); 434Assert.Equal(text, expr.ToString()); 446Assert.Equal(text, expr.ToString()); 571Assert.Equal(text, expr.ToString()); 578Assert.Equal("a", us.Operand.ToString()); 602Assert.Equal(text, expr.ToString()); 609Assert.Equal("a", us.Operand.ToString()); 628Assert.Equal(text, expr.ToString()); 635Assert.Equal("(a)", b.Left.ToString()); 636Assert.Equal("b", b.Right.ToString()); 674Assert.Equal(text, expr.ToString()); 681Assert.Equal("(a)", a.Left.ToString()); 682Assert.Equal("b", a.Right.ToString()); 709Assert.Equal(text, expr.ToString()); 716Assert.Equal("(a)", e.Expression.ToString()); 717Assert.Equal("b", e.Name.ToString()); 734Assert.Equal(text, expr.ToString()); 738Assert.Equal("a.b", e.Expression.ToString()); 739Assert.Equal(".c.d?[1]?.e()?.f", e.WhenNotNull.ToString()); 767Assert.Equal(text, expr.ToString()); 771Assert.Equal("a.b", e.Expression.ToString()); 773Assert.Equal(".c.d?[1]?.e()?.f", cons.ToString()); 777Assert.Equal(".c.d", e.Expression.ToString()); 779Assert.Equal("[1]?.e()?.f", cons.ToString()); 783Assert.Equal("[1]", e.Expression.ToString()); 785Assert.Equal(".e()?.f", cons.ToString()); 789Assert.Equal(".e()", e.Expression.ToString()); 791Assert.Equal(".f", cons.ToString()); 807Assert.Equal("a", arg.ToString()); 818Assert.Equal(text, expr.ToString()); 881Assert.Equal(text, expr.ToString()); 890Assert.Equal("a", fs.Expression.ToString()); 891Assert.Equal("b", fs.Type.ToString()); 902Assert.Equal(text, expr.ToString()); 909Assert.Equal("a", ts.Condition.ToString()); 910Assert.Equal("b", ts.WhenTrue.ToString()); 911Assert.Equal("c", ts.WhenFalse.ToString()); 932Assert.Equal(text, expr.ToString()); 941Assert.Equal("a", cs.Type.ToString()); 942Assert.Equal("b", cs.Expression.ToString()); 953Assert.Equal(text, expr.ToString()); 962Assert.Equal("a", cs.Expression.ToString()); 963Assert.Equal("b", cs.ArgumentList.Arguments[0].ToString()); 974Assert.Equal(text, expr.ToString()); 983Assert.Equal("a", cs.Expression.ToString()); 984Assert.Equal("ref b", cs.ArgumentList.Arguments[0].ToString()); 988Assert.Equal("b", cs.ArgumentList.Arguments[0].Expression.ToString()); 999Assert.Equal(text, expr.ToString()); 1008Assert.Equal("a", cs.Expression.ToString()); 1009Assert.Equal("out b", cs.ArgumentList.Arguments[0].ToString()); 1013Assert.Equal("b", cs.ArgumentList.Arguments[0].Expression.ToString()); 1024Assert.Equal(text, expr.ToString()); 1033Assert.Equal("a", cs.Expression.ToString()); 1034Assert.Equal("B: b", cs.ArgumentList.Arguments[0].ToString()); 1036Assert.Equal("B", cs.ArgumentList.Arguments[0].NameColon.Name.ToString()); 1038Assert.Equal("b", cs.ArgumentList.Arguments[0].Expression.ToString()); 1049Assert.Equal(text, expr.ToString()); 1058Assert.Equal("a", ea.Expression.ToString()); 1059Assert.Equal("b", ea.ArgumentList.Arguments[0].ToString()); 1070Assert.Equal(text, expr.ToString()); 1079Assert.Equal("a", ea.Expression.ToString()); 1080Assert.Equal("ref b", ea.ArgumentList.Arguments[0].ToString()); 1084Assert.Equal("b", ea.ArgumentList.Arguments[0].Expression.ToString()); 1095Assert.Equal(text, expr.ToString()); 1104Assert.Equal("a", ea.Expression.ToString()); 1105Assert.Equal("out b", ea.ArgumentList.Arguments[0].ToString()); 1109Assert.Equal("b", ea.ArgumentList.Arguments[0].Expression.ToString()); 1120Assert.Equal(text, expr.ToString()); 1129Assert.Equal("a", ea.Expression.ToString()); 1130Assert.Equal("B: b", ea.ArgumentList.Arguments[0].ToString()); 1141Assert.Equal(text, expr.ToString()); 1151Assert.Equal("a", oc.Type.ToString()); 1163Assert.Equal(text, expr.ToString()); 1172Assert.Equal("b", oc.ArgumentList.Arguments[0].ToString()); 1174Assert.Equal("a", oc.Type.ToString()); 1186Assert.Equal(text, expr.ToString()); 1195Assert.Equal("B: b", oc.ArgumentList.Arguments[0].ToString()); 1197Assert.Equal("a", oc.Type.ToString()); 1209Assert.Equal(text, expr.ToString()); 1219Assert.Equal("a", oc.Type.ToString()); 1237Assert.Equal(text, expr.ToString()); 1242Assert.Equal("a", oc.Type.ToString()); 1260Assert.Equal(text, expr.ToString()); 1265Assert.Equal("a", oc.Type.ToString()); 1273Assert.Equal("b", oc.Initializer.Expressions[0].ToString()); 1284Assert.Equal(text, expr.ToString()); 1289Assert.Equal("a", oc.Type.ToString()); 1297Assert.Equal("b", oc.Initializer.Expressions[0].ToString()); 1298Assert.Equal("c", oc.Initializer.Expressions[1].ToString()); 1299Assert.Equal("d", oc.Initializer.Expressions[2].ToString()); 1310Assert.Equal(text, expr.ToString()); 1315Assert.Equal("a", oc.Type.ToString()); 1323Assert.Equal("B = b", oc.Initializer.Expressions[0].ToString()); 1334Assert.Equal(text, expr.ToString()); 1339Assert.Equal("a", oc.Type.ToString()); 1347Assert.Equal("B = { X = x }", oc.Initializer.Expressions[0].ToString()); 1350Assert.Equal("B", b.Left.ToString()); 1362Assert.Equal(text, expr.ToString()); 1366Assert.Equal("a[1]", ac.Type.ToString()); 1840Assert.Equal(text, expr.ToString()); 1844Assert.Equal("a[]", ac.Type.ToString()); 1851Assert.Equal("b", ac.Initializer.Expressions[0].ToString()); 1862Assert.Equal(text, expr.ToString()); 1866Assert.Equal("a[]", ac.Type.ToString()); 1873Assert.Equal("b", ac.Initializer.Expressions[0].ToString()); 1874Assert.Equal("c", ac.Initializer.Expressions[1].ToString()); 1875Assert.Equal("d", ac.Initializer.Expressions[2].ToString()); 1886Assert.Equal(text, expr.ToString()); 1890Assert.Equal("a[][,][,,]", ac.Type.ToString()); 1897Assert.Equal("b", ac.Initializer.Expressions[0].ToString()); 1908Assert.Equal(text, expr.ToString()); 1917Assert.Equal("b", ac.Initializer.Expressions[0].ToString()); 1928Assert.Equal(text, expr.ToString()); 1937Assert.Equal("a", ac.Initializers[0].ToString()); 1938Assert.Equal("b", ac.Initializers[1].ToString()); 1949Assert.Equal(text, expr.ToString()); 1962Assert.Equal("int a", am.ParameterList.Parameters[0].ToString()); 1980Assert.Equal(text, expr.ToString()); 2010Assert.Equal(text, expr.ToString()); 2035Assert.Equal(text, expr.ToString()); 2042Assert.Equal("b", lambda.Body.ToString()); 2053Assert.Equal(text, expr.ToString()); 2060Assert.Equal("ref b", lambda.Body.ToString()); 2071Assert.Equal(text, expr.ToString()); 2080Assert.Equal("{ }", lambda.Body.ToString()); 2091Assert.Equal(text, expr.ToString()); 2100Assert.Equal("b", lambda.Body.ToString()); 2111Assert.Equal(text, expr.ToString()); 2120Assert.Equal("ref b", lambda.Body.ToString()); 2131Assert.Equal(text, expr.ToString()); 2142Assert.Equal("{ }", lambda.Body.ToString()); 2153Assert.Equal(text, expr.ToString()); 2166Assert.Equal("b", lambda.Body.ToString()); 2177Assert.Equal(text, expr.ToString()); 2193Assert.Equal("b", lambda.Body.ToString()); 2204Assert.Equal(text, expr.ToString()); 2215Assert.Equal("T", ps.Type.ToString()); 2218Assert.Equal("b", lambda.Body.ToString()); 2229Assert.Equal(text, expr.ToString()); 2240Assert.Equal("T", ps.Type.ToString()); 2245Assert.Equal("b", lambda.Body.ToString()); 2256Assert.Equal(text, expr.ToString()); 2276Assert.Equal(text, expr.ToString()); 2286Assert.Equal("arg2", tuple.Arguments[1].NameColon.Name.ToString()); 2297Assert.Equal(text, expr.ToString()); 2311Assert.Equal("A", fs.Expression.ToString()); 2318Assert.Equal("b", ss.Expression.ToString()); 2330Assert.Equal(text, expr.ToString()); 2341Assert.Equal("T", fs.Type.ToString()); 2345Assert.Equal("A", fs.Expression.ToString()); 2351Assert.Equal("b", ss.Expression.ToString()); 2363Assert.Equal(text, expr.ToString()); 2378Assert.Equal("A", fs.Expression.ToString()); 2384Assert.Equal("b", ss.Expression.ToString()); 2401Assert.Equal("d", ss.Expression.ToString()); 2414Assert.Equal(text, expr.ToString()); 2428Assert.Equal("A", fs.Expression.ToString()); 2436Assert.Equal("b", ws.Condition.ToString()); 2442Assert.Equal("c", ss.Expression.ToString()); 2454Assert.Equal(text, expr.ToString()); 2468Assert.Equal("A", fs.Expression.ToString()); 2479Assert.Equal("B", fs.Expression.ToString()); 2485Assert.Equal("c", ss.Expression.ToString()); 2497Assert.Equal(text, expr.ToString()); 2511Assert.Equal("A", fs.Expression.ToString()); 2524Assert.Equal("B", ls.Expression.ToString()); 2530Assert.Equal("c", ss.Expression.ToString()); 2542Assert.Equal(text, expr.ToString()); 2556Assert.Equal("A", fs.Expression.ToString()); 2569Assert.Equal("b", os.Expression.ToString()); 2575Assert.Equal("c", ss.Expression.ToString()); 2587Assert.Equal(text, expr.ToString()); 2601Assert.Equal("A", fs.Expression.ToString()); 2613Assert.Equal("b", os.Expression.ToString()); 2618Assert.Equal("b2", os.Expression.ToString()); 2624Assert.Equal("c", ss.Expression.ToString()); 2636Assert.Equal(text, expr.ToString()); 2650Assert.Equal("A", fs.Expression.ToString()); 2666Assert.Equal("b", os.Expression.ToString()); 2672Assert.Equal("c", ss.Expression.ToString()); 2684Assert.Equal(text, expr.ToString()); 2698Assert.Equal("A", fs.Expression.ToString()); 2714Assert.Equal("b", os.Expression.ToString()); 2720Assert.Equal("c", ss.Expression.ToString()); 2732Assert.Equal(text, expr.ToString()); 2745Assert.Equal("A", fs.Expression.ToString()); 2753Assert.Equal("b", gbs.GroupExpression.ToString()); 2758Assert.Equal("c", gbs.ByExpression.ToString()); 2771Assert.Equal(text, expr.ToString()); 2784Assert.Equal("A", fs.Expression.ToString()); 2791Assert.Equal("b", gbs.GroupExpression.ToString()); 2795Assert.Equal("c", gbs.ByExpression.ToString()); 2811Assert.Equal("e", ss.Expression.ToString()); 2824Assert.Equal(text, expr.ToString()); 2838Assert.Equal("A", fs.Expression.ToString()); 2851Assert.Equal("B", js.InExpression.ToString()); 2856Assert.Equal("a", js.LeftExpression.ToString()); 2861Assert.Equal("b", js.RightExpression.ToString()); 2868Assert.Equal("c", ss.Expression.ToString()); 2880Assert.Equal(text, expr.ToString()); 2891Assert.Equal("Ta", fs.Type.ToString()); 2895Assert.Equal("A", fs.Expression.ToString()); 2902Assert.Equal("Tb", js.Type.ToString()); 2908Assert.Equal("B", js.InExpression.ToString()); 2912Assert.Equal("a", js.LeftExpression.ToString()); 2916Assert.Equal("b", js.RightExpression.ToString()); 2923Assert.Equal("c", ss.Expression.ToString()); 2935Assert.Equal(text, expr.ToString()); 2949Assert.Equal("A", fs.Expression.ToString()); 2961Assert.Equal("B", js.InExpression.ToString()); 2965Assert.Equal("a", js.LeftExpression.ToString()); 2969Assert.Equal("b", js.RightExpression.ToString()); 2980Assert.Equal("d", ss.Expression.ToString()); 2992Assert.Equal(text, expr.ToString()); 3001Assert.Equal("x", gs.GroupExpression.ToString()); 3002Assert.Equal("y", gs.ByExpression.ToString()); 3043Assert.Equal(text, expr.ToString()); 4765Assert.Equal(text, expr.ToString());
Parsing\LocalFunctionParsingTests.cs (2)
1351Assert.Equal("int", s1.ReturnType.ToString()); 1361Assert.Equal("int", s1.ReturnType.ToString());
Parsing\NameParsingTests.cs (39)
39Assert.Equal(text, name.ToString()); 66Assert.Equal(string.Empty, name.ToString()); 81Assert.Equal(string.Empty, name.ToString()); 96Assert.Equal(string.Empty, name.ToString()); 111Assert.Equal(string.Empty, name.ToString()); 124Assert.Equal(text, name.ToString()); 139Assert.Equal(text, name.ToString()); 152Assert.Equal(text, name.ToString()); 165Assert.Equal(text, name.ToString()); 194Assert.Equal(text, name.ToString()); 215Assert.Equal(text, name.ToString()); 231Assert.Equal(text, name.ToString()); 249Assert.Equal(text, name.ToString()); 308Assert.Equal(text, name.ToString()); 325Assert.Equal(text, name.ToString()); 339Assert.Equal(text, name.ToString()); 353Assert.Equal(text, name.ToString()); 370Assert.Equal(text, name.ToString()); 389Assert.Equal(text, name.ToString()); 449Assert.Equal(text, name.ToString()); 478Assert.Equal(text, tname.ToString()); 491Assert.Equal(text, tname.ToString()); 506Assert.Equal(text, tname.ToString()); 520Assert.Equal(text, tname.ToString()); 546Assert.Equal(text, tname.ToString()); 568Assert.Equal(text, tname.ToString()); 590Assert.Equal(text, tname.ToString()); 621Assert.Equal(text, tname.ToString()); 636Assert.Equal(text, tname.ToString()); 646Assert.Equal(text, tname.ToString()); 661Assert.Equal(text, tname.ToString()); 672Assert.Equal(text, tname.ToString()); 687Assert.Equal(text, tname.ToString()); 698Assert.Equal(text, tname.ToString()); 719Assert.Equal(text, tname.ToString()); 730Assert.Equal(text, tname.ToString()); 745Assert.Equal(text, tname.ToString()); 755Assert.Equal(text, tname.ToString()); 771Assert.Equal(text, tname.ToString());
Parsing\StatementParsingTests.cs (234)
60Assert.Equal(text, statement.ToString()); 67Assert.Equal("a()", es.Expression.ToString()); 80Assert.Equal(text, statement.ToString()); 87Assert.Equal("a.b()", es.Expression.ToString()); 100Assert.Equal(text, statement.ToString()); 106Assert.Equal("a<b>()", es.Expression.ToString()); 119Assert.Equal(text, statement.ToString()); 126Assert.Equal("a<b>.c()", es.Expression.ToString()); 139Assert.Equal(text, statement.ToString()); 146Assert.Equal("a.b<c>()", es.Expression.ToString()); 158Assert.Equal(text, statement.ToString()); 169Assert.Equal("a", us.Operand.ToString()); 189Assert.Equal(text, statement.ToString()); 195Assert.Equal("T", ds.Declaration.Type.ToString()); 217Assert.Equal(text, statement.ToString()); 223Assert.Equal("var", ds.Declaration.Type.ToString()); 247Assert.Equal(text, statement.ToString()); 253Assert.Equal("(int, int)", ds.Declaration.Type.ToString()); 281Assert.Equal(text, statement.ToString()); 287Assert.Equal("(T x, (U k, V l, W m) y)", ds.Declaration.Type.ToString()); 298Assert.Equal("(U k, V l, W m)", tt.ToString()); 322Assert.Equal(text, statement.ToString()); 328Assert.Equal("dynamic", ds.Declaration.Type.ToString()); 350Assert.Equal(text, statement.ToString()); 356Assert.Equal("T<a>", ds.Declaration.Type.ToString()); 376Assert.Equal(text, statement.ToString()); 382Assert.Equal("T.X.Y", ds.Declaration.Type.ToString()); 402Assert.Equal(text, statement.ToString()); 408Assert.Equal("T<t>.X<x>.Y<y>", ds.Declaration.Type.ToString()); 428Assert.Equal(text, statement.ToString()); 434Assert.Equal("T[][,][,,]", ds.Declaration.Type.ToString()); 454Assert.Equal(text, statement.ToString()); 460Assert.Equal("T*", ds.Declaration.Type.ToString()); 480Assert.Equal(text, statement.ToString()); 486Assert.Equal("T?", ds.Declaration.Type.ToString()); 506Assert.Equal(text, statement.ToString()); 512Assert.Equal("T", ds.Declaration.Type.ToString()); 541Assert.Equal(text, statement.ToString()); 547Assert.Equal("T", ds.Declaration.Type.ToString()); 557Assert.Equal("b", ds.Declaration.Variables[0].Initializer.Value.ToString()); 571Assert.Equal(text, statement.ToString()); 577Assert.Equal("T", ds.Declaration.Type.ToString()); 586Assert.Equal("va", ds.Declaration.Variables[0].Initializer.Value.ToString()); 594Assert.Equal("vb", ds.Declaration.Variables[1].Initializer.Value.ToString()); 602Assert.Equal("vc", ds.Declaration.Variables[2].Initializer.Value.ToString()); 616Assert.Equal(text, statement.ToString()); 622Assert.Equal("T", ds.Declaration.Type.ToString()); 633Assert.Equal("{b, c}", ds.Declaration.Variables[0].Initializer.Value.ToString()); 647Assert.Equal(text, statement.ToString()); 654Assert.Equal("T", ds.Declaration.Type.ToString()); 664Assert.Equal("b", ds.Declaration.Variables[0].Initializer.Value.ToString()); 678Assert.Equal(text, statement.ToString()); 686Assert.Equal("T", ds.Declaration.Type.ToString()); 696Assert.Equal("b", ds.Declaration.Variables[0].Initializer.Value.ToString()); 710Assert.Equal(text, statement.ToString()); 718Assert.Equal("T", ds.Declaration.Type.ToString()); 728Assert.Equal("b", ds.Declaration.Variables[0].Initializer.Value.ToString()); 742Assert.Equal(text, statement.ToString()); 750Assert.Equal("T", ds.Declaration.Type.ToString()); 760Assert.Equal("b", ds.Declaration.Variables[0].Initializer.Value.ToString()); 774Assert.Equal(text, statement.ToString()); 780Assert.Equal("ref T", ds.Declaration.Type.ToString()); 800Assert.Equal(text, statement.ToString()); 806Assert.Equal("ref T", ds.Declaration.Type.ToString()); 817Assert.Equal("ref b", initializer.Value.ToString()); 831Assert.Equal(text, statement.ToString()); 837Assert.Equal("ref T", ds.Declaration.Type.ToString()); 848Assert.Equal("ref b", initializer.Value.ToString()); 858Assert.Equal("ref d", initializer.Value.ToString()); 872Assert.Equal(text, statement.ToString()); 883Assert.Equal("T", fs.Declaration.Type.ToString()); 885Assert.Equal("a = b", fs.Declaration.Variables[0].ToString()); 888Assert.Equal("{ }", fs.Statement.ToString()); 899Assert.Equal(text, statement.ToString()); 910Assert.Equal("var", fs.Declaration.Type.ToString()); 915Assert.Equal("a = b", fs.Declaration.Variables[0].ToString()); 918Assert.Equal("{ }", fs.Statement.ToString()); 929Assert.Equal(text, statement.ToString()); 940Assert.Equal("T", fs.Declaration.Type.ToString()); 942Assert.Equal("a = b", fs.Declaration.Variables[0].ToString()); 943Assert.Equal("c = d", fs.Declaration.Variables[1].ToString()); 946Assert.Equal("{ }", fs.Statement.ToString()); 957Assert.Equal(text, statement.ToString()); 973Assert.Equal(text, statement.ToString()); 983Assert.Equal(";", ls.Statement.ToString()); 994Assert.Equal(text, statement.ToString()); 1013Assert.Equal(text, statement.ToString()); 1032Assert.Equal(text, statement.ToString()); 1041Assert.Equal("label", gs.Expression.ToString()); 1054Assert.Equal(text, statement.ToString()); 1065Assert.Equal("label", gs.Expression.ToString()); 1078Assert.Equal(text, statement.ToString()); 1101Assert.Equal(text, statement.ToString()); 1121Assert.Equal(text, statement.ToString()); 1129Assert.Equal("a", rs.Expression.ToString()); 1142Assert.Equal(text, statement.ToString()); 1153Assert.Equal("a", ys.Expression.ToString()); 1166Assert.Equal(text, statement.ToString()); 1189Assert.Equal(text, statement.ToString()); 1209Assert.Equal(text, statement.ToString()); 1217Assert.Equal("a", ts.Expression.ToString()); 1230Assert.Equal(text, statement.ToString()); 1243Assert.Equal("T", ts.Catches[0].Declaration.Type.ToString()); 1260Assert.Equal(text, statement.ToString()); 1273Assert.Equal("T", ts.Catches[0].Declaration.Type.ToString()); 1289Assert.Equal(text, statement.ToString()); 1313Assert.Equal(text, statement.ToString()); 1327Assert.Equal("T", ts.Catches[0].Declaration.Type.ToString()); 1337Assert.Equal("T2", ts.Catches[1].Declaration.Type.ToString()); 1356Assert.Equal(text, statement.ToString()); 1379Assert.Equal(text, statement.ToString()); 1393Assert.Equal("T", ts.Catches[0].Declaration.Type.ToString()); 1403Assert.Equal("T2", ts.Catches[1].Declaration.Type.ToString()); 1424Assert.Equal(text, statement.ToString()); 1441Assert.Equal(text, statement.ToString()); 1458Assert.Equal(text, statement.ToString()); 1475Assert.Equal(text, statement.ToString()); 1484Assert.Equal("a", ws.Condition.ToString()); 1497Assert.Equal(text, statement.ToString()); 1510Assert.Equal("a", ds.Condition.ToString()); 1522Assert.Equal(text, statement.ToString()); 1548Assert.Equal(text, statement.ToString()); 1559Assert.Equal("T", fs.Declaration.Type.ToString()); 1566Assert.Equal("0", fs.Declaration.Variables[0].Initializer.Value.ToString()); 1585Assert.Equal(text, statement.ToString()); 1596Assert.Equal("var", fs.Declaration.Type.ToString()); 1605Assert.Equal("0", fs.Declaration.Variables[0].Initializer.Value.ToString()); 1624Assert.Equal(text, statement.ToString()); 1635Assert.Equal("T", fs.Declaration.Type.ToString()); 1643Assert.Equal("0", fs.Declaration.Variables[0].Initializer.Value.ToString()); 1650Assert.Equal("1", fs.Declaration.Variables[1].Initializer.Value.ToString()); 1733Assert.Equal(text, statement.ToString()); 1744Assert.Equal("a = 0", fs.Initializers[0].ToString()); 1762Assert.Equal(text, statement.ToString()); 1773Assert.Equal("a = 0", fs.Initializers[0].ToString()); 1774Assert.Equal("b = 1", fs.Initializers[1].ToString()); 1792Assert.Equal(text, statement.ToString()); 1806Assert.Equal("a", fs.Condition.ToString()); 1822Assert.Equal(text, statement.ToString()); 1838Assert.Equal("a++", fs.Incrementors[0].ToString()); 1852Assert.Equal(text, statement.ToString()); 1868Assert.Equal("a++", fs.Incrementors[0].ToString()); 1869Assert.Equal("b++", fs.Incrementors[1].ToString()); 1883Assert.Equal(text, statement.ToString()); 1894Assert.Equal("T", fs.Declaration.Type.ToString()); 1901Assert.Equal("0", fs.Declaration.Variables[0].Initializer.Value.ToString()); 1907Assert.Equal("a < 10", fs.Condition.ToString()); 1912Assert.Equal("a++", fs.Incrementors[0].ToString()); 1926Assert.Equal(text, statement.ToString()); 1935Assert.Equal("T", fs.Type.ToString()); 1942Assert.Equal("b", fs.Expression.ToString()); 1955Assert.Equal(text, statement.ToString()); 1968Assert.Equal("T", fs.Type.ToString()); 1975Assert.Equal("b", fs.Expression.ToString()); 1988Assert.Equal(text, statement.ToString()); 1997Assert.Equal("var", fs.Type.ToString()); 2006Assert.Equal("b", fs.Expression.ToString()); 2019Assert.Equal(text, statement.ToString()); 2027Assert.Equal("a", ss.Condition.ToString()); 2042Assert.Equal(text, statement.ToString()); 2050Assert.Equal("a", ss.Condition.ToString()); 2068Assert.Equal(text, statement.ToString()); 2076Assert.Equal("a", ss.Condition.ToString()); 2089Assert.Equal("b", subIf.Condition.ToString()); 2102Assert.Equal(text, statement.ToString()); 2110Assert.Equal("a", ls.Expression.ToString()); 2123Assert.Equal(text, statement.ToString()); 2133Assert.Equal("a", ss.Expression.ToString()); 2148Assert.Equal(text, statement.ToString()); 2156Assert.Equal("a", ss.Expression.ToString()); 2167Assert.Equal("b", caseLabelSyntax.Value.ToString()); 2170Assert.Equal(";", ss.Sections[0].Statements[0].ToString()); 2183Assert.Equal(text, statement.ToString()); 2191Assert.Equal("a", ss.Expression.ToString()); 2203Assert.Equal("b", caseLabelSyntax.Value.ToString()); 2206Assert.Equal(";", ss.Sections[0].Statements[0].ToString()); 2214Assert.Equal("c", caseLabelSyntax2.Value.ToString()); 2217Assert.Equal(";", ss.Sections[0].Statements[0].ToString()); 2230Assert.Equal(text, statement.ToString()); 2238Assert.Equal("a", ss.Expression.ToString()); 2250Assert.Equal(";", ss.Sections[0].Statements[0].ToString()); 2263Assert.Equal(text, statement.ToString()); 2271Assert.Equal("a", ss.Expression.ToString()); 2283Assert.Equal("b", caseLabelSyntax.Value.ToString()); 2289Assert.Equal("c", caseLabelSyntax2.Value.ToString()); 2292Assert.Equal(";", ss.Sections[0].Statements[0].ToString()); 2305Assert.Equal(text, statement.ToString()); 2313Assert.Equal("a", ss.Expression.ToString()); 2325Assert.Equal("b", caseLabelSyntax.Value.ToString()); 2327Assert.Equal("s1();", ss.Sections[0].Statements[0].ToString()); 2328Assert.Equal("s2();", ss.Sections[0].Statements[1].ToString()); 2341Assert.Equal(text, statement.ToString()); 2350Assert.Equal("a", us.Expression.ToString()); 2363Assert.Equal(text, statement.ToString()); 2373Assert.Equal("T", us.Declaration.Type.ToString()); 2381Assert.Equal("b", us.Declaration.Variables[0].Initializer.Value.ToString()); 2397Assert.Equal(text, statement.ToString()); 2406Assert.Equal("T", us.Declaration.Type.ToString()); 2414Assert.Equal("b", us.Declaration.Variables[0].Initializer.Value.ToString()); 2456Assert.Equal(text, statement.ToString()); 2466Assert.Equal("var", us.Declaration.Type.ToString()); 2476Assert.Equal("b", us.Declaration.Variables[0].Initializer.Value.ToString()); 2492Assert.Equal(text, statement.ToString()); 2501Assert.Equal("var", us.Declaration.Type.ToString()); 2511Assert.Equal("b", us.Declaration.Variables[0].Initializer.Value.ToString()); 2624Assert.Equal(text, statement.ToString()); 2635Assert.Equal("var", us.Declaration.Type.ToString()); 2645Assert.Equal("b", us.Declaration.Variables[0].Initializer.Value.ToString()); 2796Assert.Equal(text, statement.ToString()); 2806Assert.Equal("T", us.Declaration.Type.ToString()); 2816Assert.Equal("b", us.Declaration.Variables[0].Initializer.Value.ToString()); 2824Assert.Equal("d", us.Declaration.Variables[1].Initializer.Value.ToString()); 2840Assert.Equal(text, statement.ToString()); 2849Assert.Equal("T", us.Declaration.Type.ToString()); 2859Assert.Equal("b", us.Declaration.Variables[0].Initializer.Value.ToString()); 2867Assert.Equal("d", us.Declaration.Variables[1].Initializer.Value.ToString()); 2921Assert.Equal(text, statement.ToString()); 2930Assert.Equal("f ? x = a : x = b", us.Expression.ToString()); 2943Assert.Equal(text, statement.ToString()); 2950Assert.Equal("var x = f ? a : b", us.Declaration.ToString()); 3004Assert.Equal(text, statement.ToString()); 3012Assert.Equal("f ? x = a", us.Declaration.ToString()); 3026Assert.Equal(text, statement.ToString()); 3033Assert.Equal("f ? x = a", us.Declaration.ToString()); 3076Assert.Equal(text, statement.ToString()); 3084Assert.Equal("f ? x, y", us.Declaration.ToString()); 3098Assert.Equal(text, statement.ToString()); 3105Assert.Equal("f ? x, y", us.Declaration.ToString()); 3346Assert.Equal(text, statement.ToString()); 3349Assert.Equal(keywordText, decl.Declaration.Type.ToString()); 3374Assert.Equal(text, statement.ToString()); 3383Assert.Equal("T", fs.Type.ToString()); 3390Assert.Equal("b", fs.Expression.ToString()); 3554Assert.Equal(text, statement.ToString());
Syntax\StructuredTriviaTests.cs (3)
54Assert.Equal("<goo> </goo>", xmlElement.ToString()); 61Assert.Equal("<goo> </goo>", child.ToString()); 63Assert.Equal("<goo>", child.StartTag.ToString());
Syntax\SyntaxFactoryTests.cs (1)
114Assert.Equal("#pragmachecksum\"file\"\"guid\"\"bytes\"", t.ToString());
Syntax\SyntaxListTests.cs (1)
306Assert.Equal(expectedArgName, ((ArgumentSyntax)item).Expression.ToString());
Syntax\SyntaxNodeTests.cs (35)
56var text = qname2.ToString(); 126Assert.Equal("(d / e)", firstParens.ToString()); 526Assert.Equal(identifierNodes[i].ToString(), nodesWithMyAnnotations[i].ToString()); 1781Assert.Equal(rootNode.Span.Length, rootNode.ToString().Length); 1782Assert.True(rootNode.ToString().Contains("/*END*/")); 1783Assert.False(rootNode.ToString().Contains("/*START*/")); 1799Assert.Equal(rootNode.Span.Length, rootNode.ToString().Length); 1800Assert.True(rootNode.ToString().Contains("/*END*/")); 1801Assert.False(rootNode.ToString().Contains("/*START*/")); 1862Assert.Equal("Goo.Bar", qualified.ToString()); 1867Assert.Equal("Bar<int>", generic.ToString()); 1872Assert.Equal("Goo.Bar<int>", qualifiedGeneric.ToString()); 1877Assert.Equal("alias::Goo", alias.ToString()); 1882Assert.Equal("alias::Bar<int>", aliasGeneric.ToString()); 1887Assert.Equal("alias::Goo.Bar", aliasQualified.ToString()); 1892Assert.Equal("alias::Goo.Bar<int>", aliasQualifiedGeneric.ToString()); 2256Assert.Equal("a + c", expr2.ToString()); 3523Assert.Equal("class A { }", node.ToString()); 3856var withAsync = expression.WithAsyncKeyword(SyntaxFactory.Token(SyntaxKind.AsyncKeyword).WithTrailingTrivia(SyntaxFactory.Space)).ToString(); 3865var withAsync = expression.WithAsyncKeyword(SyntaxFactory.Token(SyntaxKind.AsyncKeyword).WithTrailingTrivia(SyntaxFactory.Space)).ToString(); 3874var withAsync = expression.WithAsyncKeyword(SyntaxFactory.Token(SyntaxKind.AsyncKeyword).WithTrailingTrivia(SyntaxFactory.Space)).ToString(); 3883var withAsync = expression.WithAsyncKeyword(SyntaxFactory.Token(SyntaxKind.AsyncKeyword).WithTrailingTrivia(SyntaxFactory.Space)).ToString(); 3892var withAsync = expression.WithAsyncKeyword(SyntaxFactory.Token(SyntaxKind.AsyncKeyword).WithTrailingTrivia(SyntaxFactory.Space)).ToString(); 3901var withAsync = expression.WithAsyncKeyword(SyntaxFactory.Token(SyntaxKind.AsyncKeyword).WithTrailingTrivia(SyntaxFactory.Space)).ToString(); 3910var withAsync = expression.WithAsyncKeyword(default).ToString(); 3919var withAsync = expression.WithAsyncKeyword(default).ToString(); 3928var withAsync = expression.WithAsyncKeyword(default).ToString(); 3937var withAsync = expression.WithAsyncKeyword(default).ToString(); 3946var withAsync = expression.WithAsyncKeyword(default).ToString(); 3955var withAsync = expression.WithAsyncKeyword(default).ToString(); 3965var withAsync = expression.WithAsyncKeyword(newAsync).ToString(); 3975Assert.Equal("static delegate(int i) { }", withAsync.ToString()); 4003var newExpression = expression.Update(replacedKeyword, expression.Type).ToString(); 4015Assert.Equal("string s", newParameter.ToString());
Syntax\SyntaxRewriterTests.cs (4)
76(node.IsKind(SyntaxKind.IdentifierName) && node.ToString() == "C") ? null : node); 100(node.IsKind(SyntaxKind.IdentifierName) && node.ToString() != "A") ? null : node); 243(node.IsKind(SyntaxKind.ExpressionStatement) && node.ToString().Contains("B")) ? null : node); 306(node.IsKind(SyntaxKind.IdentifierName) && node.ToString() == "D") ? null : node);
Syntax\SyntaxTreeTests.cs (6)
249Assert.Equal(newRoot.ToString(), newTree.GetRoot().ToString()); 267Assert.Equal(newRoot.ToString(), newTree.GetRoot().ToString()); 280Assert.Equal(newRoot.ToString(), newTree.GetRoot().ToString());
Syntax\TrackNodeTests.cs (6)
28Assert.Equal("a", currentA.ToString()); 40Assert.Equal("a", currentAs.ElementAt(0).ToString()); 141Assert.Equal("a", nodes[0].ToString()); 142Assert.Equal("a", nodes[1].ToString()); 159Assert.Equal(id.ToString(), currentId.ToString());
Microsoft.CodeAnalysis.CSharp.Test.Utilities (4)
CSharpTestBase.cs (3)
1755while ((node != null && node.ToString() != bindText)) 1765if (node.Parent != null && node.Parent.ToString() == bindText) 1778Assert.Equal(bindText, node.ToString());
FunctionPointerUtilities.cs (1)
145AssertEx.Equal(expectedSyntax, syntax.ToString());
Microsoft.CodeAnalysis.CSharp.Workspaces (8)
CodeGeneration\CSharpSyntaxGenerator.cs (4)
1910BaseNamespaceDeclarationSyntax namespaceDeclaration => namespaceDeclaration.Name.ToString(), 1911UsingDirectiveSyntax usingDirective => usingDirective.Name?.ToString() ?? string.Empty, 1917AttributeListSyntax attributeList when attributeList.Attributes.Count == 1 => attributeList.Attributes[0].Name.ToString(), 1918AttributeSyntax attribute => attribute.Name.ToString(),
FindSymbols\CSharpDeclaredSymbolInfoFactoryService.cs (1)
580builder.Append(parameter.Type.ConvertToSingleLine().ToString());
Simplification\Simplifiers\NameSimplifier.cs (1)
667var reparsedCastExpression = ParseExpression(newCastExpression.ToString());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (1)
838name = (memberDeclaration as ConversionOperatorDeclarationSyntax)?.Type.ToString();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (1)
2739invocation.Expression.ToString() == "var";
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (56)
CodeGeneration\SyntaxGeneratorTests.cs (56)
3194Assert.Equal("t", Generator.GetType(Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"))).ToString()); 3197Assert.Equal("t", Generator.GetType(Generator.FieldDeclaration("f", Generator.IdentifierName("t"))).ToString()); 3198Assert.Equal("t", Generator.GetType(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"))).ToString()); 3200Assert.Equal("t", Generator.GetType(Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))).ToString()); 3202Assert.Equal("t", Generator.GetType(Generator.EventDeclaration("ef", Generator.IdentifierName("t"))).ToString()); 3203Assert.Equal("t", Generator.GetType(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"))).ToString()); 3205Assert.Equal("t", Generator.GetType(Generator.DelegateDeclaration("t", returnType: Generator.IdentifierName("t"))).ToString()); 3208Assert.Equal("t", Generator.GetType(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "v")).ToString()); 3217Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()); 3218Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.FieldDeclaration("f", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()); 3219Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.PropertyDeclaration("p", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()); 3221Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.ParameterDeclaration("p", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()); 3223Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.DelegateDeclaration("t"), Generator.IdentifierName("t"))).ToString()); 3225Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.EventDeclaration("ef", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()); 3226Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()); 3228Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.LocalDeclarationStatement(Generator.IdentifierName("x"), "v"), Generator.IdentifierName("t"))).ToString()); 3282Assert.Equal("x", Generator.GetExpression(Generator.FieldDeclaration("f", Generator.IdentifierName("t"), initializer: Generator.IdentifierName("x"))).ToString()); 3283Assert.Equal("x", Generator.GetExpression(Generator.ParameterDeclaration("p", Generator.IdentifierName("t"), initializer: Generator.IdentifierName("x"))).ToString()); 3284Assert.Equal("x", Generator.GetExpression(Generator.LocalDeclarationStatement("loc", initializer: Generator.IdentifierName("x"))).ToString()); 3289Assert.Equal("x", Generator.GetExpression(Generator.ValueReturningLambdaExpression(Generator.IdentifierName("x"))).ToString()); 3290Assert.Equal("x", Generator.GetExpression(Generator.VoidReturningLambdaExpression(Generator.IdentifierName("x"))).ToString()); 3291Assert.Equal("x", Generator.GetExpression(Generator.ValueReturningLambdaExpression("p", Generator.IdentifierName("x"))).ToString()); 3292Assert.Equal("x", Generator.GetExpression(Generator.VoidReturningLambdaExpression("p", Generator.IdentifierName("x"))).ToString()); 3302Assert.Equal("x", Generator.GetExpression(method).ToString()); 3309Assert.Equal("x", Generator.GetExpression(local).ToString()); 3316Assert.Equal("x", Generator.GetExpression(Generator.WithExpression(Generator.FieldDeclaration("f", Generator.IdentifierName("t")), Generator.IdentifierName("x"))).ToString()); 3317Assert.Equal("x", Generator.GetExpression(Generator.WithExpression(Generator.ParameterDeclaration("p", Generator.IdentifierName("t")), Generator.IdentifierName("x"))).ToString()); 3318Assert.Equal("x", Generator.GetExpression(Generator.WithExpression(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "loc"), Generator.IdentifierName("x"))).ToString()); 3321Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.ValueReturningLambdaExpression("p", [Generator.IdentifierName("x")]), Generator.IdentifierName("y"))).ToString()); 3322Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.VoidReturningLambdaExpression("p", [Generator.IdentifierName("x")]), Generator.IdentifierName("y"))).ToString()); 3325Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.ValueReturningLambdaExpression("p", Generator.IdentifierName("x")), Generator.IdentifierName("y"))).ToString()); 3326Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.VoidReturningLambdaExpression("p", Generator.IdentifierName("x")), Generator.IdentifierName("y"))).ToString()); 3327Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.ValueReturningLambdaExpression(Generator.IdentifierName("x")), Generator.IdentifierName("y"))).ToString()); 3328Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.VoidReturningLambdaExpression(Generator.IdentifierName("x")), Generator.IdentifierName("y"))).ToString()); 3338Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(method, Generator.IdentifierName("y"))).ToString()); 3345Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(local, Generator.IdentifierName("y"))).ToString()); 3500Assert.Equal("100", Generator.GetExpression(x).ToString()); 3501Assert.Equal("300", Generator.GetExpression(y).ToString()); 3503Assert.Equal("500", Generator.GetExpression(Generator.WithExpression(x, Generator.LiteralExpression(500))).ToString()); 3504Assert.Equal("500", Generator.GetExpression(Generator.WithExpression(y, Generator.LiteralExpression(500))).ToString()); 3505Assert.Equal("500", Generator.GetExpression(Generator.WithExpression(z, Generator.LiteralExpression(500))).ToString()); 3523Assert.Equal("p * 10", Generator.GetExpression(y).ToString()); 3526Assert.Equal("500", Generator.GetExpression(Generator.WithExpression(y, Generator.LiteralExpression(500))).ToString()); 3645Assert.Equal("B", baseListBI[0].ToString()); 3646Assert.Equal("I", baseListBI[1].ToString()); 3656Assert.Equal("B", baseListB[0].ToString()); 3797Assert.Equal("int", Generator.GetType(declX).ToString()); 3803Assert.Equal("int", Generator.GetType(declY).ToString()); 3809Assert.Equal("int", Generator.GetType(declZ).ToString()); 3817Assert.Equal("T", Generator.GetType(xTypedT).ToString()); 3827Assert.Equal("e", Generator.GetExpression(xInitialized).ToString()); 3843Assert.Equal("[A]", Generator.GetAttributes(xAttributed)[0].ToString()); 4145Assert.Equal("[Q]", xNamedQ.ToString()); 4150Assert.Equal("[X(e)]", xWithArg.ToString()); 4325Assert.Equal("[Q]", xNamedQ.ToString()); 4330Assert.Equal("[X(e)]", xWithArg.ToString());
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (2)
Semantics\SpeculationAnalyzerTestsBase.cs (2)
36var initialNode = initialTree.GetRoot().DescendantNodes().First(n => IsExpressionNode(n) && n.ToString() == (expressionToAnalyze ?? initialExpression)); 39var replacementNode = replacementTree.GetRoot().DescendantNodes().First(n => IsExpressionNode(n) && n.ToString() == (expressionToAnalyze ?? replacementExpression));
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (2)
Diagnostics\DiagnosticAnalyzerServiceTests.cs (2)
683var attribute1 = root.FindNode(diagnostics[0].DataLocation.UnmappedFileSpan.GetClampedTextSpan(text)).ToString(); 685var attribute2 = root.FindNode(diagnostics[1].DataLocation.UnmappedFileSpan.GetClampedTextSpan(text)).ToString();
Microsoft.CodeAnalysis.Features (6)
ConvertForEachToFor\AbstractConvertForEachToForCodeRefactoringProvider.cs (1)
116var collectionVariableToken = generator.Identifier(collectionVariable.ToString()).WithAdditionalAnnotations(RenameAnnotation.Create());
Diagnostics\Analyzers\UnboundIdentifiersDiagnosticAnalyzerBase.cs (1)
81context.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptor, typeName.GetLocation(), typeName.ToString()));
Shared\Utilities\ExtractTypeHelpers.cs (1)
127return Formatter.Format(syntaxGenerator.SyntaxGeneratorInternal.TypeParameterList(typeParameterNames), document.Project.Solution.Services, formattingOptions, cancellationToken).ToString();
Snippets\SnippetProviders\AbstractConditionalBlockSnippetProvider.cs (1)
29return [new SnippetPlaceholder(condition.ToString(), condition.SpanStart)];
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (1)
301id = idNode.ToString();
src\Analyzers\Core\Analyzers\ValidateFormatString\AbstractValidateFormatStringDiagnosticAnalyzer.cs (1)
147var formatString = formatStringLiteralExpressionSyntax.ToString();
Microsoft.CodeAnalysis.Features.Test.Utilities (2)
EditAndContinue\EditAndContinueTestVerifier.cs (2)
518Old = partners.Key.ToString().Replace("\r\n", " ").Replace("\n", " "), 519New = partners.Value.ToString().Replace("\r\n", " ").Replace("\n", " ")
Microsoft.CodeAnalysis.Test.Utilities (9)
Compilation\CompilationExtensions.cs (1)
337Assert.False(true, $"Duplicate explicit node for syntax ({operation.Syntax.RawKind}): {operation.Syntax.ToString()}");
Compilation\OperationTreeVerifier.cs (2)
163var text = syntax.ToString().Trim(Environment.NewLine.ToCharArray()); 317Assert.False(true, $"Duplicate explicit node for syntax ({operation.Syntax.RawKind}): {operation.Syntax.ToString()}");
Compilation\SemanticModelExtensions.cs (1)
30actualTextBuilder.Append($" SemanticModel.GetOperation() returned NULL for node with text: '{node.ToString()}'");
Compilation\TestOperationVisitor.cs (2)
204Assert.False(true, $"Duplicate explicit node for syntax ({descendant.Syntax.RawKind}): {descendant.Syntax.ToString()}"); 588Assert.True(operation.Descendants().All(n => n.IsImplicit), $"Explicit node in default argument value ({operation.Syntax.RawKind}): {operation.Syntax.ToString()}");
Diagnostics\CommonDiagnosticAnalyzers.cs (2)
2074operationContext.ReportDiagnostic(Diagnostic.Create(OperationRule, Location.None, symbolStartContext.Symbol.Name, operationContext.ContainingSymbol.Name, operationContext.Operation.Syntax.ToString(), _analyzerId)); 2149diagnostics.Add(Diagnostic.Create(OperationOrderingRule, Location.None, symbolStartContext.Symbol, operationContext.Operation.Syntax.ToString(), _analyzerId));
Diagnostics\OperationTestAnalyzer.cs (1)
2052operationContext.ReportDiagnostic(Diagnostic.Create(LiteralDescriptor, literal.Syntax.GetLocation(), literal.Syntax.ToString()));
Microsoft.CodeAnalysis.UnitTests (4)
CommonSyntaxTests.cs (4)
81Assert.Equal("test", node.ToString()); 97Assert.Equal("test", node.ToString()); 220Assert.Equal("(((a) + (b)) + (c)) + (d)", trackedExpr.ToString()); 243Assert.Equal("(((a) + (b)) + (c)) + (d)", trackedExpr.ToString());
Microsoft.CodeAnalysis.VisualBasic (2)
Binding\Binder_Invocation.vb (1)
3168callerInfoValue = ConstantValue.Create(argumentSyntax.ToString())
Lowering\LambdaRewriter\LambdaRewriter.vb (1)
1394node.Syntax.ToString(), String.Empty, label.Name)
Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests (1)
CommandLineTests.vb (1)
791Assert.Equal(expectedImportStrings(i), actualImports(i).Clause.ToString)
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (2)
EndConstructGeneration\EndConstructStatementVisitor_Properties.vb (1)
192valueSuffix = " " & propertyDeclaration.AsClause.ToString
EndConstructGeneration\VisualBasicEndConstructGenerationService.vb (1)
425Dim endTagText = "</" & xmlStartElement.Name.ToString & ">"
Microsoft.CodeAnalysis.VisualBasic.ExpressionCompiler (1)
Rewriters\CapturedVariableRewriter.vb (1)
158_diagnostics.Add(New VBDiagnostic(ErrorFactory.ErrorInfo(ERRID.ERR_UseOfKeywordNotInInstanceMethod1, syntax.ToString()), syntax.GetLocation()))
Microsoft.CodeAnalysis.VisualBasic.Features (11)
CodeFixes\IncorrectExitContinue\IncorrectExitContinueCodeFixProvider.vb (1)
330Return String.Format(VBFeaturesResources.Delete_the_0_statement1, node.ToString().Trim())
CodeLens\VisualBasicDisplayInfoService.vb (1)
121Return node.ToString()
Completion\KeywordRecommenders\Declarations\OfKeywordRecommender.vb (1)
109name:=type.ToString())
ConvertForEachToFor\VisualBasicConvertForEachToForCodeRefactoringProvider.vb (1)
131Dim foreachVariableToken = generator.Identifier(foreachVariable.ToString())
ExtractMethod\VisualBasicMethodExtractor.PostProcessor.vb (4)
202Dim variableName = declaration.Declarators(0).Names(0).ToString() 204If assignment.Left.ToString() <> variableName Then 239Dim variableName = declaration.Declarators(0).Names(0).ToString() 240If returnStatement.Expression.ToString() <> variableName Then
GenerateType\VisualBasicGenerateTypeService.vb (3)
657If membersImport.Name IsNot Nothing AndAlso membersImport.Name.ToString().Equals(memberImportsClause.Name.ToString()) Then 696name:=propertyName.ToString,
Microsoft.CodeAnalysis.VisualBasic.Features.UnitTests (2)
EditAndContinue\SyntaxUtilitiesTests.vb (2)
86Assert.Equal("0", leftNode.ToString()) 130Assert.Equal("3", leftNode.ToString())
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (44)
Compilation\GetImportScopesTests.vb (8)
351Assert.Equal("<xmlns:r1=""http://roslyn"">", scopes.Single().XmlNamespaces.Single().DeclaringSyntaxReference.GetSyntax().ToString()) 369Assert.Equal("<xmlns:r1=""http://roslyn"">", scopes.Single().XmlNamespaces.Single().DeclaringSyntaxReference.GetSyntax().ToString()) 391Assert.Equal("<xmlns:r1=""http://roslyn"">", scopes.Single().XmlNamespaces.Single().DeclaringSyntaxReference.GetSyntax().ToString()) 411Assert.True(scopes.Single().XmlNamespaces.Any(Function(x) x.DeclaringSyntaxReference.GetSyntax().ToString() = "<xmlns:r1=""http://roslyn"">")) 415Assert.True(scopes.Single().XmlNamespaces.Any(Function(x) x.DeclaringSyntaxReference.GetSyntax().ToString() = "<xmlns:r2=""http://roslyn2"">")) 442Assert.Equal("<xmlns:r1=""http://roslyn"">", scopes.Single().XmlNamespaces.Single().DeclaringSyntaxReference.GetSyntax().ToString()) 466Assert.Equal("<xmlns:r1=""http://roslyn"">", scopes.Single().XmlNamespaces.Single().DeclaringSyntaxReference.GetSyntax().ToString()) 492Assert.Equal("<xmlns:r1=""http://roslyn"">", scopes.Single().XmlNamespaces.Single().DeclaringSyntaxReference.GetSyntax().ToString())
Compilation\SemanticModelAPITests.vb (13)
114Assert.Equal("c1", expr1.ToString()) 154Assert.Equal("c1", expr1.ToString()) 539Assert.Equal("System.Collections.Generic.List(Of T)", node.ToString()) 884Assert.Equal("Dim x = N.A.X", originalStatement.ToString()) 1909Assert.Equal("I.Method", implementsName.ToString()) 2453Assert.Equal("0", expr1.ToString()) 2484Assert.Equal("chary", expr2.ToString()) 2497Assert.Equal("str", expr2.ToString()) 2580Assert.Equal("0", expr1.ToString()) 2609Assert.Equal("chary", expr2.ToString()) 2622Assert.Equal("str", expr2.ToString()) 2855Assert.Equal("d1", id.ToString()) 2868Assert.Equal("d2", id.ToString())
Compilation\SemanticModelGetDeclaredSymbolAPITests.vb (6)
2429Assert.Equal("NS.", node.Parent.ToString().Trim()) 2437Assert.Equal("Dummy.", node.Parent.ToString().Trim()) 2443Assert.Equal("F.", node.Parent.ToString().Trim()) 2449Assert.Equal("P.", node.Parent.ToString().Trim()) 2858Assert.Equal("x?", node.ToString()) 2865Assert.Equal("y", node.ToString())
Compilation\VisualBasicCompilationOptionsTests.vb (1)
352Assert.Equal(importStrings(i).Trim(), opt.GlobalImports(i).Clause.ToString)
Semantics\ConditionalAccessTests.vb (4)
9796Assert.Equal(".TestEvent", memberBinding.ToString()) 9882Assert.Equal(".TestEvent", memberBinding.ToString()) 9933Assert.Equal(".TestEvent", memberBinding.ToString()) 9934Assert.Equal(".TestEvent()", invocation.ToString())
Semantics\QueryExpressions_SemanticModel.vb (3)
3817Dim node = DirectCast(tree.GetCompilationUnitRoot().FindToken(tree.GetCompilationUnitRoot().ToString().IndexOf("aggr4(4)", StringComparison.Ordinal)).Parent, FunctionAggregationSyntax) 3886Dim node = tree.GetCompilationUnitRoot().FindToken(tree.GetCompilationUnitRoot().ToString().IndexOf("n As", StringComparison.Ordinal)).Parent.Parent.DescendantNodes().OfType(Of IdentifierNameSyntax)().First() 3918Dim node = tree.GetCompilationUnitRoot().FindToken(tree.GetCompilationUnitRoot().ToString().IndexOf("By", StringComparison.Ordinal)).Parent.Parent.DescendantNodes().OfType(Of IdentifierNameSyntax)().First()
Semantics\ScriptSemanticsTests.vb (9)
47Assert.Equal("WriteLine", node5.Name.ToString()) 62Assert.Equal("WriteLine", node5.Name.ToString()) 78Assert.Equal("WriteLine", node5.Name.ToString()) 87Assert.Equal("WriteLine", node5.Name.ToString()) 96Assert.Equal("WriteLine", node5.Name.ToString()) 109Assert.Equal("WriteLine", node5.Name.ToString()) 122Assert.Equal("WriteLine", node5.Name.ToString()) 137Assert.Equal("WriteLine", node1.Name.ToString()) 139Assert.Equal("WriteLine", node2.Name.ToString())
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (10)
DocumentationComments\DocCommentTests.vb (1)
11117Assert.Equal(If(overrideCrefText, cref.Trim).Trim, crefNode.ToString())
SymbolsTests\MyBaseMyClassSemanticsTests.vb (1)
87Assert.Equal(fieldName, node.ToString())
SymbolsTests\Source\GroupClassTests.vb (7)
3275Assert.Equal("= DefaultInstanceTest1", node1.Parent.ToString()) 3284Assert.Equal("= DefaultInstanceTest2", node2.Parent.ToString()) 3356Assert.Equal("= DefaultInstanceTest2", node2.Parent.ToString()) 3762Assert.Equal("Form1.M1", node1.Parent.ToString()) 3770Assert.Equal("Form1.Close", node2.Parent.ToString()) 3778Assert.Equal("f1 = Form1", node3.Parent.Parent.ToString()) 3786Assert.Equal("= Form1(2)", node4.Parent.Parent.ToString())
SymbolsTests\Source\OperatorsTests.vb (1)
194Dim syntax As String = operatorSyntax.ToString()
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (80)
Parser\ParseDirectives.vb (13)
1653Assert.Equal("[BC42024]", enableNode.ErrorCodes(0).ToString) 1662Assert.Equal("disable", disableNode.ErrorCodes(0).ToString) 2122Assert.Equal("[Rem]", enableNode.ErrorCodes(1).ToString) 2148Assert.Equal("BC&", enableNode.ErrorCodes(1).ToString) 2215Assert.Equal("BC&", disableNode.ErrorCodes(4).ToString) 2269Assert.Equal("True", disableNode.ErrorCodes(0).ToString) 2272Assert.Equal("False", disableNode.ErrorCodes(1).ToString) 2275Assert.Equal(String.Empty, disableNode.ErrorCodes(2).ToString) 2278Assert.Equal("Nothing", disableNode.ErrorCodes(3).ToString) 2305Assert.Equal("Chr", disableNode.ErrorCodes(2).ToString) 2329Assert.Equal("string", disableNode.ErrorCodes(0).ToString) 2332Assert.Equal("bc42024", disableNode.ErrorCodes(1).ToString) 2335Assert.Equal(String.Empty, disableNode.ErrorCodes(2).ToString)
Parser\ParseErrorTests.vb (3)
4736Assert.Equal(code, tree.GetRoot().ToString()) 4744Assert.Equal(code, tree.GetRoot().ToString()) 4754Assert.Equal(code, tree.GetRoot().ToString())
Parser\ParseExpression.vb (2)
1034Assert.Equal(" a ", el.Content.First.ToString()) 1044Assert.Equal(" a &lt; b ", el.Content.First.ToString)
Parser\ParseXml.vb (3)
1905Assert.Equal(memAccess.Expression.ToString, "Console") 1906Assert.Equal(memAccess.Name.ToString, "WriteLine") 1916Assert.Equal(code, tree.GetRoot().ToString())
Syntax\SeparatedSyntaxListTests.vb (3)
25Assert.Equal("A", list(0).ToString()) 26Assert.Equal("B", list(1).ToString()) 27Assert.Equal("C", list(2).ToString())
Syntax\StatementSyntaxWalkerTests.vb (1)
117_arg.WriteLine(node.ToString())
Syntax\SyntaxFactoryTests.vb (2)
121Assert.Equal("String", type1.ToString()) 124Assert.Equal("Integer", type2.ToString())
Syntax\SyntaxFactsTest.vb (1)
1162"Expected diagnostic when adding line continuation to " & currentToken.Kind.ToString() & " in " & currentToken.Parent.ToString() & ".")
Syntax\SyntaxListTests.vb (4)
19Assert.Equal("A", list(0).ToString()) 20Assert.Equal("B", list(1).ToString()) 21Assert.Equal("C", list(2).ToString()) 235Assert.Equal(expectedArgName, CType(item, SimpleArgumentSyntax).Expression.ToString())
Syntax\SyntaxTreeTests.vb (6)
116Assert.Equal(newRoot.ToString(), newTree.GetRoot().ToString()) 133Assert.Equal(newRoot.ToString(), newTree.GetRoot().ToString()) 146Assert.Equal(newRoot.ToString(), newTree.GetRoot().ToString())
TestSyntaxNodes.vb (42)
584Assert.Equal("( )", arglist.ToString) 592Assert.Equal("goo", seplist(0).ToString) 610Assert.Equal("Inherits goo", statement.ToString) 632Assert.Equal("aaa", sepList(0).ToString) 633Assert.Equal("bbb", sepList(1).ToString) 634Assert.Equal("cc", sepList(2).ToString) 645Assert.Equal("Inherits aaa , bbb ; cc", statement.ToString) 656Assert.Equal("aaa", sepList(0).ToString) 657Assert.Equal("bbb", sepList(1).ToString) 658Assert.Equal("cc", sepList(2).ToString) 898methodStatement.ToString()) 1201Assert.Equal(simpleTree.ToString, "1- X( 3, 4+ 8, 9)") 1211Assert.Equal(newTree.ToString, "2- X( 4, 5+ 9, 10)") 1214Assert.Equal("public Overloads SUB MySub ( ByVal Param1 As Integer , ByVal Param2 As String , ByRef Param3 As Double )", methodStmt.ToString) 1224Assert.Equal("PUBLIC OVERLOADS SUB MySub ( BYVAL Param1 AS INTEGER , BYVAL Param2 AS STRING , BYREF Param3 AS DOUBLE )", newMethod.ToString) 1229Assert.Equal("public Overloads SUB MYSUB ( ByVal PARAM1 As Integer , ByVal PARAM2 As String , ByRef PARAM3 As Double )", newMethod.ToString) 1234Assert.Equal("public Overloads SUB MySub ( ByVal Param2 As String , ByVal Param1 As Integer , ByRef Param3 As Double )", newMethod.ToString) 1239Assert.Equal("PUBLIC OVERLOADS SUB MYSUB ( BYVAL PARAM2 AS STRING , BYVAL PARAM1 AS INTEGER , BYREF PARAM3 AS DOUBLE )", newMethod.ToString) 1245Assert.Equal("1- X( 3, 4+ 8, 9)", simpleTree.ToString) 1249Assert.Equal("""Hi""- X( 3, 4+ 8, 9)", simpleTree.ToString) 1253Assert.Equal("""Hi""- X( 3, 4+ 8, 9)", simpleTree.ToString) 1477Assert.Equal("a + c", expr2.ToString()) 1788Assert.Equal("<goo> </ >", xmlElement.ToString) 1792Assert.Equal("<goo> </ >", docComment.ToString) 1794Assert.Equal("<goo> </ >", docComment.Content(0).ToString) 1796Assert.Equal("<goo>", DirectCast(docComment.Content(0), XmlElementSyntax).StartTag.ToString) 2048Assert.Equal("#const x =1", fDir.ToString) 2051Assert.Equal("#const y = 2", lDir.ToString) 2053Dim fDir1 = mDecl.GetFirstDirective(Function(d) d.ToString = "#const y = 2") 2054Assert.Equal("#const y = 2", fDir1.ToString) 2055fDir1 = mDecl.GetFirstDirective(Function(d) d.ToString = "#const y = 42") 2058Dim lDir1 = mDecl.GetLastDirective(Function(d) d.ToString = "#const x =1") 2059Assert.Equal("#const x =1", lDir1.ToString) 2060lDir1 = mDecl.GetLastDirective(Function(d) d.ToString = "#const x =42") 2080Assert.Equal("#const y = 2", fDir1.ToString) 2084Assert.Equal("#const y = 2", lDir1.ToString) 2086Dim fDir2 = fDir1.GetNextDirective(Function(d) d.ToString = "#const y = 3") 2087Assert.Equal("#const y = 3", fDir2.ToString) 2088fDir2 = fDir1.GetNextDirective(Function(d) d.ToString = "#const y = 42") 2091Dim lDir2 = lDir1.GetPreviousDirective(Function(d) d.ToString = "#const x =1") 2092Assert.Equal("#const x =1", lDir2.ToString) 2093lDir2 = lDir1.GetPreviousDirective(Function(d) d.ToString = "#const x =42")
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (6)
CompilationTestUtils.vb (2)
512While (node IsNot Nothing AndAlso node.ToString.StartsWith(bindText, StringComparison.Ordinal) AndAlso Not (TypeOf node Is TNode)) 518Assert.Contains(bindText, node.ToString(), StringComparison.Ordinal)
SemanticModelTestBase.vb (4)
36While (node IsNot Nothing AndAlso node.ToString <> bindText) 42Assert.Equal(bindText, node.ToString()) 77While (node IsNot Nothing AndAlso node.ToString.StartsWith(bindText, StringComparison.Ordinal) AndAlso Not (TypeOf node Is TNode)) 83Assert.Contains(bindText, node.ToString(), StringComparison.Ordinal)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (10)
CodeCleanup\Providers\NormalizeModifiersOrOperatorsCodeCleanupProvider.vb (1)
328Dim parsableStatementText = node.NormalizeWhitespace().ToString()
CodeGeneration\VisualBasicSyntaxGenerator.vb (6)
1075Return qname.Right.ToString() 1134Return "[" & type.ToString() & "]" 1987Return DirectCast(declaration, NamespaceBlockSyntax).NamespaceStatement.Name.ToString() 2011Return DirectCast(declaration, AttributeSyntax).Name.ToString() 2016Return list.Attributes(0).Name.ToString() 2026Return DirectCast(declaration, SimpleImportsClauseSyntax).Name.ToString()
Simplification\Simplifiers\ExpressionSimplifier.vb (3)
202Contract.Fail("QualifiedName Left = " + qualifiedName.Left.ToString() + " and QualifiedName Right = " + qualifiedName.Right.ToString() + " . Left is tried to be replaced with the PredefinedType " + replacementNode.ToString())
Microsoft.CodeAnalysis.VisualBasic.Workspaces.UnitTests (52)
CodeGeneration\SyntaxGeneratorTests.vb (51)
2764Assert.Equal("t", Generator.GetType(Generator.MethodDeclaration("m", returnType:=Generator.IdentifierName("t"))).ToString()) 2767Assert.Equal("t", Generator.GetType(Generator.FieldDeclaration("f", Generator.IdentifierName("t"))).ToString()) 2768Assert.Equal("t", Generator.GetType(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"))).ToString()) 2769Assert.Equal("t", Generator.GetType(Generator.IndexerDeclaration({Generator.ParameterDeclaration("p", Generator.IdentifierName("pt"))}, Generator.IdentifierName("t"))).ToString()) 2770Assert.Equal("t", Generator.GetType(Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))).ToString()) 2772Assert.Equal("t", Generator.GetType(Generator.EventDeclaration("ef", Generator.IdentifierName("t"))).ToString()) 2773Assert.Equal("t", Generator.GetType(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"))).ToString()) 2775Assert.Equal("t", Generator.GetType(Generator.DelegateDeclaration("t", returnType:=Generator.IdentifierName("t"))).ToString()) 2778Assert.Equal("t", Generator.GetType(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "v")).ToString()) 2786Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.MethodDeclaration("m", returnType:=Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()) 2787Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.MethodDeclaration("m"), Generator.IdentifierName("t"))).ToString()) 2788Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.FieldDeclaration("f", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()) 2789Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.PropertyDeclaration("p", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()) 2790Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.IndexerDeclaration({Generator.ParameterDeclaration("p", Generator.IdentifierName("pt"))}, Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()) 2791Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.ParameterDeclaration("p", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()) 2793Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.DelegateDeclaration("t", returnType:=Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()) 2794Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.DelegateDeclaration("t"), Generator.IdentifierName("t"))).ToString()) 2796Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.EventDeclaration("ef", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()) 2797Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()) 2799Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.LocalDeclarationStatement(Generator.IdentifierName("x"), "v"), Generator.IdentifierName("t"))).ToString()) 2881Assert.Equal("x", Generator.GetExpression(Generator.FieldDeclaration("f", Generator.IdentifierName("t"), initializer:=Generator.IdentifierName("x"))).ToString()) 2882Assert.Equal("x", Generator.GetExpression(Generator.ParameterDeclaration("p", Generator.IdentifierName("t"), initializer:=Generator.IdentifierName("x"))).ToString()) 2883Assert.Equal("x", Generator.GetExpression(Generator.LocalDeclarationStatement("loc", initializer:=Generator.IdentifierName("x"))).ToString()) 2888Assert.Equal("x", Generator.GetExpression(Generator.ValueReturningLambdaExpression(Generator.IdentifierName("x"))).ToString()) 2889Assert.Equal("x", Generator.GetExpression(Generator.VoidReturningLambdaExpression(Generator.IdentifierName("x"))).ToString()) 2890Assert.Equal("x", Generator.GetExpression(Generator.ValueReturningLambdaExpression("p", Generator.IdentifierName("x"))).ToString()) 2891Assert.Equal("x", Generator.GetExpression(Generator.VoidReturningLambdaExpression("p", Generator.IdentifierName("x"))).ToString()) 2899Assert.Equal("x", Generator.GetExpression(Generator.WithExpression(Generator.FieldDeclaration("f", Generator.IdentifierName("t")), Generator.IdentifierName("x"))).ToString()) 2900Assert.Equal("x", Generator.GetExpression(Generator.WithExpression(Generator.ParameterDeclaration("p", Generator.IdentifierName("t")), Generator.IdentifierName("x"))).ToString()) 2901Assert.Equal("x", Generator.GetExpression(Generator.WithExpression(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "loc"), Generator.IdentifierName("x"))).ToString()) 2904Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.ValueReturningLambdaExpression("p", {Generator.IdentifierName("x")}), Generator.IdentifierName("y"))).ToString()) 2905Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.VoidReturningLambdaExpression("p", {Generator.IdentifierName("x")}), Generator.IdentifierName("y"))).ToString()) 2906Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.ValueReturningLambdaExpression({Generator.IdentifierName("x")}), Generator.IdentifierName("y"))).ToString()) 2907Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.VoidReturningLambdaExpression({Generator.IdentifierName("x")}), Generator.IdentifierName("y"))).ToString()) 2908Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.ValueReturningLambdaExpression("p", Generator.IdentifierName("x")), Generator.IdentifierName("y"))).ToString()) 2909Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.VoidReturningLambdaExpression("p", Generator.IdentifierName("x")), Generator.IdentifierName("y"))).ToString()) 2910Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.ValueReturningLambdaExpression(Generator.IdentifierName("x")), Generator.IdentifierName("y"))).ToString()) 2911Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.VoidReturningLambdaExpression(Generator.IdentifierName("x")), Generator.IdentifierName("y"))).ToString()) 3208Assert.Equal("B", baseListBI(0).ToString()) 3209Assert.Equal("I", baseListBI(1).ToString()) 3220Assert.Equal("X", baseListXY(0).ToString()) 3221Assert.Equal("Y", baseListXY(1).ToString()) 3488Assert.Equal("Integer", Generator.GetType(declX).ToString()) 3494Assert.Equal("Integer", Generator.GetType(declY).ToString()) 3500Assert.Equal("Integer", Generator.GetType(declZ).ToString()) 3508Assert.Equal("T", Generator.GetType(xTypedT).ToString()) 3518Assert.Equal("e", Generator.GetExpression(xInitialized).ToString()) 3534Assert.Equal("<A>", Generator.GetAttributes(xAttributed)(0).ToString()) 3745Assert.Equal("<Q>", xNamedQ.ToString()) 3750Assert.Equal("<X(e)>", xWithArg.ToString()) 3871Assert.Equal("Imports Q", xRenamedQ.ToString())
Formatting\FormattingTests.vb (1)
3788Dim result = Formatter.Format(root, goo, workspace.Services.SolutionServices, VisualBasicSyntaxFormattingOptions.Default, CancellationToken.None).ToString()
Microsoft.CodeAnalysis.Workspaces (2)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\AbstractDocumentationCommentService.cs (2)
67.FirstOrDefault(e => GetName(e).ToString() == "summary"); 131sb.Append(GetCref(xmlCref).ToString());
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (3)
VisualStudioMSBuildWorkspaceTests.cs (3)
64Assert.StartsWith("public class CSharpClass", type.ToString(), StringComparison.Ordinal); 442Assert.StartsWith("public class CSharpClass", type.ToString(), StringComparison.Ordinal); 2850Assert.StartsWith("public class CSharpClass", type.ToString(), StringComparison.Ordinal);
Microsoft.CodeAnalysis.Workspaces.UnitTests (7)
SolutionTests\SolutionTests.cs (6)
311Assert.Equal(root.ToString(), actualRoot!.ToString()); 3147Assert.Equal(text, root.ToString()); 3402Assert.Equal(text, docTree.GetRoot().ToString()); 3423Assert.Equal(text, docTree.GetRoot().ToString()); 3465Assert.Equal(text, docRoot.ToString());
SyntaxNodeTests.cs (1)
124Assert.Equal("public class C\r\n{\r\n private int X;\r\n void M()\r\n {\r\n }\r\n}", finalClassDecl.NormalizeWhitespace().ToString());
Microsoft.DotNet.CodeAnalysis (1)
Analyzers\AppContextDefaultsAnalyzer.cs (1)
111if (call.Expression.ToString().IndexOf("DefineSwitchDefault") == -1)
Microsoft.Extensions.Logging.Generators (1)
LoggerMessageGenerator.Parser.cs (1)
519nspace = namespaceParent.Name.ToString();
Microsoft.Gen.ContextualOptions.Unit.Tests (2)
EmitterTests.cs (2)
68.Select(statement => statement.ToString()); 97.Select(statement => statement.ToString());
Microsoft.Gen.Logging (1)
Parsing\Parser.cs (1)
300nspace = namespaceParent.Name.ToString();
Microsoft.Gen.Metrics (1)
Parser.cs (1)
118nspace = ns.Name.ToString();
Microsoft.Gen.MetricsReports (1)
src\Generators\Microsoft.Gen.Metrics\Parser.cs (1)
118nspace = ns.Name.ToString();
Microsoft.Interop.SourceGeneration (4)
ContainingSyntaxContext.cs (2)
73containingNamespace = new StringBuilder(ns.Name.ToString()); 77string namespaceName = ns.Name.ToString();
Marshalling\AttributedMarshallingModelGeneratorResolver.cs (2)
247FullTypeName = marshallerTypeSyntax.ToString(), 248DiagnosticFormattedName = marshallerTypeSyntax.ToString()
Microsoft.ML.InternalCodeAnalyzer (9)
ContractsCheckAnalyzer.cs (5)
117string nameColonText = arg.NameColon.Name.ToString(); 136return invokeExp != null && invokeExp.Expression.ToString() == "nameof"; 157return ((InvocationExpressionSyntax)exp).Expression.ToString() == "nameof"; 176if (param.Type.ToString() == "ModelLoadContext") 187var name = access.Name.ToString();
ContractsCheckNameofFixProvider.cs (4)
53var methodName = member.ToString(); // Something like CheckParam, ExceptUserArg... 62argList.Arguments[1] == nameArg && argList.Arguments[0].Expression.ToString() == nameArgValue) 89candidate = SyntaxFactory.ParseExpression(node.Parent.ToString()); 125string paramTypeString = param.Type.ToString();
Microsoft.VisualStudio.LanguageServices.CSharp (23)
CodeModel\CSharpCodeModelService.CodeModelEventCollector.cs (2)
152return StringComparer.Ordinal.Equals(oldExpression.ToString(), newExpression.ToString());
CodeModel\CSharpCodeModelService.cs (20)
811return ((MethodDeclarationSyntax)node).ExplicitInterfaceSpecifier?.ToString() + 818return ((PropertyDeclarationSyntax)node).ExplicitInterfaceSpecifier?.ToString() + 821return ((IndexerDeclarationSyntax)node).ExplicitInterfaceSpecifier?.ToString() + 824return ((EventDeclarationSyntax)node).ExplicitInterfaceSpecifier?.ToString() + 830return ((BaseNamespaceDeclarationSyntax)node).Name.ToString(); 837+ conversionOperator.Type.ToString(); 843return ((AttributeSyntax)node).Name.ToString(); 847? attributeArgument.NameEquals.Name.ToString() 1357var lines = documentationComment.ToString().Split(new[] { newLine }, StringSplitOptions.None); 1553if (usingDirective.Name?.ToString() == dottedName) 1587if (attribute.Name.ToString() == name) 1640name = ((AttributeSyntax)attributeNode).Name.ToString(); 1645if (attribute.Name.ToString() == name) 1814return ((AttributeArgumentSyntax)attributeArgumentNode).Expression.ToString(); 1822? usingDirective.Alias.Name.ToString() 1833return usingDirective.NamespaceOrType.ToString(); 1847name = usingDirective.NamespaceOrType.ToString(); 2909return enumMemberDeclaration.EqualsValue?.Value.ToString(); 2912return variableDeclarator.Initializer?.Value.ToString(); 2915return parameter.Default?.Value.ToString();
Snippets\CSharpSnippetExpansionLanguageHelper.cs (1)
97if (TryAddImportsToContainedDocument(document, newUsingDirectives.Where(u => u.Alias == null).Select(u => u.Name!.ToString())))
Microsoft.VisualStudio.LanguageServices.VisualBasic (25)
CodeModel\VisualBasicCodeModelService.CodeModelEventCollector.vb (2)
969Return StringComparer.OrdinalIgnoreCase.Equals(oldExpression.ToString(), newExpression.ToString())
CodeModel\VisualBasicCodeModelService.NodeNameGenerator.vb (1)
97builder.Append(parameter.Identifier.ToString())
CodeModel\VisualBasicCodeModelService.vb (14)
900Return DirectCast(node, NamespaceBlockSyntax).NamespaceStatement.Name.ToString() 933simpleArgument.NameColonEquals.Name.ToString(), 1200If [option].ToString() = name Then 1248If attribute.Name.ToString() = name Then 1760name = DirectCast(attributeNode, AttributeSyntax).Name.ToString() 1764If attribute.Name.ToString() = name Then 1922Return DirectCast(attributeArgumentNode, SimpleArgumentSyntax).Expression.ToString() 1980Return parameter.Identifier.ToString() 2483Dim lines = documentationComment.ToString().Split({newLine}, StringSplitOptions.None) 3521initializer.ToString(), 4018result(i) = handlesItem.EventContainer.ToString() & "."c & handlesItem.EventMember.ToString() 4111If handlesClauseItem.EventContainer.ToString() = containerName AndAlso 4112handlesClauseItem.EventMember.ToString() = memberName Then
CodeModel\VisualBasicCodeModelService_Prototype.vb (2)
134builder.Append(variableDeclarator.Initializer.Value.ToString()) 201builder.Append(parameterNode.Default.Value.ToString())
Snippets\VisualBasicSnippetExpansionLanguageHelper.vb (4)
177If Not membersImports.Any(Function(c) ordinalIgnoreCaseStringComparer.Equals(c.Name.ToString(), simpleImportsClause.Name.ToString())) Then 182ordinalIgnoreCaseStringComparer.Equals(a.Name.ToString(), simpleImportsClause.Name.ToString())) Then 192If Not xmlNamespaceImports.Any(Function(x) ordinalIgnoreCaseStringComparer.Equals(x.XmlNamespace.Name.ToString(), xmlNamespaceImportsClause.XmlNamespace.Name.ToString()) AndAlso 193ordinalIgnoreCaseStringComparer.Equals(x.XmlNamespace.Value.ToString(), xmlNamespaceImportsClause.XmlNamespace.Value.ToString())) Then
Venus\ContainedLanguageStaticEventBinding.vb (2)
120If handlesClauseItem.EventMember.ToString() = eventName Then 124ElseIf handlesClauseItem.EventContainer.ToString() = objectName Then
System.Private.CoreLib.Generators (1)
EventSourceGenerator.Parser.cs (1)
83string nspace = ns.Name.ToString();
System.Windows.Forms.Analyzers.CodeFixes.CSharp (2)
System\Windows\Forms\CSharp\CodeFixes\AddDesignerSerializationVisibility\AddDesignerSerializationVisibilityCodeFixProvider.cs (2)
70.Any(a => a.Name.ToString() == DesignerSerializationVisibilityAttributeName)) 103.Any(u => u?.Name?.ToString() == SystemComponentModelName))
System.Windows.Forms.Analyzers.CSharp (1)
System\Windows\Forms\CSharp\Generators\ApplicationConfiguration\ApplicationConfigurationGenerator.cs (1)
66ns = namespaceSyntax.Name.ToString();