Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@

namespace Microsoft.DotNet.Cli.Utils.Tests
{
[TestClass]
public class TransientSdkResolutionErrorDetectorTests
{
[Fact]
[TestMethod]
public void TransientInBoxSdkResolutionFailureIsDetected()
{
string input =
Expand All @@ -20,13 +21,13 @@ public void TransientInBoxSdkResolutionFailureIsDetected()
TransientSdkResolutionErrorDetector.IsTransientError(input).Should().BeTrue();
}

[Fact]
[TestMethod]
public void NullInputIsNotTransient()
{
TransientSdkResolutionErrorDetector.IsTransientError(null).Should().BeFalse();
}

[Fact]
[TestMethod]
public void SuccessfulBuildIsNotTransient()
{
string input =
Expand All @@ -37,7 +38,7 @@ public void SuccessfulBuildIsNotTransient()
TransientSdkResolutionErrorDetector.IsTransientError(input).Should().BeFalse();
}

[Fact]
[TestMethod]
public void MissingVersionedSdkWithoutResolverNullIsNotTransient()
{
// A genuinely missing, version-specified SDK is a deterministic failure (no workload resolver
Expand All @@ -47,7 +48,7 @@ public void MissingVersionedSdkWithoutResolverNullIsNotTransient()
TransientSdkResolutionErrorDetector.IsTransientError(input).Should().BeFalse();
}

[Fact]
[TestMethod]
public void OtherResolverReturningNullIsNotTransient()
{
// A "returned null" message from a different resolver must not trigger a retry: only the in-box
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,20 @@

namespace Microsoft.NET.Publish.Tests
{
[TestClass]
public class FilesCopiedToPublishDirTests : SdkTest
{
public FilesCopiedToPublishDirTests(ITestOutputHelper log) : base(log)
{
}

private static readonly List<string> FrameworkAssemblies = new()
{
"api-ms-win-core-console-l1-1-0.dll",
"System.Runtime.dll",
"WindowsBase.dll",
};

[Theory]
[InlineData(true, false)]
[InlineData(true, true)]
[InlineData(false, false)]
[TestMethod]
[DataRow(true, false)]
[DataRow(true, true)]
[DataRow(false, false)]
public void RunFilesCopiedToPublishDirTest(bool specifyRid, bool singleFile)
{
var testProject = new TestProject()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#nullable disable
Expand All @@ -12,12 +12,9 @@

namespace Microsoft.NET.Publish.Tests
{
[TestClass]
public class GivenThatAPublishedDepsJsonShouldContainVersionInformation : SdkTest
{
public GivenThatAPublishedDepsJsonShouldContainVersionInformation(ITestOutputHelper log) : base(log)
{
}

private TestProject GetTestProject()
{
var testProject = new TestProject()
Expand All @@ -32,7 +29,7 @@ private TestProject GetTestProject()
return testProject;
}

[Fact]
[TestMethod]
public void Versions_are_included_in_deps_json()
{
var testProject = GetTestProject();
Expand All @@ -54,7 +51,8 @@ public void Versions_are_included_in_deps_json()

// https://github.com/dotnet/sdk/issues/49665
// Failed to load /private/tmp/helix/working/B3F609DC/p/d/shared/Microsoft.NETCore.App/8.0.0/libhostpolicy.dylib, error: dlopen(/private/tmp/helix/working/B3F609DC/p/d/shared/Microsoft.NETCore.App/8.0.0/libhostpolicy.dylib, 0x0001): tried: '/private/tmp/helix/working/B3F609DC/p/d/shared/Microsoft.NETCore.App/8.0.0/libhostpolicy.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/private/tmp/helix/working/B3F609DC/p/d/shared/Microsoft.NETCore.App/8.0.0/libhostpolicy.dylib' (no such file), '/private/tmp/helix/working/B3F609DC/p/d/shared/Microsoft.NETCore.App/8.0.0/libhostpolicy.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))
[PlatformSpecificFact(TestPlatforms.Any & ~TestPlatforms.OSX)]
[TestMethod]
[OSCondition(ConditionMode.Exclude, OperatingSystems.OSX)]
public void Inbox_version_of_assembly_is_loaded_over_applocal_version()
{
var (coreDir, publishDir, immutableDir) = TestConflictResult();
Expand All @@ -63,7 +61,8 @@ public void Inbox_version_of_assembly_is_loaded_over_applocal_version()

// https://github.com/dotnet/sdk/issues/49665
// Failed to load /private/tmp/helix/working/B3F609DC/p/d/shared/Microsoft.NETCore.App/8.0.0/libhostpolicy.dylib, error: dlopen(/private/tmp/helix/working/B3F609DC/p/d/shared/Microsoft.NETCore.App/8.0.0/libhostpolicy.dylib, 0x0001): tried: '/private/tmp/helix/working/B3F609DC/p/d/shared/Microsoft.NETCore.App/8.0.0/libhostpolicy.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/private/tmp/helix/working/B3F609DC/p/d/shared/Microsoft.NETCore.App/8.0.0/libhostpolicy.dylib' (no such file), '/private/tmp/helix/working/B3F609DC/p/d/shared/Microsoft.NETCore.App/8.0.0/libhostpolicy.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))
[PlatformSpecificFact(TestPlatforms.Any & ~TestPlatforms.OSX)]
[TestMethod]
[OSCondition(ConditionMode.Exclude, OperatingSystems.OSX)]
public void Inbox_version_is_loaded_if_runtime_file_versions_arent_in_deps()
{
static void testProjectChanges(TestProject testProject)
Expand All @@ -77,7 +76,8 @@ static void testProjectChanges(TestProject testProject)

// https://github.com/dotnet/sdk/issues/49665
// Failed to load /private/tmp/helix/working/B3F609DC/p/d/shared/Microsoft.NETCore.App/8.0.0/libhostpolicy.dylib, error: dlopen(/private/tmp/helix/working/B3F609DC/p/d/shared/Microsoft.NETCore.App/8.0.0/libhostpolicy.dylib, 0x0001): tried: '/private/tmp/helix/working/B3F609DC/p/d/shared/Microsoft.NETCore.App/8.0.0/libhostpolicy.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/private/tmp/helix/working/B3F609DC/p/d/shared/Microsoft.NETCore.App/8.0.0/libhostpolicy.dylib' (no such file), '/private/tmp/helix/working/B3F609DC/p/d/shared/Microsoft.NETCore.App/8.0.0/libhostpolicy.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))
[PlatformSpecificFact(TestPlatforms.Any & ~TestPlatforms.OSX)]
[TestMethod]
[OSCondition(ConditionMode.Exclude, OperatingSystems.OSX)]
public void Local_version_of_assembly_with_higher_version_is_loaded_over_inbox_version()
{
static void publishFolderChanges(string publishFolder)
Expand Down Expand Up @@ -198,13 +198,13 @@ void CheckVersionsInDepsFile(string depsFilePath)
}
}

[Fact]
[TestMethod]
public void Versions_are_included_for_self_contained_apps()
{
Versions_are_included(build: false);
}

[Fact]
[TestMethod]
public void Versions_are_included_for_build()
{
Versions_are_included(build: true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@

namespace Microsoft.NET.Publish.Tests
{
[TestClass]
public class GivenThatWeWantToCrossPublish : SdkTest
{
public GivenThatWeWantToCrossPublish(ITestOutputHelper log) : base(log)
{
}

[Fact]
[TestMethod]
public void There_should_be_no_unresolved_conflicts()
{
var testProject = new TestProject()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@

namespace Microsoft.NET.Publish.Tests
{
[TestClass]
public class GivenThatWeWantToExcludeAPackageFromPublish : SdkTest
{
public GivenThatWeWantToExcludeAPackageFromPublish(ITestOutputHelper log) : base(log)
{
}

[Theory]
[InlineData("netcoreapp1.1", false)]
[InlineData("netcoreapp2.0", false)]
[InlineData(ToolsetInfo.CurrentTargetFramework, true)]
[TestMethod]
[DataRow("netcoreapp1.1", false)]
[DataRow("netcoreapp2.0", false)]
[DataRow(ToolsetInfo.CurrentTargetFramework, true)]
public void It_does_not_publish_a_PackageReference_with_PrivateAssets_All(string targetFramework, bool shouldIncludeExecutable)
{
var helloWorldAsset = TestAssetsManager
Expand Down Expand Up @@ -62,10 +59,10 @@ public void It_does_not_publish_a_PackageReference_with_PrivateAssets_All(string
publishDirectory.Should().OnlyHaveFiles(expectedFiles);
}

[Theory]
[InlineData("netcoreapp1.1", false)]
[InlineData("netcoreapp2.0", false)]
[InlineData(ToolsetInfo.CurrentTargetFramework, true)]
[TestMethod]
[DataRow("netcoreapp1.1", false)]
[DataRow("netcoreapp2.0", false)]
[DataRow(ToolsetInfo.CurrentTargetFramework, true)]
public void It_does_not_publish_a_PackageReference_with_Publish_false(string targetFramework, bool shouldIncludeExecutable)
{
var helloWorldAsset = TestAssetsManager
Expand Down Expand Up @@ -112,10 +109,10 @@ public void It_does_not_publish_a_PackageReference_with_Publish_false(string tar
publishDirectory.Should().OnlyHaveFiles(expectedFiles);
}

[Theory]
[InlineData("netcoreapp1.1", false)]
[InlineData("netcoreapp2.0", false)]
[InlineData(ToolsetInfo.CurrentTargetFramework, true)]
[TestMethod]
[DataRow("netcoreapp1.1", false)]
[DataRow("netcoreapp2.0", false)]
[DataRow(ToolsetInfo.CurrentTargetFramework, true)]
public void It_publishes_a_PackageReference_with_PrivateAssets_All_and_Publish_true(string targetFramework, bool shouldIncludeExecutable)
{
var helloWorldAsset = TestAssetsManager
Expand Down Expand Up @@ -173,7 +170,7 @@ public void It_publishes_a_PackageReference_with_PrivateAssets_All_and_Publish_t
publishDirectory.Should().OnlyHaveFiles(expectedFiles);
}

[Fact]
[TestMethod]
public void TransitiveNetStandardPackageReferenceAndPublishFalse()
{
var testLibraryProject = new TestProject()
Expand Down Expand Up @@ -202,7 +199,7 @@ public void TransitiveNetStandardPackageReferenceAndPublishFalse()
publishCommand.Execute().Should().Pass();
}

[Fact]
[TestMethod]
public void TransitivePackageReferenceAndPublishFalse()
{
var testLibraryProject = new TestProject()
Expand Down Expand Up @@ -234,7 +231,7 @@ public void TransitivePackageReferenceAndPublishFalse()
publishDirectory.Should().NotHaveFile("Newtonsoft.Json.dll");
}

[Fact]
[TestMethod]
public void It_does_not_exclude_packages_depended_on_by_non_privateassets_references()
{
var testProject = new TestProject()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@

namespace Microsoft.NET.Publish.Tests
{
[TestClass]
public class GivenThatWeWantToFilterSatelliteAssemblies : SdkTest
{
public GivenThatWeWantToFilterSatelliteAssemblies(ITestOutputHelper log) : base(log)
{
}

[Theory]
[InlineData("netcoreapp2.0")]
[InlineData(ToolsetInfo.CurrentTargetFramework)]
[TestMethod]
[DataRow("netcoreapp2.0")]
[DataRow(ToolsetInfo.CurrentTargetFramework)]

public void It_only_publishes_selected_ResourceLanguages(string tfm)
{
Expand Down Expand Up @@ -53,7 +50,7 @@ public void It_only_publishes_selected_ResourceLanguages(string tfm)

publishDirectory.Should().OnlyHaveFiles(files);
}
[Fact]
[TestMethod]
public void It_publishes_all_satellites_when_not_filtered()
{
var testProject = new TestProject()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,16 @@

namespace Microsoft.NET.Publish.Tests
{
[TestClass]
public class GivenThatWeWantToPreserveCompilationContext : SdkTest
{
public GivenThatWeWantToPreserveCompilationContext(ITestOutputHelper log) : base(log)
{
}

[Theory]
[TestMethod]
// Skip = "https://github.com/dotnet/sdk/issues/53796"
//[InlineData("net46", "netstandard1.3", false)]
[InlineData("netcoreapp2.0", "netstandard2.0", false)]
[InlineData("netcoreapp2.0", "netstandard2.0", true)]
[InlineData("netcoreapp3.0", "netstandard2.0", false)]
[InlineData("netcoreapp3.0", "netstandard2.0", true)]
//[DataRow("net46", "netstandard1.3", false)]
[DataRow("netcoreapp2.0", "netstandard2.0", false)]
[DataRow("netcoreapp2.0", "netstandard2.0", true)]
[DataRow("netcoreapp3.0", "netstandard2.0", false)]
[DataRow("netcoreapp3.0", "netstandard2.0", true)]
public void It_publishes_the_project_with_a_refs_folder_and_correct_deps_file(string appTargetFramework, string libraryTargetFramework, bool withoutCopyingRefs)
{
if (appTargetFramework == "net46" && !RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
Expand Down Expand Up @@ -161,7 +158,7 @@ public void It_publishes_the_project_with_a_refs_folder_and_correct_deps_file(st
}
}

[Fact]
[TestMethod]
public void It_excludes_runtime_store_packages_from_the_refs_folder()
{
var targetFramework = "netcoreapp2.0";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace Microsoft.NET.Publish.Tests
{
[TestClass]
public class GivenThatWeWantToPublishAComServerLibrary : SdkTest
{
public GivenThatWeWantToPublishAComServerLibrary(ITestOutputHelper log) : base(log)
{
}

[WindowsOnlyFact]
[TestMethod]
[OSCondition(OperatingSystems.Windows)]
public void It_publishes_comhost_to_the_publish_folder()
{
var testAsset = TestAssetsManager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@

namespace Microsoft.NET.Build.Tests
{
[TestClass]
public class GivenThatWeWantToPublishACppCliAppProject : SdkTest
{
public GivenThatWeWantToPublishACppCliAppProject(ITestOutputHelper log) : base(log)
{
}

[FullMSBuildOnlyFact]
[TestMethod]
[FullMSBuildOnly]
public void It_should_fail_with_error_message()
{
var testAsset = TestAssetsManager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@

namespace Microsoft.NET.Build.Tests
{
[TestClass]
public class GivenThatWeWantToPublishACppCliProject : SdkTest
{
public GivenThatWeWantToPublishACppCliProject(ITestOutputHelper log) : base(log)
{
}

[FullMSBuildOnlyFact(Skip = "https://github.com/dotnet/sdk/issues/53789")]
[TestMethod]
[FullMSBuildOnly]
[Ignore("https://github.com/dotnet/sdk/issues/53789")]
public void When_referenced_by_csharp_project_it_publishes_and_runs()
{
var testAsset = TestAssetsManager
Expand Down Expand Up @@ -39,7 +38,9 @@ public void When_referenced_by_csharp_project_it_publishes_and_runs()
.HaveStdOutContaining("Hello, World!");
}

[FullMSBuildOnlyFact(Skip = "There is no publish error when using PackageReference support which is required for testing")]
[TestMethod]
[FullMSBuildOnly]
[Ignore("There is no publish error when using PackageReference support which is required for testing")]
public void When_not_referenced_by_csharp_project_it_fails_to_publish()
{
var testAsset = TestAssetsManager
Expand Down
Loading
Loading