GivenThatWeWantToProduceReferenceAssembly.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  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.Build.Tests
  4. {
  5. public class GivenThatWeWantToProduceReferenceAssembly : SdkTest
  6. {
  7. public GivenThatWeWantToProduceReferenceAssembly(ITestOutputHelper log) : base(log)
  8. { }
  9. [RequiresMSBuildVersionTheory("16.8.0")]
  10. [InlineData("netcoreapp3.1", false)]
  11. [InlineData(ToolsetInfo.CurrentTargetFramework, true)]
  12. public void It_produces_ref_assembly_for_appropriate_frameworks(string targetFramework, bool expectedExists)
  13. {
  14. TestProject testProject = new()
  15. {
  16. Name = "ProduceRefAssembly",
  17. IsExe = true,
  18. TargetFrameworks = targetFramework,
  19. };
  20. var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: targetFramework);
  21. var buildCommand = new BuildCommand(testAsset);
  22. buildCommand.Execute()
  23. .Should()
  24. .Pass();
  25. var filePath = Path.Combine(testAsset.Path, testProject.Name, "obj", "Debug", targetFramework, "ref", $"{testProject.Name}.dll");
  26. File.Exists(filePath).Should().Be(expectedExists);
  27. }
  28. }
  29. }