Delete host test targeting old xunit packages (#79177)
authorElinor Fung <elfung@microsoft.com>
Mon, 5 Dec 2022 17:58:40 +0000 (09:58 -0800)
committerGitHub <noreply@github.com>
Mon, 5 Dec 2022 17:58:40 +0000 (09:58 -0800)
These tests restore/build projects that use old, unsupported packages for running xunit tests. These are no longer useful, especially since the normal test scenario is already covered with using the live host to run libraries tests.

The old test packages also depend on other old/unsupported packages, some of which get flagged by component governance.

src/installer/tests/Assets/TestProjects/PortableTestApp/PortableTestApp.csproj [deleted file]
src/installer/tests/Assets/TestProjects/PortableTestApp/Program.cs [deleted file]
src/installer/tests/Assets/TestProjects/StandaloneTestApp/Program.cs [deleted file]
src/installer/tests/Assets/TestProjects/StandaloneTestApp/StandaloneTestApp.csproj [deleted file]
src/installer/tests/HostActivation.Tests/DotnetTestXunit.cs [deleted file]

diff --git a/src/installer/tests/Assets/TestProjects/PortableTestApp/PortableTestApp.csproj b/src/installer/tests/Assets/TestProjects/PortableTestApp/PortableTestApp.csproj
deleted file mode 100644 (file)
index bfad7e2..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
-  <PropertyGroup>
-    <TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
-    <GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
-    <PackageTargetFallback>$(PackageTargetFallback);dotnet5.4;portable-net451+win8</PackageTargetFallback>
-    <RuntimeFrameworkVersion>$(MNAVersion)</RuntimeFrameworkVersion>
-    <DisableImplicitAssetTargetFallback>true</DisableImplicitAssetTargetFallback>
-    <NoWarn>NU1603;NU1701</NoWarn>
-  </PropertyGroup>
-
-  <ItemGroup>
-    <PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonVersion)" />
-    <PackageReference Include="xunit.netcore.extensions" Version="1.0.0-prerelease-00206" />
-    <PackageReference Include="dotnet-test-xunit" Version="1.0.0-rc2-192208-24" />
-  </ItemGroup>
-
-</Project>
diff --git a/src/installer/tests/Assets/TestProjects/PortableTestApp/Program.cs b/src/installer/tests/Assets/TestProjects/PortableTestApp/Program.cs
deleted file mode 100644 (file)
index 561893a..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-using System;
-using Xunit;
-
-namespace PortableTestApp
-{
-    public class Program
-    {
-        [Fact]
-        public void PassingTest()
-        {
-            Console.WriteLine("Pass!");
-            return;
-        }
-
-        [Fact]
-        public void FailingTest()
-        {
-            throw new Exception("Fail!");
-        }
-    }
-}
diff --git a/src/installer/tests/Assets/TestProjects/StandaloneTestApp/Program.cs b/src/installer/tests/Assets/TestProjects/StandaloneTestApp/Program.cs
deleted file mode 100644 (file)
index 570c419..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-using System;
-using Xunit;
-
-namespace StandaloneTestApp
-{
-    public class Program
-    {
-        // SDK generates an entry point method automatically now, with no opt-out mechanism.
-
-        [Fact]
-        public void PassingTest()
-        {
-            Console.WriteLine("Pass!");
-            return;
-        }
-
-        [Fact]
-        public void FailingTest()
-        {
-            throw new Exception("Fail!");
-        }
-    }
-}
diff --git a/src/installer/tests/Assets/TestProjects/StandaloneTestApp/StandaloneTestApp.csproj b/src/installer/tests/Assets/TestProjects/StandaloneTestApp/StandaloneTestApp.csproj
deleted file mode 100644 (file)
index f06537c..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
-  <PropertyGroup>
-    <TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
-    <OutputType>Exe</OutputType>
-    <GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
-    <PackageTargetFallback>$(PackageTargetFallback);dotnet5.4;portable-net451+win8</PackageTargetFallback>
-    <RuntimeIdentifier>$(TestTargetRid)</RuntimeIdentifier>
-    <RuntimeFrameworkVersion>$(MNAVersion)</RuntimeFrameworkVersion>
-    <DisableImplicitAssetTargetFallback>true</DisableImplicitAssetTargetFallback>
-    <NoWarn>NU1603;NU1701</NoWarn>
-  </PropertyGroup>
-
-  <ItemGroup>
-    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170106-08" />
-    <PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonVersion)" />
-    <PackageReference Include="xunit.netcore.extensions" Version="1.0.0-prerelease-00206" />
-    <PackageReference Include="dotnet-test-xunit" Version="1.0.0-rc2-192208-24" />
-  </ItemGroup>
-
-</Project>
diff --git a/src/installer/tests/HostActivation.Tests/DotnetTestXunit.cs b/src/installer/tests/HostActivation.Tests/DotnetTestXunit.cs
deleted file mode 100644 (file)
index 4828067..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-using Microsoft.DotNet.CoreSetup.Test;
-using System;
-using System.IO;
-using Xunit;
-
-namespace Microsoft.DotNet.Tools.Publish.Tests
-{
-    public class DotnetTestXunit
-    {
-        private string DotnetTestXunitVersion => "1.0.0-rc2-192208-24";
-        private RepoDirectoriesProvider RepoDirectories { get; set; }
-
-        public DotnetTestXunit()
-        {
-            RepoDirectories = new RepoDirectoriesProvider();
-        }
-
-        [Fact]
-        public void Muxer_activation_of_dotnet_test_XUnit_on_Portable_Test_App_Succeeds()
-        {
-            using (var portableTestAppFixture = new TestProjectFixture("PortableTestApp", RepoDirectories))
-            {
-                portableTestAppFixture
-                    .EnsureRestored()
-                    .BuildProject();
-
-                ActivateDotnetTestXunitOnTestProject(RepoDirectories, portableTestAppFixture);
-            }
-        }
-
-        [Fact]
-        public void Muxer_activation_of_dotnet_test_XUnit_on_Standalone_Test_App_Succeeds()
-        {
-            using (var standaloneTestAppFixture = new TestProjectFixture("StandaloneTestApp", RepoDirectories))
-            {
-                standaloneTestAppFixture
-                    .EnsureRestoredForRid(standaloneTestAppFixture.CurrentRid)
-                    .BuildProject(runtime: standaloneTestAppFixture.CurrentRid);
-
-                ActivateDotnetTestXunitOnTestProject(RepoDirectories, standaloneTestAppFixture);
-            }
-        }
-
-        private void ActivateDotnetTestXunitOnTestProject(
-            RepoDirectoriesProvider repoDirectories,
-            TestProjectFixture testProjectFixture)
-        {
-            var dotnet = testProjectFixture.BuiltDotnet;
-
-            var dotnetTestXunitDll = FindDotnetTestXunitDll(repoDirectories, DotnetTestXunitVersion);
-            var depsJson = testProjectFixture.TestProject.DepsJson;
-            var runtimeConfig = testProjectFixture.TestProject.RuntimeConfigJson;
-            var additionalProbingPath = RepoDirectories.NugetPackages;
-            var appDll = testProjectFixture.TestProject.AppDll;
-
-            dotnet.Exec(
-                    "exec",
-                    "--runtimeconfig", runtimeConfig,
-                    "--depsfile", depsJson,
-                    "--additionalProbingPath", additionalProbingPath,
-                    dotnetTestXunitDll,
-                    appDll)
-                .CaptureStdErr()
-                .CaptureStdOut()
-                .Execute(expectedToFail:true)
-                .Should().Fail()
-                .And.HaveStdOutContaining("Total: 2")
-                .And.HaveStdOutContaining("Failed: 1");
-        }
-
-        private string FindDotnetTestXunitDll(RepoDirectoriesProvider repoDirectories, string dotnetTestXunitVersion)
-        {
-            var dotnetTestXunitDll = Path.Combine(
-                repoDirectories.NugetPackages,
-                "dotnet-test-xunit",
-                dotnetTestXunitVersion,
-                "lib",
-                "netcoreapp1.0",
-                "dotnet-test-xunit.dll");
-
-            if ( ! File.Exists(dotnetTestXunitDll))
-            {
-                throw new Exception(
-                    $"Unable to find '{dotnetTestXunitDll}', ensure {nameof(DotnetTestXunitVersion)} is updated to the version in Portable/StandaloneTestApp");
-            }
-
-            return dotnetTestXunitDll;
-        }
-    }
-}