GivenThatWeWantToPackASimpleLibrary.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. namespace Microsoft.NET.Pack.Tests
  4. {
  5. public class GivenThatWeWantToPackASimpleLibrary : SdkTest
  6. {
  7. public GivenThatWeWantToPackASimpleLibrary(ITestOutputHelper log) : base(log)
  8. {
  9. }
  10. [RequiresMSBuildVersionFact("17.1.0.60101")]
  11. public void It_packs_successfully()
  12. {
  13. var testAsset = _testAssetsManager
  14. .CopyTestAsset("HelloWorld")
  15. .WithSource();
  16. var packCommand = new PackCommand(testAsset);
  17. packCommand
  18. .Execute()
  19. .Should()
  20. .Pass();
  21. var packageDirectory = packCommand.GetPackageDirectory();
  22. packageDirectory.Should().OnlyHaveFiles(new[]
  23. {
  24. "HelloWorld.1.0.0.nupkg",
  25. }, SearchOption.TopDirectoryOnly);
  26. var outputDirectory = packCommand.GetOutputDirectory();
  27. outputDirectory.Should().OnlyHaveFiles(new[] {
  28. $"HelloWorld.dll",
  29. $"HelloWorld.pdb",
  30. $"HelloWorld.deps.json",
  31. $"HelloWorld.runtimeconfig.json",
  32. $"HelloWorld{EnvironmentInfo.ExecutableExtension}",
  33. });
  34. }
  35. }
  36. }