Properly sort instances for -Latest · microsoft/vssetup.powershell@0f58b5c (original) (raw)
File tree
4 files changed
lines changed
- src/VSSetup.PowerShell/PowerShell
- test/VSSetup.PowerShell.Test
4 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -3,7 +3,7 @@ | ||
3 | 3 | "installationName": "VisualStudio/public.d15rel/15.0.26116.0", |
4 | 4 | "installationVersion": "15.0.26116", |
5 | 5 | "installationPath": "C:\\VS\\Community", |
6 | -"installDate": "2017-01-17T03:45:00Z", | |
6 | +"installDate": "2017-01-18T03:45:00Z", | |
7 | 7 | "product": { |
8 | 8 | "id": "Microsoft.VisualStudio.Product.Community", |
9 | 9 | "version": "15.0.26116.0", |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -3,7 +3,7 @@ | ||
3 | 3 | "installationName": "VisualStudio/public.d15rel/15.0.26117.0", |
4 | 4 | "installationVersion": "15.0.26117", |
5 | 5 | "installationPath": "C:\\VS\\Enterprise", |
6 | -"installDate": "2017-01-18T03:15:00Z", | |
6 | +"installDate": "2017-01-17T03:15:00Z", | |
7 | 7 | "product": { |
8 | 8 | "id": "Microsoft.VisualStudio.Product.Enterprise", |
9 | 9 | "version": "15.0.26117.0", |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -139,17 +139,14 @@ bool Contains(IEnumerable packages, Func<PackageReference, str | ||
139 | 139 | select instance; |
140 | 140 | } |
141 | 141 | |
142 | -if (Latest) | |
143 | -{ | |
144 | -// Sort by the InstallationVersion then InstallDate so we can easily find the latest. | |
145 | -instances = instances.OrderBy(instance => instance, InstanceComparer.VersionAndDate); | |
146 | -} | |
147 | - | |
148 | 142 | foreach (var instance in instances) |
149 | 143 | { |
150 | 144 | if (Latest) |
151 | 145 | { |
152 | -latestInstance = instance; | |
146 | +if (latestInstance == null | | |
147 | +{ | |
148 | +latestInstance = instance; | |
149 | +} | |
153 | 150 | } |
154 | 151 | else |
155 | 152 | { |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -45,6 +45,8 @@ public static IEnumerable<object[]> GetCompareVersionAndDateData() | ||
45 | 45 | new object[] { Mock(v1), Mock(v1), 0 }, |
46 | 46 | new object[] { Mock(v1), Mock(v2), -1 }, |
47 | 47 | new object[] { Mock(v2), Mock(v1), 1 }, |
48 | +new object[] { Mock(v1, ft2), Mock(v2, ft1), -1 }, | |
49 | +new object[] { Mock(v2, ft1), Mock(v1, ft2), 1 }, | |
48 | 50 | new object[] { Mock(v2, ft1), Mock(v2, ft2), -1 }, |
49 | 51 | new object[] { Mock(v2, ft2), Mock(v2, ft1), 1 }, |
50 | 52 | }; |