|
| 1 | +// Copyright (c) 2018 Jose Torres. All rights reserved. Licensed under the Apache License, Version 2.0. See LICENSE.md file in the project root for full license information. |
| 2 | + |
| 3 | +namespace VsixTesting.Installer.Tests |
| 4 | +{ |
| 5 | + using System; |
| 6 | + using Vs; |
| 7 | + using Xunit; |
| 8 | + |
| 9 | + public class ProgramTests |
| 10 | + { |
| 11 | + private const string CommunityId = "Microsoft.VisualStudio.Product.Community"; |
| 12 | + private const string ProfessionalId = "Microsoft.VisualStudio.Product.Professional"; |
| 13 | + private const string EnterpriseId = "Microsoft.VisualStudio.Product.Enterprise"; |
| 14 | + |
| 15 | + [Theory] |
| 16 | + [InlineData("2017", null, false, CommunityId)] |
| 17 | + [InlineData("15.0", null, false, CommunityId)] |
| 18 | + [InlineData("15", null, false, CommunityId)] |
| 19 | + [InlineData("2017", null, true, ProfessionalId)] |
| 20 | + [InlineData("2017", "Community", false, CommunityId)] |
| 21 | + [InlineData("2017", "Community", true, CommunityId)] |
| 22 | + [InlineData("2017", "Professional", false, ProfessionalId)] |
| 23 | + [InlineData("2017", "Professional", true, ProfessionalId)] |
| 24 | + void GetInstallation(string version, string sku, bool preview, string expected) |
| 25 | + { |
| 26 | + var installations = new[] |
| 27 | + { |
| 28 | + new VsInstallation(new Version(15, 0), string.Empty, "VisualStudio/15.0.0") { ProductId = CommunityId }, |
| 29 | + new VsInstallation(new Version(15, 0), string.Empty, "VisualStudio/15.0.0-pre.1.0+27729.1") { ProductId = ProfessionalId }, |
| 30 | + new VsInstallation(new Version(15, 1), string.Empty, "VisualStudio/15.0.1") { ProductId = EnterpriseId }, |
| 31 | + }; |
| 32 | + |
| 33 | + Assert.Equal(expected, Program.GetInstallation(installations, version, sku, preview).ProductId); |
| 34 | + } |
| 35 | + } |
| 36 | +} |
0 commit comments