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
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="MSTest.Sdk">

<PropertyGroup>
<EnableDefaultItems>false</EnableDefaultItems>
Expand All @@ -9,8 +9,6 @@
</PropertyGroup>

<PropertyGroup>
<OutputType>Exe</OutputType>
<PackageId>testSdkBlazorWasmAoT</PackageId>
<BuildHelixPayload Condition="'$(RunAoTTests)' != 'true'">false</BuildHelixPayload>
</PropertyGroup>

Expand Down Expand Up @@ -52,11 +50,16 @@
<PackageReference Include="Microsoft.Build.Framework" />
<PackageReference Include="Microsoft.Build.Utilities.Core" />
<PackageReference Include="Moq" />
<Using Include="Microsoft.NET.TestFramework" />
<Using Include="Microsoft.NET.TestFramework.Assertions" />
<Using Include="Microsoft.NET.TestFramework.Commands" />
<Using Include="Microsoft.NET.TestFramework.ProjectConstruction" />
<Using Include="Microsoft.NET.TestFramework.Utilities" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\BlazorWasmSdk\Tasks\Microsoft.NET.Sdk.BlazorWebAssembly.Tasks.csproj" SkipGetTargetFrameworkProperties="true" />
<ProjectReference Include="..\..\src\RazorSdk\Tasks\Microsoft.NET.Sdk.Razor.Tasks.csproj" />
<ProjectReference Include="..\Microsoft.NET.TestFramework\Microsoft.NET.TestFramework.csproj" />
<ProjectReference Include="..\Microsoft.NET.TestFramework.MSTest\Microsoft.NET.TestFramework.MSTest.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@

