1 implementation of Imports
Microsoft.CodeAnalysis (1)
Compilation\IImportScope.cs (1)
148
public ImmutableArray<ImportedNamespaceOrType>
Imports
{ get; }
92 references to Imports
Microsoft.CodeAnalysis (1)
Compilation\IImportScope.cs (1)
14
/// cref="ISymbol.DeclaringSyntaxReferences"/> on the <see cref="IAliasSymbol"/> itself. For <see cref="
Imports
"/>
Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests (2)
InteractiveSessionTests.cs (2)
1189
Assert.Single(scope.
Imports
);
1190
var import = scope.
Imports
.Single();
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (54)
Compilation\GetImportScopesTests.cs (54)
54
Assert.Single(scopes.Single().
Imports
);
55
Assert.True(scopes.Single().
Imports
.Single().NamespaceOrType is INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: true, Name: nameof(System) });
56
Assert.True(scopes.Single().
Imports
.Single().DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax);
70
Assert.Single(scopes.Single().
Imports
);
71
Assert.True(scopes.Single().
Imports
.Single().NamespaceOrType is INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: true, Name: nameof(System) });
72
Assert.True(scopes.Single().
Imports
.Single().DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax);
101
Assert.Single(scopes.Single().
Imports
);
102
Assert.True(scopes.Single().
Imports
.Single().NamespaceOrType is INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: true, Name: nameof(System) });
103
Assert.True(scopes.Single().
Imports
.Single().DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax);
129
Assert.Single(scopes.Single().
Imports
);
130
Assert.True(scopes.Single().
Imports
.Single().NamespaceOrType is INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: true, Name: nameof(System) });
131
Assert.True(scopes.Single().
Imports
.Single().DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax);
146
Assert.Equal(2, scopes.Single().
Imports
.Length);
147
Assert.True(scopes.Single().
Imports
.Any(i => i.NamespaceOrType is INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: true, Name: nameof(System) }));
148
Assert.True(scopes.Single().
Imports
.Any(i => i.NamespaceOrType is INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: true, Name: nameof(Microsoft) }));
149
Assert.True(scopes.Single().
Imports
.Any(i => i.DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(System) } }));
150
Assert.True(scopes.Single().
Imports
.Any(i => i.DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(Microsoft) } }));
174
Assert.Single(scopes.Single().
Imports
);
175
Assert.True(scopes.Single().
Imports
.Single().NamespaceOrType is INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: true, Name: nameof(System) });
176
Assert.True(scopes.Single().
Imports
.Single().DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(System) } });
196
Assert.Single(scopes[0].
Imports
);
197
Assert.Single(scopes[1].
Imports
);
198
Assert.True(scopes[0].
Imports
.Single().NamespaceOrType is INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: true, Name: nameof(Microsoft) });
199
Assert.True(scopes[0].
Imports
.Single().DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(Microsoft) } });
200
Assert.True(scopes[1].
Imports
.Single().NamespaceOrType is INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: true, Name: nameof(System) });
201
Assert.True(scopes[1].
Imports
.Single().DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(System) } });
224
Assert.Single(scopes[0].
Imports
);
225
Assert.Single(scopes[1].
Imports
);
226
Assert.True(scopes[0].
Imports
.Single().NamespaceOrType is INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: true, Name: nameof(Microsoft) });
227
Assert.True(scopes[0].
Imports
.Single().DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(Microsoft) } });
228
Assert.True(scopes[1].
Imports
.Single().NamespaceOrType is INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: true, Name: nameof(System) });
229
Assert.True(scopes[1].
Imports
.Single().DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(System) } });
246
Assert.Empty(scopes.Single().
Imports
);
262
Assert.Empty(scopes.Single().
Imports
);
293
Assert.Empty(scopes.Single().
Imports
);
321
Assert.Empty(scopes.Single().
Imports
);
340
Assert.Empty(scopes.Single().
Imports
);
420
Assert.Empty(scopes.Single().
Imports
);
439
Assert.Empty(scopes.Single().
Imports
);
461
Assert.Empty(scopes.Single().
Imports
);
482
Assert.Empty(scopes.Single().
Imports
);
518
Assert.Empty(scopes.Single().
Imports
);
540
Assert.Empty(scopes.Single().
Imports
);
618
Assert.Single(scopes.Single().
Imports
);
625
Assert.True(scopes.Single().
Imports
.Single().NamespaceOrType is INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: true, Name: nameof(System) });
626
Assert.True(scopes.Single().
Imports
.Single().DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(System) } });
647
Assert.Single(scopes.Single().
Imports
);
648
Assert.True(scopes.Single().
Imports
.Single().NamespaceOrType is INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: true, Name: nameof(System) });
649
Assert.True(scopes.Single().
Imports
.Single().DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax);
681
Assert.Equal(2, scopes.Single().
Imports
.Length);
682
Assert.True(scopes.Single().
Imports
.Any(i => i.NamespaceOrType is INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: true, Name: nameof(System) }));
683
Assert.True(scopes.Single().
Imports
.Any(i => i.DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax { Name: IdentifierNameSyntax { Identifier.Text: nameof(System) } }));
684
Assert.True(scopes.Single().
Imports
.Any(i => i.NamespaceOrType is INamespaceSymbol { ContainingNamespace.IsGlobalNamespace: false, Name: nameof(System.IO) }));
685
Assert.True(scopes.Single().
Imports
.Any(i => i.DeclaringSyntaxReference!.GetSyntax() is UsingDirectiveSyntax { Name: QualifiedNameSyntax { Right: IdentifierNameSyntax { Identifier.Text: nameof(System.IO) } } }));
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (35)
Compilation\GetImportScopesTests.vb (35)
72
Assert.Single(scopes.Single().
Imports
)
73
Assert.True(IsNamespaceWithName(scopes.Single().
Imports
.Single().NamespaceOrType, NameOf(System)))
74
Assert.True(IsSimpleImportsClauseWithName(scopes.Single().
Imports
.Single().DeclaringSyntaxReference, NameOf(System)))
89
Assert.Single(scopes.Single().
Imports
)
90
Assert.True(IsNamespaceWithName(scopes.Single().
Imports
.Single().NamespaceOrType, NameOf(System)))
91
Assert.True(IsSimpleImportsClauseWithName(scopes.Single().
Imports
.Single().DeclaringSyntaxReference, NameOf(System)))
108
Assert.True(IsNamespaceWithName(scopes.Single().
Imports
.Single().NamespaceOrType, NameOf(System)))
109
Assert.True(IsSimpleImportsClauseWithName(scopes.Single().
Imports
.Single().DeclaringSyntaxReference, NameOf(System)))
121
Assert.Equal(2, scopes.Single().
Imports
.Length)
123
Assert.True(scopes.Single().
Imports
.Any(Function(i) IsNamespaceWithName(i.NamespaceOrType, NameOf(System))))
124
Assert.True(scopes.Single().
Imports
.Any(Function(i) IsNamespaceWithName(i.NamespaceOrType, NameOf(Microsoft))))
126
Assert.True(scopes.Single().
Imports
.Any(Function(i) IsSimpleImportsClauseWithName(i.DeclaringSyntaxReference, NameOf(System))))
127
Assert.True(scopes.Single().
Imports
.Any(Function(i) IsSimpleImportsClauseWithName(i.DeclaringSyntaxReference, NameOf(Microsoft))))
151
Assert.Single(scopes.Single().
Imports
)
152
Assert.True(IsNamespaceWithName(scopes.Single().
Imports
.Single().NamespaceOrType, NameOf(System)))
153
Assert.True(IsSimpleImportsClauseWithName(scopes.Single().
Imports
.Single().DeclaringSyntaxReference, NameOf(System)))
174
Assert.Single(scopes.Single.
Imports
)
175
Assert.True(IsNamespaceWithName(scopes.Single().
Imports
.Single().NamespaceOrType, NameOf(System)))
176
Assert.True(IsSimpleImportsClauseWithName(scopes.Single().
Imports
.Single().DeclaringSyntaxReference, NameOf(System)))
199
Assert.Single(scopes.Single().
Imports
)
200
Assert.True(IsNamespaceWithName(scopes.Single().
Imports
.Single().NamespaceOrType, NameOf(System)))
201
Assert.True(IsSimpleImportsClauseWithName(scopes.Single().
Imports
.Single().DeclaringSyntaxReference, NameOf(System)))
223
Assert.Empty(scopes.Single().
Imports
)
240
Assert.Empty(scopes.Single().
Imports
)
260
Assert.Empty(scopes.Single().
Imports
)
281
Assert.Empty(scopes.Single().
Imports
)
305
Assert.Empty(scopes.Single().
Imports
)
329
Assert.Empty(scopes.Single().
Imports
)
355
Assert.Empty(scopes.Single().
Imports
)
373
Assert.Empty(scopes.Single().
Imports
)
395
Assert.Empty(scopes.Single().
Imports
)
419
Assert.Empty(scopes.Single().
Imports
)
446
Assert.Empty(scopes.Single().
Imports
)
470
Assert.Empty(scopes.Single().
Imports
)
496
Assert.Empty(scopes.Single().
Imports
)