VSWorkloadTests.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT license.
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using Microsoft.DotNet.MsiInstallerTests.Framework;
  9. namespace Microsoft.DotNet.MsiInstallerTests
  10. {
  11. public class VSWorkloadTests : VMTestBase
  12. {
  13. public VSWorkloadTests(ITestOutputHelper log) : base(log)
  14. {
  15. VM.SetCurrentState("Install VS 17.10 Preview 6");
  16. DeployStage2Sdk();
  17. }
  18. [Fact]
  19. public void WorkloadListShowsVSInstalledWorkloads()
  20. {
  21. var result = VM.CreateRunCommand("dotnet", "workload", "list")
  22. .WithIsReadOnly(true)
  23. .Execute();
  24. result.Should().Pass();
  25. result.Should().HaveStdOutContaining("aspire");
  26. }
  27. [Fact]
  28. public void UpdatesAreAdvertisedForVSInstalledWorkloads()
  29. {
  30. AddNuGetSource("https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json");
  31. VM.CreateRunCommand("dotnet", "new", "classlib", "-o", "LibraryTest")
  32. .WithWorkingDirectory(@"C:\SdkTesting")
  33. .Execute()
  34. .Should()
  35. .Pass();
  36. // build (or any restoring) command should check for and notify of updates
  37. VM.CreateRunCommand("dotnet", "build")
  38. .WithWorkingDirectory(@"C:\SdkTesting\LibraryTest")
  39. .Execute().Should().Pass()
  40. .And.HaveStdOutContaining("Workload updates are available");
  41. // Workload list should list the specific workloads that have updates
  42. VM.CreateRunCommand("dotnet", "workload", "list")
  43. .WithIsReadOnly(true)
  44. .Execute()
  45. .Should()
  46. .Pass()
  47. .And
  48. .HaveStdOutContaining("Updates are available for the following workload(s): aspire");
  49. }
  50. }
  51. }