77using Microsoft . CodeAnalysis . CodeFixes ;
88using Microsoft . CodeAnalysis . CSharp ;
99using Microsoft . CodeAnalysis . CSharp . Diagnostics . TypeStyle ;
10+ using Microsoft . CodeAnalysis . CSharp . CodeStyle ;
1011using Microsoft . CodeAnalysis . CSharp . TypeStyle ;
1112using Microsoft . CodeAnalysis . Diagnostics ;
13+ using Microsoft . CodeAnalysis . Options ;
1214using Microsoft . CodeAnalysis . Test . Utilities ;
1315using Roslyn . Test . Utilities ;
1416using Xunit ;
15-
16- #if CODE_STYLE
17- using Microsoft . CodeAnalysis . CSharp . Internal . CodeStyle ;
18- using Microsoft . CodeAnalysis . Internal . Options ;
19- #else
20- using Microsoft . CodeAnalysis . CSharp . CodeStyle ;
2117using Microsoft . CodeAnalysis . CodeStyle ;
22- using Microsoft . CodeAnalysis . Options ;
23- #endif
18+ using Microsoft . CodeAnalysis . Editor . UnitTests . CodeActions ;
2419
2520namespace Microsoft . CodeAnalysis . Editor . CSharp . UnitTests . Diagnostics . UseImplicitType
2621{
@@ -29,49 +24,46 @@ public partial class UseImplicitTypeTests : AbstractCSharpDiagnosticProviderBase
2924 internal override ( DiagnosticAnalyzer , CodeFixProvider ) CreateDiagnosticProviderAndFixer ( Workspace workspace )
3025 => ( new CSharpUseImplicitTypeDiagnosticAnalyzer ( ) , new UseImplicitTypeCodeFixProvider ( ) ) ;
3126
32- private static readonly CodeStyleOption < bool > onWithSilent = new CodeStyleOption < bool > ( true , NotificationOption . Silent ) ;
33- private static readonly CodeStyleOption < bool > offWithSilent = new CodeStyleOption < bool > ( false , NotificationOption . Silent ) ;
34- private static readonly CodeStyleOption < bool > onWithInfo = new CodeStyleOption < bool > ( true , NotificationOption . Suggestion ) ;
35- private static readonly CodeStyleOption < bool > offWithInfo = new CodeStyleOption < bool > ( false , NotificationOption . Suggestion ) ;
36- private static readonly CodeStyleOption < bool > onWithWarning = new CodeStyleOption < bool > ( true , NotificationOption . Warning ) ;
37- private static readonly CodeStyleOption < bool > offWithWarning = new CodeStyleOption < bool > ( false , NotificationOption . Warning ) ;
38- private static readonly CodeStyleOption < bool > onWithError = new CodeStyleOption < bool > ( true , NotificationOption . Error ) ;
39- private static readonly CodeStyleOption < bool > offWithError = new CodeStyleOption < bool > ( false , NotificationOption . Error ) ;
27+ private static readonly CodeStyleOption2 < bool > onWithSilent = new CodeStyleOption2 < bool > ( true , NotificationOption2 . Silent ) ;
28+ private static readonly CodeStyleOption2 < bool > offWithSilent = new CodeStyleOption2 < bool > ( false , NotificationOption2 . Silent ) ;
29+ private static readonly CodeStyleOption2 < bool > onWithInfo = new CodeStyleOption2 < bool > ( true , NotificationOption2 . Suggestion ) ;
30+ private static readonly CodeStyleOption2 < bool > offWithInfo = new CodeStyleOption2 < bool > ( false , NotificationOption2 . Suggestion ) ;
31+ private static readonly CodeStyleOption2 < bool > onWithWarning = new CodeStyleOption2 < bool > ( true , NotificationOption2 . Warning ) ;
32+ private static readonly CodeStyleOption2 < bool > offWithWarning = new CodeStyleOption2 < bool > ( false , NotificationOption2 . Warning ) ;
33+ private static readonly CodeStyleOption2 < bool > onWithError = new CodeStyleOption2 < bool > ( true , NotificationOption2 . Error ) ;
34+ private static readonly CodeStyleOption2 < bool > offWithError = new CodeStyleOption2 < bool > ( false , NotificationOption2 . Error ) ;
4035
4136 // specify all options explicitly to override defaults.
42- public IDictionary < OptionKey , object > ImplicitTypeEverywhere ( ) => OptionsSet (
37+ internal IOptionsCollection ImplicitTypeEverywhere ( ) => OptionsSet (
4338 SingleOption ( CSharpCodeStyleOptions . VarElsewhere , onWithInfo ) ,
4439 SingleOption ( CSharpCodeStyleOptions . VarWhenTypeIsApparent , onWithInfo ) ,
4540 SingleOption ( CSharpCodeStyleOptions . VarForBuiltInTypes , onWithInfo ) ) ;
4641
47- private IDictionary < OptionKey , object > ImplicitTypeWhereApparent ( ) => OptionsSet (
42+ private IOptionsCollection ImplicitTypeWhereApparent ( ) => OptionsSet (
4843 SingleOption ( CSharpCodeStyleOptions . VarElsewhere , offWithInfo ) ,
4944 SingleOption ( CSharpCodeStyleOptions . VarWhenTypeIsApparent , onWithInfo ) ,
5045 SingleOption ( CSharpCodeStyleOptions . VarForBuiltInTypes , offWithInfo ) ) ;
5146
52- private IDictionary < OptionKey , object > ImplicitTypeWhereApparentAndForIntrinsics ( ) => OptionsSet (
47+ private IOptionsCollection ImplicitTypeWhereApparentAndForIntrinsics ( ) => OptionsSet (
5348 SingleOption ( CSharpCodeStyleOptions . VarElsewhere , offWithInfo ) ,
5449 SingleOption ( CSharpCodeStyleOptions . VarWhenTypeIsApparent , onWithInfo ) ,
5550 SingleOption ( CSharpCodeStyleOptions . VarForBuiltInTypes , onWithInfo ) ) ;
5651
57- public IDictionary < OptionKey , object > ImplicitTypeButKeepIntrinsics ( ) => OptionsSet (
52+ internal IOptionsCollection ImplicitTypeButKeepIntrinsics ( ) => OptionsSet (
5853 SingleOption ( CSharpCodeStyleOptions . VarElsewhere , onWithInfo ) ,
5954 SingleOption ( CSharpCodeStyleOptions . VarForBuiltInTypes , offWithInfo ) ,
6055 SingleOption ( CSharpCodeStyleOptions . VarWhenTypeIsApparent , onWithInfo ) ) ;
6156
62- private IDictionary < OptionKey , object > ImplicitTypeEnforcements ( ) => OptionsSet (
57+ private IOptionsCollection ImplicitTypeEnforcements ( ) => OptionsSet (
6358 SingleOption ( CSharpCodeStyleOptions . VarElsewhere , onWithWarning ) ,
6459 SingleOption ( CSharpCodeStyleOptions . VarWhenTypeIsApparent , onWithError ) ,
6560 SingleOption ( CSharpCodeStyleOptions . VarForBuiltInTypes , onWithInfo ) ) ;
6661
67- private IDictionary < OptionKey , object > ImplicitTypeSilentEnforcement ( ) => OptionsSet (
62+ private IOptionsCollection ImplicitTypeSilentEnforcement ( ) => OptionsSet (
6863 SingleOption ( CSharpCodeStyleOptions . VarElsewhere , onWithSilent ) ,
6964 SingleOption ( CSharpCodeStyleOptions . VarWhenTypeIsApparent , onWithSilent ) ,
7065 SingleOption ( CSharpCodeStyleOptions . VarForBuiltInTypes , onWithSilent ) ) ;
7166
72- private static IDictionary < OptionKey , object > Options ( OptionKey option , object value )
73- => new Dictionary < OptionKey , object > { { option , value } } ;
74-
7567 [ WpfFact , Trait ( Traits . Feature , Traits . Features . CodeActionsUseImplicitType ) ]
7668 public async Task NotOnFieldDeclaration ( )
7769 {
0 commit comments