@@ -36,22 +36,27 @@ public ConverterTestBase(string rootNamespace = null)
3636 . WithOptionCompareText ( false )
3737 . WithOptionStrict ( OptionStrict . Off )
3838 . WithOptionInfer ( true ) ;
39- EmptyNamespaceOptionStrictOff = new TextConversionOptions ( DefaultReferences . NetStandard2 ) {
39+ EmptyNamespaceOptionStrictOff = new TextConversionOptions ( References ) {
4040 RootNamespaceOverride = string . Empty , TargetCompilationOptionsOverride = options ,
4141 ShowCompilationErrors = true
4242 } ;
43- VisualBasic11 = new TextConversionOptions ( DefaultReferences . NetStandard2 ) {
43+ VisualBasic11 = new TextConversionOptions ( References ) {
4444 RootNamespaceOverride = string . Empty ,
4545 TargetCompilationOptionsOverride = options . WithParseOptions ( new VisualBasicParseOptions ( LanguageVersion . VisualBasic11 ) ) ,
4646 ShowCompilationErrors = true
4747 } ;
4848 }
4949
50+ private static IReadOnlyCollection < PortableExecutableReference > References { get ; } = DefaultReferences . With (
51+ typeof ( System . Windows . Forms . Form ) . Assembly ,
52+ typeof ( Microsoft . VisualBasic . Devices . Computer ) . Assembly
53+ ) ;
54+
5055 public async Task TestConversionCSharpToVisualBasicAsync ( string csharpCode , string expectedVisualBasicCode , bool expectSurroundingMethodBlock = false , bool expectCompilationErrors = false , TextConversionOptions conversionOptions = null , bool hasLineCommentConversionIssue = false )
5156 {
5257 expectedVisualBasicCode = AddSurroundingMethodBlock ( expectedVisualBasicCode , expectSurroundingMethodBlock ) ;
5358
54- conversionOptions ??= new TextConversionOptions ( DefaultReferences . NetStandard2 ) { ShowCompilationErrors = ! expectSurroundingMethodBlock } ;
59+ conversionOptions ??= new TextConversionOptions ( References ) { ShowCompilationErrors = ! expectSurroundingMethodBlock } ;
5560 await AssertConvertedCodeResultEqualsAsync < CSToVBConversion > ( csharpCode , expectedVisualBasicCode , conversionOptions ) ;
5661 if ( _testCstoVbCommentsByDefault && ! hasLineCommentConversionIssue ) {
5762 await AssertLineCommentsConvertedInSameOrderAsync < CSToVBConversion > ( csharpCode , conversionOptions , "//" , LineCanHaveCSharpComment ) ;
@@ -109,7 +114,7 @@ public async Task TestConversionVisualBasicToCSharpAsync(string visualBasicCode,
109114 bool incompatibleWithAutomatedCommentTesting = false )
110115 {
111116 if ( expectSurroundingBlock ) expectedCsharpCode = SurroundWithBlock ( expectedCsharpCode ) ;
112- var conversionOptions = new TextConversionOptions ( DefaultReferences . NetStandard2 ) {
117+ var conversionOptions = new TextConversionOptions ( References ) {
113118 RootNamespaceOverride = _rootNamespace ,
114119 ShowCompilationErrors = ! expectSurroundingBlock
115120 } ;
@@ -143,7 +148,7 @@ private static string SurroundWithBlock(string expectedCsharpCode)
143148
144149 protected async Task < string > ConvertAsync < TLanguageConversion > ( string inputCode , TextConversionOptions conversionOptions = default ) where TLanguageConversion : ILanguageConversion , new ( )
145150 {
146- var textConversionOptions = conversionOptions ?? new TextConversionOptions ( DefaultReferences . NetStandard2 ) { RootNamespaceOverride = _rootNamespace , ShowCompilationErrors = true } ;
151+ var textConversionOptions = conversionOptions ?? new TextConversionOptions ( References ) { RootNamespaceOverride = _rootNamespace , ShowCompilationErrors = true } ;
147152 var conversionResult = await ProjectConversion . ConvertTextAsync < TLanguageConversion > ( inputCode , textConversionOptions ) ;
148153 return ( conversionResult . ConvertedCode ?? "" ) + ( conversionResult . GetExceptionsAsString ( ) ?? "" ) ;
149154 }
0 commit comments