namespace Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests
{
[TestClass]
public class WasmAoTPublishIntegrationTest : WasmPublishIntegrationTestBase
{
public WasmAoTPublishIntegrationTest(ITestOutputHelper log) : base(log) { }

[Fact]
[TestMethod]
public void AoT_Publish_InRelease_Works()
{
// Arrange
Expand Down Expand Up @@ -56,7 +55,7 @@ public void AoT_Publish_InRelease_Works()
new FileInfo(Path.Combine(blazorPublishDirectory, "css", "app.css")).Should().Contain(".publish");
}

[Fact]
[TestMethod]
public void AoT_Publish_WithExistingWebConfig_Works()
{
// Arrange
Expand Down Expand Up @@ -84,7 +83,7 @@ public void AoT_Publish_WithExistingWebConfig_Works()
webConfig.Should().Contain(webConfigContents);
}

[Fact]
[TestMethod]
public void AoT_Publish_HostedAppWithScopedCss_VisualStudio()
{
// Simulates publishing the same way VS does by setting BuildProjectReferences=false.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
// 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.

using Microsoft.NET.Sdk.StaticWebAssets.Tests;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Microsoft.NET.Sdk.BlazorWebAssembly.Tests
{
public class BlazorLegacyIntegrationTest50(ITestOutputHelper log)
: IsolatedNuGetPackageFolderAspNetSdkBaselineTest(log, nameof(BlazorLegacyIntegrationTest50))
[TestClass]
public class BlazorLegacyIntegrationTest50 : IsolatedNuGetPackageFolderAspNetSdkBaselineTest
{
[CoreMSBuildOnlyFact]
protected override string RestoreNugetPackagePath => nameof(BlazorLegacyIntegrationTest50);
[TestMethod]
[CoreMSBuildOnly]
public void Build50Hosted_Works()
{
// Arrange
Expand Down Expand Up @@ -45,16 +48,12 @@ public void Build50Hosted_Works()
content.Should().Contain(Path.Combine("Client", "wwwroot"));
}

[CoreMSBuildOnlyFact]
[TestMethod]
[CoreMSBuildOnly]
// https://github.com/dotnet/sdk/issues/49665
[OSCondition(ConditionMode.Exclude, OperatingSystems.OSX)]
public void Publish50Hosted_Works()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
// https://github.com/dotnet/sdk/issues/49665
// tried: '/private/tmp/helix/working/A452091E/p/d/shared/Microsoft.NETCore.App/7.0.0/libhostpolicy.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')),
return;
}

// Arrange
var testAsset = "BlazorWasmHosted50";
var targetFramework = "net5.0";
Expand Down Expand Up @@ -87,4 +86,4 @@ public void Publish50Hosted_Works()
});
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
// 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.

using Microsoft.AspNetCore.StaticWebAssets.Tasks;
using Microsoft.NET.Sdk.StaticWebAssets.Tests;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Microsoft.NET.Sdk.BlazorWebAssembly.Tests
{
public class BlazorLegacyIntegrationTest60(ITestOutputHelper log)
: IsolatedNuGetPackageFolderAspNetSdkBaselineTest(log, nameof(BlazorLegacyIntegrationTest60))
[TestClass]
public class BlazorLegacyIntegrationTest60 : IsolatedNuGetPackageFolderAspNetSdkBaselineTest
{
protected override string RestoreNugetPackagePath => nameof(BlazorLegacyIntegrationTest60);

protected override string EmbeddedResourcePrefix =>
string.Join('.', "Microsoft.NET.Sdk.BlazorWebAssembly.Tests", "StaticWebAssetsBaselines");

protected override string ComputeBaselineFolder() =>
Path.Combine(SdkTestContext.GetRepoRoot() ?? AppContext.BaseDirectory, "test", "Microsoft.NET.Sdk.BlazorWebAssembly.Tests", "StaticWebAssetsBaselines");

[CoreMSBuildOnlyFact]
[TestMethod]
[CoreMSBuildOnly]
public void Build60Hosted_Works()
{
// Arrange
Expand All @@ -43,8 +46,11 @@ public void Build60Hosted_Works()
new FileInfo(Path.Combine(serverBuildOutputDirectory, $"{testAsset}.Shared.dll")).Should().Exist();
}

[WindowsOnlyRequiresMSBuildVersionFact("17.13", Reason = "Needs System.Text.Json 8.0.5", Skip = "https://github.com/dotnet/sdk/issues/49925")] // https://github.com/dotnet/sdk/issues/44886
[SkipOnPlatform(TestPlatforms.Linux | TestPlatforms.OSX, "https://github.com/dotnet/sdk/issues/42145")]
[TestMethod]
[OSCondition(OperatingSystems.Windows)]
[RequiresMSBuildVersion("17.13")]
[Ignore("https://github.com/dotnet/sdk/issues/49925")] // https://github.com/dotnet/sdk/issues/44886
// https://github.com/dotnet/sdk/issues/42145
public void Publish60Hosted_Works()
{
// Arrange
Expand Down Expand Up @@ -92,4 +98,4 @@ public void Publish60Hosted_Works()
intermediateOutputPath);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@
// The .NET Foundation licenses this file to you under the MIT license.

using Microsoft.NET.Sdk.StaticWebAssets.Tests;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Microsoft.NET.Sdk.BlazorWebAssembly.Tests
{
public class BlazorMultitargetIntegrationTest(ITestOutputHelper log)
: IsolatedNuGetPackageFolderAspNetSdkBaselineTest(log, nameof(BlazorMultitargetIntegrationTest))
[TestClass]
public class BlazorMultitargetIntegrationTest : IsolatedNuGetPackageFolderAspNetSdkBaselineTest
{
protected override string RestoreNugetPackagePath => nameof(BlazorMultitargetIntegrationTest);

[RequiresMSBuildVersionFact("17.12", Reason = "Needs System.Text.Json 8.0.5")]
[TestMethod]
[RequiresMSBuildVersion("17.12")]
public void MultiTargetApp_LoadsTheCorrectSdkBasedOnTfm()
{
// Arrange
Expand All @@ -29,7 +32,8 @@ public void MultiTargetApp_LoadsTheCorrectSdkBasedOnTfm()
browserDependencies.File("captured-references.txt").Should().NotContain("Microsoft.AspNetCore.Components.Server.dll");
}

[RequiresMSBuildVersionFact("17.12", Reason = "Needs System.Text.Json 8.0.5")]
[TestMethod]
[RequiresMSBuildVersion("17.12")]
public void ReferencedMultiTargetApp_LoadsTheCorrectSdkBasedOnTfm()
{
// Arrange
Expand All @@ -49,4 +53,4 @@ public void ReferencedMultiTargetApp_LoadsTheCorrectSdkBasedOnTfm()
browserDependencies.File("captured-references.txt").Should().NotContain("Microsoft.AspNetCore.Components.Server.dll");
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Moq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Microsoft.NET.Sdk.BlazorWebAssembly.Tests
{
[TestClass]
public class BlazorReadSatelliteAssemblyFileTest
{
[Fact]
[TestMethod]
public void WritesAndReadsRoundTrip()
{
// Arrange/Act
Expand Down Expand Up @@ -59,4 +61,4 @@ public void WritesAndReadsRoundTrip()
);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
// 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.

using Microsoft.NET.Sdk.StaticWebAssets.Tests;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Microsoft.NET.Sdk.BlazorWebAssembly.Tests
{
public class BlazorWasmBaselineTests(ITestOutputHelper log, bool generateBaselines) : AspNetSdkBaselineTest(log, generateBaselines)
#pragma warning disable MSTEST0016
[TestClass]
public class BlazorWasmBaselineTests : AspNetSdkBaselineTest
{
protected override string EmbeddedResourcePrefix => string.Join('.', "Microsoft.NET.Sdk.BlazorWebAssembly.Tests", "StaticWebAssetsBaselines");

protected override string ComputeBaselineFolder() =>
Path.Combine(SdkTestContext.GetRepoRoot() ?? AppContext.BaseDirectory, "test", "Microsoft.NET.Sdk.BlazorWebAssembly.Tests", "StaticWebAssetsBaselines");
}
}
#pragma warning restore MSTEST0016
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
// 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

using Microsoft.AspNetCore.StaticWebAssets.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Microsoft.NET.Sdk.BlazorWebAssembly.Tests
{
public class BlazorWasmStaticWebAssetsIntegrationTest(ITestOutputHelper log) : BlazorWasmBaselineTests(log, GenerateBaselines)
[TestClass]
public class BlazorWasmStaticWebAssetsIntegrationTest : BlazorWasmBaselineTests
{
[RequiresMSBuildVersionFact("17.12", Reason = "Needs System.Text.Json 8.0.5")]
[TestMethod]
[RequiresMSBuildVersion("17.12")]
public void StaticWebAssets_BuildMinimal_Works()
{
// Arrange
Expand Down Expand Up @@ -51,7 +54,8 @@ public void StaticWebAssets_BuildMinimal_Works()
intermediateOutputPath);
}

[RequiresMSBuildVersionFact("17.12", Reason = "Needs System.Text.Json 8.0.5")]
[TestMethod]
[RequiresMSBuildVersion("17.12")]
public void StaticWebAssets_PublishMinimal_Works()
{
// Arrange
Expand Down Expand Up @@ -88,7 +92,8 @@ public void StaticWebAssets_PublishMinimal_Works()
intermediateOutputPath);
}

[RequiresMSBuildVersionFact("17.12", Reason = "Needs System.Text.Json 8.0.5")]
[TestMethod]
[RequiresMSBuildVersion("17.12")]
public void StaticWebAssets_Build_Hosted_Works()
{
// Arrange
Expand Down Expand Up @@ -128,7 +133,8 @@ public void StaticWebAssets_Build_Hosted_Works()
intermediateOutputPath);
}

[RequiresMSBuildVersionFact("17.12", Reason = "Needs System.Text.Json 8.0.5")]
[TestMethod]
[RequiresMSBuildVersion("17.12")]
public void StaticWebAssets_Publish_Hosted_Works()
{
// Arrange
Expand Down Expand Up @@ -168,7 +174,8 @@ public void StaticWebAssets_Publish_Hosted_Works()
intermediateOutputPath);
}

[RequiresMSBuildVersionFact("17.12", Reason = "Needs System.Text.Json 8.0.5")]
[TestMethod]
[RequiresMSBuildVersion("17.12")]
public void StaticWebAssets_Publish_DoesNotIncludeXmlDocumentationFiles_AsAssets()
{
// Arrange
Expand Down Expand Up @@ -208,7 +215,7 @@ public void StaticWebAssets_Publish_DoesNotIncludeXmlDocumentationFiles_AsAssets
intermediateOutputPath);
}

[Fact]
[TestMethod]
public void StaticWebAssets_HostedApp_ReferencingNetStandardLibrary_Works()
{
// Arrange
Expand Down Expand Up @@ -259,7 +266,8 @@ public void StaticWebAssets_HostedApp_ReferencingNetStandardLibrary_Works()

// https://github.com/dotnet/sdk/issues/49665
// ILLINK : Failed to load /private/tmp/helix/working/B3F609DC/p/d/shared/Microsoft.NETCore.App/7.0.0/libhostpolicy.dylib, error : dlopen(/private/tmp/helix/working/B3F609DC/p/d/shared/Microsoft.NETCore.App/7.0.0/libhostpolicy.dylib, 0x0001): tried: '/private/tmp/helix/working/B3F609DC/p/d/shared/Microsoft.NETCore.App/7.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/7.0.0/libhostpolicy.dylib' (no such file), '/private/tmp/helix/working/B3F609DC/p/d/shared/Microsoft.NETCore.App/7.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 StaticWebAssets_BackCompatibilityPublish_Hosted_Works()
{
// Arrange
Expand Down Expand Up @@ -308,4 +316,4 @@ public void StaticWebAssets_BackCompatibilityPublish_Hosted_Works()
intermediateOutputPath);
}
}
}
}
Loading
Loading