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