Skip to content

Commit 7e58006

Browse files
committed
Removed unused logic in GivenSelfContainedAppsRollForward. Created CurrentTfm constant for a few tests. Moved over last test source file. Removed EndToEnd-Installer.Tests.csproj and usage.
1 parent d243d39 commit 7e58006

File tree

9 files changed

+8
-151
lines changed

9 files changed

+8
-151
lines changed

sdk.sln

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -503,13 +503,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "core-sdk-tasks.Tests", "tes
503503
EndProject
504504
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.Tools.Tests.Utilities", "test\Microsoft.DotNet.Tools.Tests.Utilities\Microsoft.DotNet.Tools.Tests.Utilities.csproj", "{6E690AC5-8D00-419F-B5BC-C29D099EDE59}"
505505
EndProject
506-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EndToEnd-Installer.Tests", "test\EndToEnd-Installer.Tests\EndToEnd-Installer.Tests.csproj", "{149E3D40-8115-4965-9305-5A1ADBF04899}"
507-
EndProject
508506
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.WebTools.AspireService.Package", "src\BuiltInTools\AspireService\Microsoft.WebTools.AspireService.Package.csproj", "{19014C60-F87C-4CC7-AC0F-C41B6126EBCE}"
509507
EndProject
510508
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Microsoft.WebTools.AspireService", "src\BuiltInTools\AspireService\Microsoft.WebTools.AspireService.shproj", "{94C8526E-DCC2-442F-9868-3DD0BA2688BE}"
511509
EndProject
512-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Net.Sdk.Compilers.Toolset", "src\Microsoft.Net.Sdk.Compilers.Toolset\Microsoft.Net.Sdk.Compilers.Toolset.csproj", "{FA579C03-2EB4-4D47-88EE-BFF339E96FAF}"
510+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Net.Sdk.Compilers.Toolset", "src\Microsoft.Net.Sdk.Compilers.Toolset\Microsoft.Net.Sdk.Compilers.Toolset.csproj", "{FA579C03-2EB4-4D47-88EE-BFF339E96FAF}"
513511
EndProject
514512
Global
515513
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -965,10 +963,6 @@ Global
965963
{6E690AC5-8D00-419F-B5BC-C29D099EDE59}.Debug|Any CPU.Build.0 = Debug|Any CPU
966964
{6E690AC5-8D00-419F-B5BC-C29D099EDE59}.Release|Any CPU.ActiveCfg = Release|Any CPU
967965
{6E690AC5-8D00-419F-B5BC-C29D099EDE59}.Release|Any CPU.Build.0 = Release|Any CPU
968-
{149E3D40-8115-4965-9305-5A1ADBF04899}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
969-
{149E3D40-8115-4965-9305-5A1ADBF04899}.Debug|Any CPU.Build.0 = Debug|Any CPU
970-
{149E3D40-8115-4965-9305-5A1ADBF04899}.Release|Any CPU.ActiveCfg = Release|Any CPU
971-
{149E3D40-8115-4965-9305-5A1ADBF04899}.Release|Any CPU.Build.0 = Release|Any CPU
972966
{19014C60-F87C-4CC7-AC0F-C41B6126EBCE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
973967
{19014C60-F87C-4CC7-AC0F-C41B6126EBCE}.Debug|Any CPU.Build.0 = Debug|Any CPU
974968
{19014C60-F87C-4CC7-AC0F-C41B6126EBCE}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -1153,7 +1147,6 @@ Global
11531147
{0CBA5FB8-71A3-457A-89F3-E52B9602164A} = {3FA6F1CB-295B-4414-B18F-93845917A8CD}
11541148
{21C21975-84C1-4A24-8E21-F7EC790A4584} = {580D1AE7-AA8F-4912-8B76-105594E00B3B}
11551149
{6E690AC5-8D00-419F-B5BC-C29D099EDE59} = {580D1AE7-AA8F-4912-8B76-105594E00B3B}
1156-
{149E3D40-8115-4965-9305-5A1ADBF04899} = {580D1AE7-AA8F-4912-8B76-105594E00B3B}
11571150
{19014C60-F87C-4CC7-AC0F-C41B6126EBCE} = {71A9F549-0EB6-41F9-BC16-4A6C5007FC91}
11581151
{94C8526E-DCC2-442F-9868-3DD0BA2688BE} = {71A9F549-0EB6-41F9-BC16-4A6C5007FC91}
11591152
{FA579C03-2EB4-4D47-88EE-BFF339E96FAF} = {22AB674F-ED91-4FBC-BFEE-8A1E82F9F05E}

test/EndToEnd-Installer.Tests/EndToEnd-Installer.Tests.csproj

Lines changed: 0 additions & 26 deletions
This file was deleted.

test/EndToEnd-Installer.Tests/xunit.runner.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

test/EndToEnd.Tests/GivenSelfContainedAppsRollForward.cs

Lines changed: 0 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -1,120 +1,12 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
//using Microsoft.DotNet.TestFramework;
54
using EndToEnd.Tests.Utilities;
6-
using NuGet.ProjectModel;
7-
using NuGet.Versioning;
8-
//using RestoreCommand = Microsoft.DotNet.Tools.Test.Utilities.RestoreCommand;
9-
//using NewCommandShim = Microsoft.DotNet.Tools.Test.Utilities.NewCommandShim;
10-
//using TestBase = Microsoft.DotNet.Tools.Test.Utilities.TestBase;
11-
//using static Microsoft.DotNet.Tools.Test.Utilities.TestCommandExtensions;
125

136
namespace EndToEnd.Tests
147
{
158
public partial class GivenSelfContainedAppsRollForward(ITestOutputHelper log) : SdkTest(log)
169
{
17-
public const string NETCorePackageName = "Microsoft.NETCore.App";
18-
public const string AspNetCoreAppPackageName = "Microsoft.AspNetCore.App";
19-
public const string AspNetCoreAllPackageName = "Microsoft.AspNetCore.All";
20-
21-
[Theory]
22-
[ClassData(typeof(SupportedNetCoreAppVersions))]
23-
public void ItRollsForwardToTheLatestNetCoreVersion(string minorVersion)
24-
{
25-
ItRollsForwardToTheLatestVersion(NETCorePackageName, minorVersion);
26-
}
27-
28-
[Theory]
29-
[ClassData(typeof(SupportedAspNetCoreVersions))]
30-
public void ItRollsForwardToTheLatestAspNetCoreAppVersion(string minorVersion)
31-
{
32-
ItRollsForwardToTheLatestVersion(AspNetCoreAppPackageName, minorVersion);
33-
}
34-
35-
[Theory]
36-
[ClassData(typeof(SupportedAspNetCoreVersions))]
37-
public void ItRollsForwardToTheLatestAspNetCoreAllVersion(string minorVersion)
38-
{
39-
ItRollsForwardToTheLatestVersion(AspNetCoreAllPackageName, minorVersion);
40-
}
41-
42-
internal void ItRollsForwardToTheLatestVersion(string packageName, string minorVersion)
43-
{
44-
var testProjectCreator = new TestProjectCreator()
45-
{
46-
PackageName = packageName,
47-
MinorVersion = minorVersion,
48-
// Set RuntimeIdentifier to opt in to roll-forward behavior
49-
RuntimeIdentifier = RuntimeInformation.RuntimeIdentifier
50-
};
51-
52-
var testInstance = testProjectCreator.Create(_testAssetsManager);
53-
54-
// Get the version rolled forward to
55-
new RestoreCommand(testInstance)
56-
.Execute().Should().Pass();
57-
58-
string assetsFilePath = Path.Combine(testInstance.TestRoot, "obj", "project.assets.json");
59-
var assetsFile = new LockFileFormat().Read(assetsFilePath);
60-
61-
var rolledForwardVersion = GetPackageVersion(assetsFile, packageName);
62-
rolledForwardVersion.Should().NotBeNull();
63-
64-
if (rolledForwardVersion.IsPrerelease)
65-
{
66-
// If this version of .NET Core is still prerelease, then:
67-
// - Floating the patch by adding ".*" to the major.minor version won't work, but
68-
// - There aren't any patches to roll-forward to, so we skip testing this until the version
69-
// leaves prerelease.
70-
return;
71-
}
72-
73-
testProjectCreator.Identifier = "floating";
74-
75-
var floatingProjectInstance = testProjectCreator.Create(_testAssetsManager);
76-
77-
var floatingProjectPath = Path.Combine(floatingProjectInstance.TestRoot, "TestAppSimple.csproj");
78-
79-
var floatingProject = XDocument.Load(floatingProjectPath);
80-
var ns = floatingProject.Root.Name.Namespace;
81-
82-
if (packageName == TestProjectCreator.NETCorePackageName)
83-
{
84-
// Float the RuntimeFrameworkVersion to get the latest version of the runtime available from feeds
85-
floatingProject.Root.Element(ns + "PropertyGroup")
86-
.Add(new XElement(ns + "RuntimeFrameworkVersion", $"{minorVersion}.*"));
87-
}
88-
else
89-
{
90-
floatingProject.Root.Element(ns + "ItemGroup")
91-
.Element(ns + "PackageReference")
92-
.Add(new XAttribute("Version", $"{minorVersion}.*"),
93-
new XAttribute("AllowExplicitVersion", "true"));
94-
}
95-
96-
floatingProject.Save(floatingProjectPath);
97-
98-
new RestoreCommand(floatingProjectInstance)
99-
.Execute().Should().Pass();
100-
101-
string floatingAssetsFilePath = Path.Combine(floatingProjectInstance.TestRoot, "obj", "project.assets.json");
102-
103-
var floatedAssetsFile = new LockFileFormat().Read(floatingAssetsFilePath);
104-
105-
var floatedVersion = GetPackageVersion(floatedAssetsFile, packageName);
106-
floatedVersion.Should().NotBeNull();
107-
108-
rolledForwardVersion.ToNormalizedString().Should().BeEquivalentTo(floatedVersion.ToNormalizedString(),
109-
$"the latest patch version for {packageName} {minorVersion} in Microsoft.NETCoreSdk.BundledVersions.props " +
110-
"needs to be updated (see the ImplicitPackageVariable items in MSBuildExtensions.targets in this repo)");
111-
}
112-
113-
private static NuGetVersion GetPackageVersion(LockFile lockFile, string packageName) => lockFile?.Targets?.SingleOrDefault(t => t.RuntimeIdentifier != null)
114-
?.Libraries?.SingleOrDefault(l =>
115-
string.Compare(l.Name, packageName, StringComparison.CurrentCultureIgnoreCase) == 0)
116-
?.Version;
117-
11810
[Fact]
11911
public void WeCoverLatestNetCoreAppRollForward()
12012
{

test/EndToEnd.Tests/GivenWindowsApp.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Copyright (c) .NET Foundation and contributors. All rights reserved.
22
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

4+
using EndToEnd.Tests.Utilities;
5+
46
namespace EndToEnd.Tests
57
{
68
public class GivenWindowsApp(ITestOutputHelper log) : SdkTest(log)
@@ -26,7 +28,7 @@ public void ItCanBuildAndRun(string targetPlatformVersion)
2628
project.Root.Element(ns + "PropertyGroup")
2729
.Add(new XElement(ns + "TargetPlatformVersion", targetPlatformVersion));
2830
project.Root.Element(ns + "PropertyGroup")
29-
.Element(ns + "TargetFramework").Value = "net9.0";
31+
.Element(ns + "TargetFramework").Value = TargetFrameworkHelper.CurrentTfm;
3032
project.Save(projectPath);
3133

3234
new BuildCommand(testInstance)

test/EndToEnd.Tests/Utilities/SupportedNetCoreAppVersions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ namespace EndToEnd.Tests.Utilities
77
{
88
public static class TargetFrameworkHelper
99
{
10+
public const string CurrentTfm = "net9.0";
11+
1012
private static Version _firstNetAppVersion = new Version(5, 0);
1113

1214
public static IEnumerable<string> GetNetAppTargetFrameworks(IEnumerable<string> versions) =>

test/EndToEnd.Tests/Utilities/TestProjectCreator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace EndToEnd.Tests.Utilities
77
{
8-
class TestProjectCreator
8+
internal class TestProjectCreator
99
{
1010
public const string NETCorePackageName = "Microsoft.NETCore.App";
1111
public const string AspNetCoreAppPackageName = "Microsoft.AspNetCore.App";

test/UnitTests.proj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<SDKCustomXUnitProject Condition="'$(RunAoTTests)' != 'true'" Include="**\*.Tests.csproj" Exclude="**\*.AoT.Tests.csproj;**\Microsoft.DotNet.Tools.Tests.Utilities.csproj;**\core-sdk-tasks.Tests.csproj;**\EndToEnd-Installer.Tests.csproj;TestAssets\**\*.Tests.csproj" />
15+
<SDKCustomXUnitProject Condition="'$(RunAoTTests)' != 'true'" Include="**\*.Tests.csproj" Exclude="**\*.AoT.Tests.csproj;**\Microsoft.DotNet.Tools.Tests.Utilities.csproj;**\core-sdk-tasks.Tests.csproj;TestAssets\**\*.Tests.csproj" />
1616
<!--containers tests end with UnitTests and IntegrationTests, therefore included manually -->
1717
<SDKCustomXUnitProject Condition="'$(RunAoTTests)' != 'true'" Include="containerize.UnitTests\containerize.UnitTests.csproj" />
1818
<SDKCustomXUnitProject Condition="'$(RunAoTTests)' != 'true' And $(_AGENTOSNAME) != 'Windows_NT_FullFramework'" Include="Microsoft.NET.Build.Containers.IntegrationTests\Microsoft.NET.Build.Containers.IntegrationTests.csproj" />

0 commit comments

Comments
 (0)