@@ -35,20 +35,20 @@ void main() {
3535 // A minimum version of a response where a VS installation was found.
3636 const Map <String , dynamic > _defaultResponse = < String , dynamic > {
3737 'installationPath' : visualStudioPath,
38- 'displayName' : 'Visual Studio Community 2017 ' ,
39- 'installationVersion' : '15.9.28307.665 ' ,
38+ 'displayName' : 'Visual Studio Community 2019 ' ,
39+ 'installationVersion' : '16.2.29306.81 ' ,
4040 'isRebootRequired' : false ,
4141 'isComplete' : true ,
4242 'isLaunchable' : true ,
4343 'isPrerelease' : false ,
4444 'catalog' : < String , dynamic > {
45- 'productDisplayVersion' : '15.9.12 ' ,
46- },
45+ 'productDisplayVersion' : '16.2.5 ' ,
46+ }
4747 };
4848
4949 // A version of a response that doesn't include certain installation status
5050 // information that might be missing in older Visual Studio versions.
51- const Map <String , dynamic > _oldResponse = < String , dynamic > {
51+ const Map <String , dynamic > _missingStatusResponse = < String , dynamic > {
5252 'installationPath' : visualStudioPath,
5353 'displayName' : 'Visual Studio Community 2017' ,
5454 'installationVersion' : '15.9.28307.665' ,
@@ -205,10 +205,32 @@ void main() {
205205 ProcessManager : () => mockProcessManager,
206206 });
207207
208+ testUsingContext ('necessaryComponentDescriptions suggest the right VS tools on major version 15' , () {
209+
210+ visualStudio = VisualStudio ();
211+ final String toolsString = visualStudio.necessaryComponentDescriptions (15 )[1 ];
212+ expect (toolsString.contains ('v141' ), true );
213+ }, overrides: < Type , Generator > {
214+ FileSystem : () => memoryFilesystem,
215+ Platform : () => windowsPlatform,
216+ ProcessManager : () => mockProcessManager,
217+ });
218+
219+ testUsingContext ('necessaryComponentDescriptions suggest the right VS tools on major version != 15' , () {
220+
221+ visualStudio = VisualStudio ();
222+ final String toolsString = visualStudio.necessaryComponentDescriptions (16 )[1 ];
223+ expect (toolsString.contains ('v142' ), true );
224+ }, overrides: < Type , Generator > {
225+ FileSystem : () => memoryFilesystem,
226+ Platform : () => windowsPlatform,
227+ ProcessManager : () => mockProcessManager,
228+ });
229+
208230 testUsingContext ('isInstalled returns true even with missing status information' , () {
209231 setMockCompatibleVisualStudioInstallation (null );
210232 setMockPrereleaseVisualStudioInstallation (null );
211- setMockAnyVisualStudioInstallation (_oldResponse );
233+ setMockAnyVisualStudioInstallation (_missingStatusResponse );
212234
213235 visualStudio = VisualStudio ();
214236 expect (visualStudio.isInstalled, true );
@@ -360,10 +382,10 @@ void main() {
360382 setMockAnyVisualStudioInstallation (_defaultResponse);
361383
362384 visualStudio = VisualStudio ();
363- expect (visualStudio.displayName, equals ('Visual Studio Community 2017 ' ));
364- expect (visualStudio.displayVersion, equals ('15.9.12 ' ));
385+ expect (visualStudio.displayName, equals ('Visual Studio Community 2019 ' ));
386+ expect (visualStudio.displayVersion, equals ('16.2.5 ' ));
365387 expect (visualStudio.installLocation, equals (visualStudioPath));
366- expect (visualStudio.fullVersion, equals ('15.9.28307.665 ' ));
388+ expect (visualStudio.fullVersion, equals ('16.2.29306.81 ' ));
367389 }, overrides: < Type , Generator > {
368390 FileSystem : () => memoryFilesystem,
369391 Platform : () => windowsPlatform,
@@ -386,7 +408,17 @@ void main() {
386408 });
387409
388410 testUsingContext ('Metadata is for compatible version when latest is missing components' , () {
389- setMockCompatibleVisualStudioInstallation (_defaultResponse);
411+ // Return a different version for queries without the required packages.
412+ final Map <String , dynamic > olderButCompleteVersionResponse = < String , dynamic > {
413+ 'installationPath' : visualStudioPath,
414+ 'displayName' : 'Visual Studio Community 2017' ,
415+ 'installationVersion' : '15.9.28307.665' ,
416+ 'catalog' : < String , dynamic > {
417+ 'productDisplayVersion' : '15.9.12' ,
418+ }
419+ };
420+
421+ setMockCompatibleVisualStudioInstallation (olderButCompleteVersionResponse);
390422 setMockPrereleaseVisualStudioInstallation (null );
391423 // Return a different version for queries without the required packages.
392424 final Map <String , dynamic > incompleteVersionResponse = < String , dynamic > {
0 commit comments