diff --git a/Microsoft.DotNet.Cli.sln b/Microsoft.DotNet.Cli.sln index 3fc161887..236afa7fb 100644 --- a/Microsoft.DotNet.Cli.sln +++ b/Microsoft.DotNet.Cli.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 +VisualStudioVersion = 14.0.25123.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{ED2FE3E2-F7E7-4389-8231-B65123F2076F}" EndProject @@ -26,8 +26,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{17735A9D-B EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{0722D325-24C8-4E83-B5AF-0A083E7F0749}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "MultiProjectValidator", "tools\MultiProjectValidator\MultiProjectValidator.xproj", "{08A68C6A-86F6-4ED2-89A7-B166D33E9F85}" -EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "EndToEnd", "test\EndToEnd\EndToEnd.xproj", "{65741CB1-8AEE-4C66-8198-10A7EA0E4258}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TestProjects", "TestProjects", "{713CBFBB-5392-438D-B766-A9A585EF1BB8}" @@ -104,8 +102,6 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "update-dependencies", "buil EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.ProjectModel.Loader", "src\Microsoft.DotNet.ProjectModel.Loader\Microsoft.DotNet.ProjectModel.Loader.xproj", "{1C599FFD-FB52-4279-A8E5-465D3EC499E1}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.ProjectModel.Loader.Tests", "test\Microsoft.DotNet.ProjectModel.Loader.Tests\Microsoft.DotNet.ProjectModel.Loader.Tests.xproj", "{5DF6C9DA-6909-4EC0-909E-6913580BB4A4}" -EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.Configurer", "src\Microsoft.DotNet.Configurer\Microsoft.DotNet.Configurer.xproj", "{E5ED47EF-BF25-4DA9-A7FE-290C642CBF0F}" EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.Configurer.UnitTests", "test\Microsoft.DotNet.Configurer.UnitTests\Microsoft.DotNet.Configurer.UnitTests.xproj", "{4C3B06D5-B6D5-4E5B-A44F-3EBE52A1C759}" @@ -156,6 +152,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "publish", "publish", "{27B1 build\publish\PublishContent.targets = build\publish\PublishContent.targets EndProjectSection EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "dotnet-test-console", "src\dotnet-test-console\dotnet-test-console.xproj", "{6D028154-5518-4A56-BAD6-938A90E5BCF6}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -776,22 +774,6 @@ Global {1C599FFD-FB52-4279-A8E5-465D3EC499E1}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU {1C599FFD-FB52-4279-A8E5-465D3EC499E1}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU {1C599FFD-FB52-4279-A8E5-465D3EC499E1}.RelWithDebInfo|x64.Build.0 = Release|Any CPU - {5DF6C9DA-6909-4EC0-909E-6913580BB4A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5DF6C9DA-6909-4EC0-909E-6913580BB4A4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5DF6C9DA-6909-4EC0-909E-6913580BB4A4}.Debug|x64.ActiveCfg = Debug|Any CPU - {5DF6C9DA-6909-4EC0-909E-6913580BB4A4}.Debug|x64.Build.0 = Debug|Any CPU - {5DF6C9DA-6909-4EC0-909E-6913580BB4A4}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU - {5DF6C9DA-6909-4EC0-909E-6913580BB4A4}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU - {5DF6C9DA-6909-4EC0-909E-6913580BB4A4}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU - {5DF6C9DA-6909-4EC0-909E-6913580BB4A4}.MinSizeRel|x64.Build.0 = Debug|Any CPU - {5DF6C9DA-6909-4EC0-909E-6913580BB4A4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5DF6C9DA-6909-4EC0-909E-6913580BB4A4}.Release|Any CPU.Build.0 = Release|Any CPU - {5DF6C9DA-6909-4EC0-909E-6913580BB4A4}.Release|x64.ActiveCfg = Release|Any CPU - {5DF6C9DA-6909-4EC0-909E-6913580BB4A4}.Release|x64.Build.0 = Release|Any CPU - {5DF6C9DA-6909-4EC0-909E-6913580BB4A4}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU - {5DF6C9DA-6909-4EC0-909E-6913580BB4A4}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU - {5DF6C9DA-6909-4EC0-909E-6913580BB4A4}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU - {5DF6C9DA-6909-4EC0-909E-6913580BB4A4}.RelWithDebInfo|x64.Build.0 = Release|Any CPU {E5ED47EF-BF25-4DA9-A7FE-290C642CBF0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E5ED47EF-BF25-4DA9-A7FE-290C642CBF0F}.Debug|Any CPU.Build.0 = Debug|Any CPU {E5ED47EF-BF25-4DA9-A7FE-290C642CBF0F}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -872,6 +854,39 @@ Global {E4F46EAB-B5A5-4E60-9B9D-40A1FADBF45C}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU {E4F46EAB-B5A5-4E60-9B9D-40A1FADBF45C}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU {E4F46EAB-B5A5-4E60-9B9D-40A1FADBF45C}.RelWithDebInfo|x64.Build.0 = Release|Any CPU + + {EDD6C92D-0A58-4FCB-A0E9-9D0FFC045177}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EDD6C92D-0A58-4FCB-A0E9-9D0FFC045177}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EDD6C92D-0A58-4FCB-A0E9-9D0FFC045177}.Debug|x64.ActiveCfg = Debug|Any CPU + {EDD6C92D-0A58-4FCB-A0E9-9D0FFC045177}.Debug|x64.Build.0 = Debug|Any CPU + {EDD6C92D-0A58-4FCB-A0E9-9D0FFC045177}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {EDD6C92D-0A58-4FCB-A0E9-9D0FFC045177}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {EDD6C92D-0A58-4FCB-A0E9-9D0FFC045177}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {EDD6C92D-0A58-4FCB-A0E9-9D0FFC045177}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {EDD6C92D-0A58-4FCB-A0E9-9D0FFC045177}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EDD6C92D-0A58-4FCB-A0E9-9D0FFC045177}.Release|Any CPU.Build.0 = Release|Any CPU + {EDD6C92D-0A58-4FCB-A0E9-9D0FFC045177}.Release|x64.ActiveCfg = Release|Any CPU + {EDD6C92D-0A58-4FCB-A0E9-9D0FFC045177}.Release|x64.Build.0 = Release|Any CPU + {EDD6C92D-0A58-4FCB-A0E9-9D0FFC045177}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU + {EDD6C92D-0A58-4FCB-A0E9-9D0FFC045177}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU + {EDD6C92D-0A58-4FCB-A0E9-9D0FFC045177}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU + {EDD6C92D-0A58-4FCB-A0E9-9D0FFC045177}.RelWithDebInfo|x64.Build.0 = Release|Any CPU + {6D028154-5518-4A56-BAD6-938A90E5BCF6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6D028154-5518-4A56-BAD6-938A90E5BCF6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6D028154-5518-4A56-BAD6-938A90E5BCF6}.Debug|x64.ActiveCfg = Debug|x64 + {6D028154-5518-4A56-BAD6-938A90E5BCF6}.Debug|x64.Build.0 = Debug|x64 + {6D028154-5518-4A56-BAD6-938A90E5BCF6}.MinSizeRel|Any CPU.ActiveCfg = MinSizeRel|Any CPU + {6D028154-5518-4A56-BAD6-938A90E5BCF6}.MinSizeRel|Any CPU.Build.0 = MinSizeRel|Any CPU + {6D028154-5518-4A56-BAD6-938A90E5BCF6}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64 + {6D028154-5518-4A56-BAD6-938A90E5BCF6}.MinSizeRel|x64.Build.0 = MinSizeRel|x64 + {6D028154-5518-4A56-BAD6-938A90E5BCF6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6D028154-5518-4A56-BAD6-938A90E5BCF6}.Release|Any CPU.Build.0 = Release|Any CPU + {6D028154-5518-4A56-BAD6-938A90E5BCF6}.Release|x64.ActiveCfg = Release|x64 + {6D028154-5518-4A56-BAD6-938A90E5BCF6}.Release|x64.Build.0 = Release|x64 + {6D028154-5518-4A56-BAD6-938A90E5BCF6}.RelWithDebInfo|Any CPU.ActiveCfg = RelWithDebInfo|Any CPU + {6D028154-5518-4A56-BAD6-938A90E5BCF6}.RelWithDebInfo|Any CPU.Build.0 = RelWithDebInfo|Any CPU + {6D028154-5518-4A56-BAD6-938A90E5BCF6}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64 + {6D028154-5518-4A56-BAD6-938A90E5BCF6}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -920,7 +935,6 @@ Global {B768BD29-12BF-4C7C-B093-03193FE244D1} = {88278B81-7649-45DC-8A6A-D3A645C5AFC3} {A28BD8AC-DF15-4F58-8299-98A9AE2B8726} = {88278B81-7649-45DC-8A6A-D3A645C5AFC3} {1C599FFD-FB52-4279-A8E5-465D3EC499E1} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F} - {5DF6C9DA-6909-4EC0-909E-6913580BB4A4} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7} {E5ED47EF-BF25-4DA9-A7FE-290C642CBF0F} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F} {4C3B06D5-B6D5-4E5B-A44F-3EBE52A1C759} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7} {35B19F22-B8C0-4849-9C35-3F809B7588B8} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F} @@ -930,5 +944,7 @@ Global {FF498306-2DE2-47F6-8C35-3CF0589CF2B8} = {89905EC4-BC0F-443B-8ADF-691321F10108} {E4F46EAB-B5A5-4E60-9B9D-40A1FADBF45C} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7} {27B12960-ABB0-4903-9C60-5E9157E659C8} = {89905EC4-BC0F-443B-8ADF-691321F10108} + {EDD6C92D-0A58-4FCB-A0E9-9D0FFC045177} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7} + {6D028154-5518-4A56-BAD6-938A90E5BCF6} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F} EndGlobalSection EndGlobal diff --git a/src/Microsoft.DotNet.InternalAbstractions/DirectoryWrapper.cs b/src/Microsoft.DotNet.InternalAbstractions/DirectoryWrapper.cs index a86187822..6db8156db 100644 --- a/src/Microsoft.DotNet.InternalAbstractions/DirectoryWrapper.cs +++ b/src/Microsoft.DotNet.InternalAbstractions/DirectoryWrapper.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. +using System.Collections.Generic; using System.IO; using Microsoft.DotNet.InternalAbstractions; @@ -17,5 +18,10 @@ namespace Microsoft.Extensions.EnvironmentAbstractions { return new TemporaryDirectory(); } + + public IEnumerable GetFiles(string path, string searchPattern) + { + return Directory.GetFiles(path, searchPattern); + } } } \ No newline at end of file diff --git a/src/Microsoft.DotNet.InternalAbstractions/IDirectory.cs b/src/Microsoft.DotNet.InternalAbstractions/IDirectory.cs index 0fed21865..162a9dd42 100644 --- a/src/Microsoft.DotNet.InternalAbstractions/IDirectory.cs +++ b/src/Microsoft.DotNet.InternalAbstractions/IDirectory.cs @@ -1,6 +1,8 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. +using System.Collections.Generic; + namespace Microsoft.Extensions.EnvironmentAbstractions { internal interface IDirectory @@ -8,5 +10,7 @@ namespace Microsoft.Extensions.EnvironmentAbstractions bool Exists(string path); ITemporaryDirectory CreateTemporaryDirectory(); + + IEnumerable GetFiles(string path, string searchPattern); } } \ No newline at end of file diff --git a/src/Microsoft.DotNet.InternalAbstractions/Properties/Properties.cs b/src/Microsoft.DotNet.InternalAbstractions/Properties/Properties.cs index ceccc63e7..44cb99526 100644 --- a/src/Microsoft.DotNet.InternalAbstractions/Properties/Properties.cs +++ b/src/Microsoft.DotNet.InternalAbstractions/Properties/Properties.cs @@ -7,4 +7,6 @@ using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("Microsoft.Extensions.DependencyModel.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.DotNet.Configurer, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.DotNet.Configurer.UnitTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] \ No newline at end of file +[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] +[assembly: InternalsVisibleTo("dotnet-test.UnitTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100039ac461fa5c82c7dd2557400c4fd4e9dcdf7ac47e3d572548c04cd4673e004916610f4ea5cbf86f2b1ca1cb824f2a7b3976afecfcf4eb72d9a899aa6786effa10c30399e6580ed848231fec48374e41b3acf8811931343fc2f73acf72dae745adbcb7063cc4b50550618383202875223fc75401351cd89c44bf9b50e7fa3796")] +[assembly: InternalsVisibleTo("dotnet-test-console, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] diff --git a/src/Microsoft.DotNet.ProjectModel/Properties/AssemblyInfo.cs b/src/Microsoft.DotNet.ProjectModel/Properties/AssemblyInfo.cs index 736765643..8004866db 100644 --- a/src/Microsoft.DotNet.ProjectModel/Properties/AssemblyInfo.cs +++ b/src/Microsoft.DotNet.ProjectModel/Properties/AssemblyInfo.cs @@ -27,3 +27,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyMetadataAttribute("Serviceable", "True")] [assembly: InternalsVisibleTo("Microsoft.DotNet.ProjectModel.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100039ac461fa5c82c7dd2557400c4fd4e9dcdf7ac47e3d572548c04cd4673e004916610f4ea5cbf86f2b1ca1cb824f2a7b3976afecfcf4eb72d9a899aa6786effa10c30399e6580ed848231fec48374e41b3acf8811931343fc2f73acf72dae745adbcb7063cc4b50550618383202875223fc75401351cd89c44bf9b50e7fa3796")] +[assembly: + InternalsVisibleTo( + "dotnet-test.UnitTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100039ac461fa5c82c7dd2557400c4fd4e9dcdf7ac47e3d572548c04cd4673e004916610f4ea5cbf86f2b1ca1cb824f2a7b3976afecfcf4eb72d9a899aa6786effa10c30399e6580ed848231fec48374e41b3acf8811931343fc2f73acf72dae745adbcb7063cc4b50550618383202875223fc75401351cd89c44bf9b50e7fa3796" + )] \ No newline at end of file diff --git a/src/Microsoft.Extensions.Testing.Abstractions/Properties/AssemblyInfo.cs b/src/Microsoft.Extensions.Testing.Abstractions/Properties/AssemblyInfo.cs index cdbb8074c..9c307434f 100644 --- a/src/Microsoft.Extensions.Testing.Abstractions/Properties/AssemblyInfo.cs +++ b/src/Microsoft.Extensions.Testing.Abstractions/Properties/AssemblyInfo.cs @@ -3,6 +3,7 @@ using System.Reflection; using System.Resources; +using System.Runtime.CompilerServices; [assembly: AssemblyMetadata("Serviceable", "True")] -[assembly: NeutralResourcesLanguage("en-us")] \ No newline at end of file +[assembly: NeutralResourcesLanguage("en-us")] diff --git a/src/dotnet/commands/dotnet-test/AssemblyUnderTest.cs b/src/dotnet-test-console/AssemblyUnderTest.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/AssemblyUnderTest.cs rename to src/dotnet-test-console/AssemblyUnderTest.cs diff --git a/src/dotnet/commands/dotnet-test/BaseDotnetTestRunner.cs b/src/dotnet-test-console/BaseDotnetTestRunner.cs similarity index 93% rename from src/dotnet/commands/dotnet-test/BaseDotnetTestRunner.cs rename to src/dotnet-test-console/BaseDotnetTestRunner.cs index 64b2069ec..59d1553a0 100644 --- a/src/dotnet/commands/dotnet-test/BaseDotnetTestRunner.cs +++ b/src/dotnet-test-console/BaseDotnetTestRunner.cs @@ -2,6 +2,8 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Collections.Generic; +using System.Runtime.InteropServices.ComTypes; +using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.ProjectModel; namespace Microsoft.DotNet.Tools.Test @@ -59,7 +61,7 @@ namespace Microsoft.DotNet.Tools.Test strings.Add(projectContext.RuntimeIdentifier); } - var result = Build.BuildCommand.Run(strings.ToArray(), workspace); + var result = Command.CreateDotNet("build", strings).Execute().ExitCode; return result; } diff --git a/src/dotnet/commands/dotnet-test/CommandTestRunnerExtensions.cs b/src/dotnet-test-console/CommandTestRunnerExtensions.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/CommandTestRunnerExtensions.cs rename to src/dotnet-test-console/CommandTestRunnerExtensions.cs diff --git a/src/dotnet/commands/dotnet-test/ConsoleTestRunner.cs b/src/dotnet-test-console/ConsoleTestRunner.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/ConsoleTestRunner.cs rename to src/dotnet-test-console/ConsoleTestRunner.cs diff --git a/src/dotnet/commands/dotnet-test/DesignTimeRunner.cs b/src/dotnet-test-console/DesignTimeRunner.cs similarity index 98% rename from src/dotnet/commands/dotnet-test/DesignTimeRunner.cs rename to src/dotnet-test-console/DesignTimeRunner.cs index 9ccf7ca7d..66753a6b1 100644 --- a/src/dotnet/commands/dotnet-test/DesignTimeRunner.cs +++ b/src/dotnet-test-console/DesignTimeRunner.cs @@ -63,7 +63,7 @@ namespace Microsoft.DotNet.Tools.Test private static string GetCommandName(string testRunner) { - return $"test-{testRunner}"; + return $"dotnet-test-{testRunner}"; } } } diff --git a/src/dotnet/commands/dotnet-test/DotnetTest.cs b/src/dotnet-test-console/DotnetTest.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/DotnetTest.cs rename to src/dotnet-test-console/DotnetTest.cs diff --git a/src/dotnet/commands/dotnet-test/DotnetTestExtensions.cs b/src/dotnet-test-console/DotnetTestExtensions.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/DotnetTestExtensions.cs rename to src/dotnet-test-console/DotnetTestExtensions.cs diff --git a/src/dotnet/commands/dotnet-test/DotnetTestParams.cs b/src/dotnet-test-console/DotnetTestParams.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/DotnetTestParams.cs rename to src/dotnet-test-console/DotnetTestParams.cs diff --git a/src/dotnet/commands/dotnet-test/DotnetTestRunnerFactory.cs b/src/dotnet-test-console/DotnetTestRunnerFactory.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/DotnetTestRunnerFactory.cs rename to src/dotnet-test-console/DotnetTestRunnerFactory.cs diff --git a/src/dotnet/commands/dotnet-test/DotnetTestState.cs b/src/dotnet-test-console/DotnetTestState.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/DotnetTestState.cs rename to src/dotnet-test-console/DotnetTestState.cs diff --git a/src/dotnet/commands/dotnet-test/IDotnetTest.cs b/src/dotnet-test-console/IDotnetTest.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/IDotnetTest.cs rename to src/dotnet-test-console/IDotnetTest.cs diff --git a/src/dotnet/commands/dotnet-test/IDotnetTestRunner.cs b/src/dotnet-test-console/IDotnetTestRunner.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/IDotnetTestRunner.cs rename to src/dotnet-test-console/IDotnetTestRunner.cs diff --git a/src/dotnet/commands/dotnet-test/IDotnetTestRunnerFactory.cs b/src/dotnet-test-console/IDotnetTestRunnerFactory.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/IDotnetTestRunnerFactory.cs rename to src/dotnet-test-console/IDotnetTestRunnerFactory.cs diff --git a/src/dotnet/commands/dotnet-test/ITestMessagesCollection.cs b/src/dotnet-test-console/ITestMessagesCollection.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/ITestMessagesCollection.cs rename to src/dotnet-test-console/ITestMessagesCollection.cs diff --git a/src/dotnet/commands/dotnet-test/MessageHandlers/GetTestRunnerProcessStartInfoMessageHandler.cs b/src/dotnet-test-console/MessageHandlers/GetTestRunnerProcessStartInfoMessageHandler.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/MessageHandlers/GetTestRunnerProcessStartInfoMessageHandler.cs rename to src/dotnet-test-console/MessageHandlers/GetTestRunnerProcessStartInfoMessageHandler.cs diff --git a/src/dotnet/commands/dotnet-test/MessageHandlers/IDotnetTestMessageHandler.cs b/src/dotnet-test-console/MessageHandlers/IDotnetTestMessageHandler.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/MessageHandlers/IDotnetTestMessageHandler.cs rename to src/dotnet-test-console/MessageHandlers/IDotnetTestMessageHandler.cs diff --git a/src/dotnet/commands/dotnet-test/MessageHandlers/TestDiscoveryStartMessageHandler.cs b/src/dotnet-test-console/MessageHandlers/TestDiscoveryStartMessageHandler.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/MessageHandlers/TestDiscoveryStartMessageHandler.cs rename to src/dotnet-test-console/MessageHandlers/TestDiscoveryStartMessageHandler.cs diff --git a/src/dotnet/commands/dotnet-test/MessageHandlers/TestMessageTypes.cs b/src/dotnet-test-console/MessageHandlers/TestMessageTypes.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/MessageHandlers/TestMessageTypes.cs rename to src/dotnet-test-console/MessageHandlers/TestMessageTypes.cs diff --git a/src/dotnet/commands/dotnet-test/MessageHandlers/TestRunnerResultMessageHandler.cs b/src/dotnet-test-console/MessageHandlers/TestRunnerResultMessageHandler.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/MessageHandlers/TestRunnerResultMessageHandler.cs rename to src/dotnet-test-console/MessageHandlers/TestRunnerResultMessageHandler.cs diff --git a/src/dotnet/commands/dotnet-test/MessageHandlers/TestRunnerTestCompletedMessageHandler.cs b/src/dotnet-test-console/MessageHandlers/TestRunnerTestCompletedMessageHandler.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/MessageHandlers/TestRunnerTestCompletedMessageHandler.cs rename to src/dotnet-test-console/MessageHandlers/TestRunnerTestCompletedMessageHandler.cs diff --git a/src/dotnet/commands/dotnet-test/MessageHandlers/TestRunnerTestFoundMessageHandler.cs b/src/dotnet-test-console/MessageHandlers/TestRunnerTestFoundMessageHandler.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/MessageHandlers/TestRunnerTestFoundMessageHandler.cs rename to src/dotnet-test-console/MessageHandlers/TestRunnerTestFoundMessageHandler.cs diff --git a/src/dotnet/commands/dotnet-test/MessageHandlers/TestRunnerTestResultMessageHandler.cs b/src/dotnet-test-console/MessageHandlers/TestRunnerTestResultMessageHandler.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/MessageHandlers/TestRunnerTestResultMessageHandler.cs rename to src/dotnet-test-console/MessageHandlers/TestRunnerTestResultMessageHandler.cs diff --git a/src/dotnet/commands/dotnet-test/MessageHandlers/TestRunnerTestStartedMessageHandler.cs b/src/dotnet-test-console/MessageHandlers/TestRunnerTestStartedMessageHandler.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/MessageHandlers/TestRunnerTestStartedMessageHandler.cs rename to src/dotnet-test-console/MessageHandlers/TestRunnerTestStartedMessageHandler.cs diff --git a/src/dotnet/commands/dotnet-test/MessageHandlers/TestRunnerWaitingCommandMessageHandler.cs b/src/dotnet-test-console/MessageHandlers/TestRunnerWaitingCommandMessageHandler.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/MessageHandlers/TestRunnerWaitingCommandMessageHandler.cs rename to src/dotnet-test-console/MessageHandlers/TestRunnerWaitingCommandMessageHandler.cs diff --git a/src/dotnet/commands/dotnet-test/MessageHandlers/TestSessionTerminateMessageHandler.cs b/src/dotnet-test-console/MessageHandlers/TestSessionTerminateMessageHandler.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/MessageHandlers/TestSessionTerminateMessageHandler.cs rename to src/dotnet-test-console/MessageHandlers/TestSessionTerminateMessageHandler.cs diff --git a/src/dotnet/commands/dotnet-test/MessageHandlers/UnknownMessageHandler.cs b/src/dotnet-test-console/MessageHandlers/UnknownMessageHandler.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/MessageHandlers/UnknownMessageHandler.cs rename to src/dotnet-test-console/MessageHandlers/UnknownMessageHandler.cs diff --git a/src/dotnet/commands/dotnet-test/MessageHandlers/VersionCheckMessageHandler.cs b/src/dotnet-test-console/MessageHandlers/VersionCheckMessageHandler.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/MessageHandlers/VersionCheckMessageHandler.cs rename to src/dotnet-test-console/MessageHandlers/VersionCheckMessageHandler.cs diff --git a/src/dotnet-test-console/Properties/AssemblyInfo.cs b/src/dotnet-test-console/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..5179142ae --- /dev/null +++ b/src/dotnet-test-console/Properties/AssemblyInfo.cs @@ -0,0 +1,27 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. + +[assembly: AssemblyTitle("dotnet_test_console")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("$safeprojectname$")] +[assembly: AssemblyCopyright("Copyright © 116")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. + +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM + +[assembly: Guid("6D028154-5518-4A56-BAD6-938A90E5BCF6")] +[assembly: InternalsVisibleTo("dotnet-test.UnitTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100039ac461fa5c82c7dd2557400c4fd4e9dcdf7ac47e3d572548c04cd4673e004916610f4ea5cbf86f2b1ca1cb824f2a7b3976afecfcf4eb72d9a899aa6786effa10c30399e6580ed848231fec48374e41b3acf8811931343fc2f73acf72dae745adbcb7063cc4b50550618383202875223fc75401351cd89c44bf9b50e7fa3796")] diff --git a/src/dotnet/commands/dotnet-test/README.md b/src/dotnet-test-console/README.md similarity index 83% rename from src/dotnet/commands/dotnet-test/README.md rename to src/dotnet-test-console/README.md index ab1d7cc27..a3b9dc64b 100644 --- a/src/dotnet/commands/dotnet-test/README.md +++ b/src/dotnet-test-console/README.md @@ -8,20 +8,20 @@ ## SYNOPSIS -`dotnet test [--configuration] +`dotnet test [--configuration] [--output] [--build-base-path] [--framework] [--runtime] [--no-build] - [--parentProcessId] [--port] - []` + [--parentProcessId] [--port] + []` ## DESCRIPTION -The `dotnet test` command is used to execute unit tests in a given project. Unit tests are class library -projects that have dependencies on the unit test framework (for example, NUnit or xUnit) and the -dotnet test runner for that unit testing framework. +The `dotnet test` command is used to execute unit tests in a given project. Unit tests are class library +projects that have dependencies on the unit test framework (for example, NUnit or xUnit) and the +dotnet test runner for that unit testing framework. These are packaged as NuGet packages and are restored as ordinary dependencies for the project. -Test projects also need to specify a test runner property in project.json using the "testRunner" node. +Test projects also need to specify a test runner property in project.json using the "testRunner" node. This value should contain the name of the unit test framework. The following sample project.json shows the properties needed: @@ -53,17 +53,17 @@ The following sample project.json shows the properties needed: `dotnet test` supports two running modes: 1. Console: In console mode, `dotnet test` simply executes fully any command gets passed to it and outputs the results. Anytime you invoke `dotnet test` without passing --port, it runs in console mode, which in turn will cause the runner to run in console mode. -2. Design time: used in the context of other tools, such as editors or Integrated Development Environments (IDEs). You can find out more about this mode in the [dotnet-test protocol](../../../../Documentation/dotnet-test-protocol.md) document. +2. Design time: used in the context of other tools, such as editors or Integrated Development Environments (IDEs). You can find out more about this mode in the [dotnet-test protocol](../../../../Documentation/dotnet-test-protocol.md) document. ## OPTIONS `[project]` - -Specifies a path to the test project. If omitted, it defaults to current directory. + +Specifies a path to the test project. If omitted, it defaults to current directory. `-c`, `--configuration` [Debug|Release] -Configuration under which to build. The default value is Release. +Configuration under which to build. The default value is Release. `-o`, `--output` [DIR] @@ -81,9 +81,9 @@ Looks for test binaries for a specific framework. Look for test binaries for a for the specified runtime. -`--no-build` +`--no-build` -Does not build the test project prior to running it. +Does not build the test project prior to running it. --parentProcessId @@ -97,8 +97,8 @@ Used by IDEs to specify a port number to listen for a connection. `dotnet test` -Runs the tests in the project in the current directory. +Runs the tests in the project in the current directory. `dotnet test /projects/test1/project.json` -Runs the tests in the test1 project. +Runs the tests in the test1 project. diff --git a/src/dotnet/commands/dotnet-test/ReportingChannels/AdapterReportingChannel.cs b/src/dotnet-test-console/ReportingChannels/AdapterReportingChannel.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/ReportingChannels/AdapterReportingChannel.cs rename to src/dotnet-test-console/ReportingChannels/AdapterReportingChannel.cs diff --git a/src/dotnet/commands/dotnet-test/ReportingChannels/IReportingChannel.cs b/src/dotnet-test-console/ReportingChannels/IReportingChannel.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/ReportingChannels/IReportingChannel.cs rename to src/dotnet-test-console/ReportingChannels/IReportingChannel.cs diff --git a/src/dotnet/commands/dotnet-test/ReportingChannels/IReportingChannelFactory.cs b/src/dotnet-test-console/ReportingChannels/IReportingChannelFactory.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/ReportingChannels/IReportingChannelFactory.cs rename to src/dotnet-test-console/ReportingChannels/IReportingChannelFactory.cs diff --git a/src/dotnet/commands/dotnet-test/ReportingChannels/ReportingChannel.cs b/src/dotnet-test-console/ReportingChannels/ReportingChannel.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/ReportingChannels/ReportingChannel.cs rename to src/dotnet-test-console/ReportingChannels/ReportingChannel.cs diff --git a/src/dotnet/commands/dotnet-test/ReportingChannels/ReportingChannelFactory.cs b/src/dotnet-test-console/ReportingChannels/ReportingChannelFactory.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/ReportingChannels/ReportingChannelFactory.cs rename to src/dotnet-test-console/ReportingChannels/ReportingChannelFactory.cs diff --git a/src/dotnet/commands/dotnet-test/ReportingChannels/TestRunnerReportingChannel.cs b/src/dotnet-test-console/ReportingChannels/TestRunnerReportingChannel.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/ReportingChannels/TestRunnerReportingChannel.cs rename to src/dotnet-test-console/ReportingChannels/TestRunnerReportingChannel.cs diff --git a/src/dotnet/commands/dotnet-test/Program.cs b/src/dotnet-test-console/TestCommand.cs similarity index 98% rename from src/dotnet/commands/dotnet-test/Program.cs rename to src/dotnet-test-console/TestCommand.cs index 43a7e81bd..936850e72 100644 --- a/src/dotnet/commands/dotnet-test/Program.cs +++ b/src/dotnet-test-console/TestCommand.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; @@ -29,7 +29,7 @@ namespace Microsoft.DotNet.Tools.Test try { dotnetTestParams.Parse(args); - + if (dotnetTestParams.Help) { return 0; diff --git a/src/dotnet/commands/dotnet-test/TestHostTracing.cs b/src/dotnet-test-console/TestHostTracing.cs similarity index 95% rename from src/dotnet/commands/dotnet-test/TestHostTracing.cs rename to src/dotnet-test-console/TestHostTracing.cs index 65d9a440c..44299586b 100644 --- a/src/dotnet/commands/dotnet-test/TestHostTracing.cs +++ b/src/dotnet-test-console/TestHostTracing.cs @@ -14,8 +14,8 @@ namespace Microsoft.DotNet.Tools.Test static TestHostTracing() { - Source = Environment.GetEnvironmentVariable(TracingEnvironmentVariable) == "1" - ? new TraceSource("dotnet-test", SourceLevels.Verbose) + Source = Environment.GetEnvironmentVariable(TracingEnvironmentVariable) == "1" + ? new TraceSource("dotnet-test", SourceLevels.Verbose) : new TraceSource("dotnet-test", SourceLevels.Warning); Source.Listeners.Add(new TextWriterTraceListener(Console.Error)); diff --git a/src/dotnet/commands/dotnet-test/TestMessagesCollection.cs b/src/dotnet-test-console/TestMessagesCollection.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/TestMessagesCollection.cs rename to src/dotnet-test-console/TestMessagesCollection.cs diff --git a/src/dotnet-test-console/TestRunners/AssemblyTestRunnerResolver.cs b/src/dotnet-test-console/TestRunners/AssemblyTestRunnerResolver.cs new file mode 100644 index 000000000..98abb50e2 --- /dev/null +++ b/src/dotnet-test-console/TestRunners/AssemblyTestRunnerResolver.cs @@ -0,0 +1,34 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System.IO; +using System.Linq; +using Microsoft.Extensions.EnvironmentAbstractions; + +namespace Microsoft.DotNet.Tools.Test +{ + public class AssemblyTestRunnerResolver : ITestRunnerResolver + { + private readonly string _assemblyUnderTestPath; + + private readonly IDirectory _directory; + + public AssemblyTestRunnerResolver(string assemblyUnderTestPath) : + this(assemblyUnderTestPath, FileSystemWrapper.Default.Directory) + { + } + + internal AssemblyTestRunnerResolver(string assemblyUnderTestPath, IDirectory directory) + { + _assemblyUnderTestPath = assemblyUnderTestPath; + _directory = directory; + } + + public string ResolveTestRunner() + { + var testRunnerPath = _directory.GetFiles(_assemblyUnderTestPath, "dotnet-test-*").FirstOrDefault(); + + return Path.GetFileNameWithoutExtension(testRunnerPath); + } + } +} diff --git a/src/dotnet/commands/dotnet-test/TestRunners/DiscoverTestsArgumentsBuilder.cs b/src/dotnet-test-console/TestRunners/DiscoverTestsArgumentsBuilder.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/TestRunners/DiscoverTestsArgumentsBuilder.cs rename to src/dotnet-test-console/TestRunners/DiscoverTestsArgumentsBuilder.cs diff --git a/src/dotnet/commands/dotnet-test/TestRunners/ITestRunner.cs b/src/dotnet-test-console/TestRunners/ITestRunner.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/TestRunners/ITestRunner.cs rename to src/dotnet-test-console/TestRunners/ITestRunner.cs diff --git a/src/dotnet/commands/dotnet-test/TestRunners/ITestRunnerArgumentsBuilder.cs b/src/dotnet-test-console/TestRunners/ITestRunnerArgumentsBuilder.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/TestRunners/ITestRunnerArgumentsBuilder.cs rename to src/dotnet-test-console/TestRunners/ITestRunnerArgumentsBuilder.cs diff --git a/src/dotnet/commands/dotnet-test/TestRunners/ITestRunnerFactory.cs b/src/dotnet-test-console/TestRunners/ITestRunnerFactory.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/TestRunners/ITestRunnerFactory.cs rename to src/dotnet-test-console/TestRunners/ITestRunnerFactory.cs diff --git a/src/dotnet-test-console/TestRunners/ITestRunnerResolver.cs b/src/dotnet-test-console/TestRunners/ITestRunnerResolver.cs new file mode 100644 index 000000000..f0c4d15a6 --- /dev/null +++ b/src/dotnet-test-console/TestRunners/ITestRunnerResolver.cs @@ -0,0 +1,10 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.DotNet.Tools.Test +{ + public interface ITestRunnerResolver + { + string ResolveTestRunner(); + } +} diff --git a/src/dotnet-test-console/TestRunners/ParameterTestRunnerResolver.cs b/src/dotnet-test-console/TestRunners/ParameterTestRunnerResolver.cs new file mode 100644 index 000000000..35cd7055b --- /dev/null +++ b/src/dotnet-test-console/TestRunners/ParameterTestRunnerResolver.cs @@ -0,0 +1,20 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.DotNet.Tools.Test +{ + public class ParameterTestRunnerResolver : ITestRunnerResolver + { + private readonly string _testRunner; + + public ParameterTestRunnerResolver(string testRunner) + { + _testRunner = testRunner; + } + + public string ResolveTestRunner() + { + return $"dotnet-test-{_testRunner}"; + } + } +} diff --git a/src/dotnet-test-console/TestRunners/ProjectJsonTestRunnerResolver.cs b/src/dotnet-test-console/TestRunners/ProjectJsonTestRunnerResolver.cs new file mode 100644 index 000000000..4bcdc0987 --- /dev/null +++ b/src/dotnet-test-console/TestRunners/ProjectJsonTestRunnerResolver.cs @@ -0,0 +1,22 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using Microsoft.DotNet.ProjectModel; + +namespace Microsoft.DotNet.Tools.Test +{ + public class ProjectJsonTestRunnerResolver : ITestRunnerResolver + { + private Project _project; + + public ProjectJsonTestRunnerResolver(Project project) + { + _project = project; + } + + public string ResolveTestRunner() + { + return string.IsNullOrEmpty(_project.TestRunner) ? null : $"dotnet-test-{_project.TestRunner}"; + } + } +} diff --git a/src/dotnet/commands/dotnet-test/TestRunners/RunTestsArgumentsBuilder.cs b/src/dotnet-test-console/TestRunners/RunTestsArgumentsBuilder.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/TestRunners/RunTestsArgumentsBuilder.cs rename to src/dotnet-test-console/TestRunners/RunTestsArgumentsBuilder.cs diff --git a/src/dotnet/commands/dotnet-test/TestRunners/TestRunner.cs b/src/dotnet-test-console/TestRunners/TestRunner.cs similarity index 97% rename from src/dotnet/commands/dotnet-test/TestRunners/TestRunner.cs rename to src/dotnet-test-console/TestRunners/TestRunner.cs index 2ca95b678..6ef3474d5 100644 --- a/src/dotnet/commands/dotnet-test/TestRunners/TestRunner.cs +++ b/src/dotnet-test-console/TestRunners/TestRunner.cs @@ -51,7 +51,7 @@ namespace Microsoft.DotNet.Tools.Test var commandArgs = _argumentsBuilder.BuildArguments(); return _commandFactory.Create( - $"dotnet-{_testRunner}", + $"{_testRunner}", commandArgs, null, null); diff --git a/src/dotnet/commands/dotnet-test/TestRunners/TestRunnerFactory.cs b/src/dotnet-test-console/TestRunners/TestRunnerFactory.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/TestRunners/TestRunnerFactory.cs rename to src/dotnet-test-console/TestRunners/TestRunnerFactory.cs diff --git a/src/dotnet/commands/dotnet-test/TestRunners/TestRunnerOperationFailedException.cs b/src/dotnet-test-console/TestRunners/TestRunnerOperationFailedException.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/TestRunners/TestRunnerOperationFailedException.cs rename to src/dotnet-test-console/TestRunners/TestRunnerOperationFailedException.cs diff --git a/src/dotnet/commands/dotnet-test/TestStartInfo.cs b/src/dotnet-test-console/TestStartInfo.cs similarity index 100% rename from src/dotnet/commands/dotnet-test/TestStartInfo.cs rename to src/dotnet-test-console/TestStartInfo.cs diff --git a/src/dotnet-test-console/dotnet-test-console.xproj b/src/dotnet-test-console/dotnet-test-console.xproj new file mode 100644 index 000000000..0ead3698f --- /dev/null +++ b/src/dotnet-test-console/dotnet-test-console.xproj @@ -0,0 +1,21 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + 6D028154-5518-4A56-BAD6-938A90E5BCF6 + dotnet_test_console + obj\$(MSBuildProjectName) + bin\$(MSBuildProjectName)\ + v4.5.2 + + + + 2.0 + + + diff --git a/src/dotnet-test-console/project.json b/src/dotnet-test-console/project.json new file mode 100644 index 000000000..ce9cf878e --- /dev/null +++ b/src/dotnet-test-console/project.json @@ -0,0 +1,38 @@ +{ + "version": "1.0.0-featmsbuild-*", + "buildOptions": { + "keyFile": "../../tools/Key.snk", + "compile": { + "include": [ + "**/*.cs", + "../dotnet/CommandLine/*.cs" + ] + } + }, + + "dependencies": { + "System.Diagnostics.TraceSource": "4.0.0", + "System.Diagnostics.TextWriterTraceListener": "4.0.0", + "Microsoft.DotNet.Cli.Utils": { + "target": "project" + }, + "Microsoft.DotNet.ProjectModel": { + "target": "project" + }, + "Microsoft.Extensions.Testing.Abstractions": { + "target": "project" + }, + "Microsoft.DotNet.InternalAbstractions": { + "target": "project" + }, + "Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000919" + }, + + "frameworks": { + "netstandard1.6": { + "imports": [ + "portable-net45+wp80+win8+wpa81+dnxcore50" + ] + } + } +} diff --git a/src/dotnet/project.json b/src/dotnet/project.json index 4cf3dcd61..dc4f85897 100644 --- a/src/dotnet/project.json +++ b/src/dotnet/project.json @@ -45,6 +45,9 @@ "Microsoft.DotNet.Configurer": { "target": "project" }, + "dotnet-test-console": { + "target": "project" + }, "Microsoft.NETCore.App": { "type": "platform", "version": "1.0.0" diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Mock/FileSystemMockBuilder.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Mock/FileSystemMockBuilder.cs index 50537d20b..4fc2a158a 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Mock/FileSystemMockBuilder.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Mock/FileSystemMockBuilder.cs @@ -118,6 +118,11 @@ namespace Microsoft.Extensions.DependencyModel.Tests return _temporaryDirectory; } + public IEnumerable GetFiles(string path, string searchPattern) + { + throw new NotImplementedException(); + } + public bool Exists(string path) { return _files.Keys.Any(k => k.StartsWith(path)); diff --git a/test/dotnet-test.UnitTests/GivenAParameterTestRunnerResolver.cs b/test/dotnet-test.UnitTests/GivenAParameterTestRunnerResolver.cs new file mode 100644 index 000000000..0eb1aa664 --- /dev/null +++ b/test/dotnet-test.UnitTests/GivenAParameterTestRunnerResolver.cs @@ -0,0 +1,24 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using FluentAssertions; +using Microsoft.DotNet.Tools.Test; +using Xunit; + +namespace Microsoft.Dotnet.Tools.Test.Tests +{ + public class GivenAParameterTestRunnerResolver + { + private const string SomeTestRunner = "Some test runner"; + + [Fact] + public void It_returns_the_runner_based_on_the_parameter() + { + var parameterTestRunnerResolver = new ParameterTestRunnerResolver(SomeTestRunner); + + var testRunner = parameterTestRunnerResolver.ResolveTestRunner(); + + testRunner.Should().Be($"dotnet-test-{SomeTestRunner}"); + } + } +} diff --git a/test/dotnet-test.UnitTests/GivenAProjectJsonTestRunnerResolver.cs b/test/dotnet-test.UnitTests/GivenAProjectJsonTestRunnerResolver.cs new file mode 100644 index 000000000..68f653721 --- /dev/null +++ b/test/dotnet-test.UnitTests/GivenAProjectJsonTestRunnerResolver.cs @@ -0,0 +1,43 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using FluentAssertions; +using Microsoft.DotNet.ProjectModel; +using Microsoft.DotNet.Tools.Test; +using Microsoft.Extensions.Testing.Abstractions; +using Xunit; + +namespace Microsoft.Dotnet.Tools.Test.Tests +{ + public class GivenAProjectJsonTestRunnerResolver + { + private const string SomeTestRunner = "runner"; + + [Fact] + public void It_resolves_the_TestRunner_using_the_testRunner_property_in_the_projectJson() + { + var project = new Project + { + TestRunner = SomeTestRunner + }; + + var projectJsonTestRunnerResolver = new ProjectJsonTestRunnerResolver(project); + + var testRunner = projectJsonTestRunnerResolver.ResolveTestRunner(); + + testRunner.Should().Be($"dotnet-test-{SomeTestRunner}"); + } + + [Fact] + public void It_returns_null_when_there_is_no_testRunner_set_in_the_projectJson() + { + var project = new Project(); + + var projectJsonTestRunnerResolver = new ProjectJsonTestRunnerResolver(project); + + var testRunner = projectJsonTestRunnerResolver.ResolveTestRunner(); + + testRunner.Should().BeNull(); + } + } +} \ No newline at end of file diff --git a/test/dotnet-test.UnitTests/GivenATestRunner.cs b/test/dotnet-test.UnitTests/GivenATestRunner.cs index a767f75ce..41238b037 100644 --- a/test/dotnet-test.UnitTests/GivenATestRunner.cs +++ b/test/dotnet-test.UnitTests/GivenATestRunner.cs @@ -20,7 +20,7 @@ namespace Microsoft.Dotnet.Tools.Test.Tests private Mock _commandMock; private Mock _commandFactoryMock; private Mock _argumentsBuilderMock; - private string _runner = "runner"; + private string _runner = "dotnet-test-runner"; private string[] _testRunnerArguments; public GivenATestRunner() @@ -38,7 +38,7 @@ namespace Microsoft.Dotnet.Tools.Test.Tests _commandFactoryMock = new Mock(); _commandFactoryMock.Setup(c => c.Create( - $"dotnet-{_runner}", + $"{_runner}", _testRunnerArguments, null, null)).Returns(_commandMock.Object).Verifiable(); diff --git a/test/dotnet-test.UnitTests/GivenAnAssemblyTestRunnerResolver.cs b/test/dotnet-test.UnitTests/GivenAnAssemblyTestRunnerResolver.cs new file mode 100644 index 000000000..e54ecc1f5 --- /dev/null +++ b/test/dotnet-test.UnitTests/GivenAnAssemblyTestRunnerResolver.cs @@ -0,0 +1,91 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System.Collections.Generic; +using System.Linq; +using System.Text.RegularExpressions; +using FluentAssertions; +using Microsoft.DotNet.Tools.Test; +using Microsoft.Extensions.EnvironmentAbstractions; +using Microsoft.Extensions.Testing.Abstractions; +using Xunit; + +namespace Microsoft.Dotnet.Tools.Test.Tests +{ + public class GivenAnAssemblyTestRunnerResolver + { + private const string PathToAssemblyUnderTest = "path to some assembly under test"; + + private const string TestRunnerName = "dotnet-test-someRunner"; + + private static readonly string TestRunnerFileName = $"{TestRunnerName}.dll"; + + [Fact] + public void It_finds_the_runner_in_the_same_folder_as_the_assembly() + { + var directoryMock = new DirectoryMock(); + + directoryMock.AddFile(PathToAssemblyUnderTest, TestRunnerFileName); + + var assemblyTestRunnerResolver = new AssemblyTestRunnerResolver(PathToAssemblyUnderTest, directoryMock); + + var testRunner = assemblyTestRunnerResolver.ResolveTestRunner(); + + testRunner.Should().Be(TestRunnerName); + } + + [Fact] + public void It_returns_a_test_runner_even_when_multiple_test_runners_are_present() + { + var directoryMock = new DirectoryMock(); + + directoryMock.AddFile(PathToAssemblyUnderTest, TestRunnerFileName); + directoryMock.AddFile(PathToAssemblyUnderTest, "dotnet-test-someOtherTestRunner.dll"); + directoryMock.AddFile(PathToAssemblyUnderTest, "dotnet-test-AndYetAnotherTestRunner.dll"); + + var assemblyTestRunnerResolver = new AssemblyTestRunnerResolver(PathToAssemblyUnderTest, directoryMock); + + var bestEffortTestRunner = assemblyTestRunnerResolver.ResolveTestRunner(); + + bestEffortTestRunner.Should().NotBeNull(); + } + + [Fact] + public void It_returns_null_when_no_test_runner_is_found() + { + var directoryMock = new DirectoryMock(); + + var assemblyTestRunnerResolver = new AssemblyTestRunnerResolver(PathToAssemblyUnderTest, directoryMock); + + var testRunner = assemblyTestRunnerResolver.ResolveTestRunner(); + + testRunner.Should().BeNull(); + } + + private class DirectoryMock : IDirectory + { + private IList _files = new List(); + + public bool Exists(string path) + { + throw new System.NotImplementedException(); + } + + public ITemporaryDirectory CreateTemporaryDirectory() + { + throw new System.NotImplementedException(); + } + + public IEnumerable GetFiles(string path, string searchPattern) + { + var searchPatternRegex = new Regex(searchPattern); + return _files.Where(f => f.StartsWith(path) && searchPatternRegex.IsMatch(f)); + } + + public void AddFile(string path, string fileName) + { + _files.Add($"{path}/{fileName}"); + } + } + } +} \ No newline at end of file diff --git a/test/dotnet-test.UnitTests/project.json b/test/dotnet-test.UnitTests/project.json index 54f47f175..35b058573 100644 --- a/test/dotnet-test.UnitTests/project.json +++ b/test/dotnet-test.UnitTests/project.json @@ -6,7 +6,10 @@ "version": "1.0.0" }, "Newtonsoft.Json": "9.0.1", - "dotnet": { + "dotnet-test-console": { + "target": "project" + }, + "Microsoft.DotNet.InternalAbstractions": { "target": "project" }, "Microsoft.Win32.Registry": { @@ -34,6 +37,7 @@ ] }, "buildOptions": { + "keyFile": "../../tools/test_key.snk", "copyToOutput": { "include": [ "../../TestAssets/TestProjects/ProjectsWithTests/NetCoreAppOnlyProject/project.json"