diff options
Diffstat (limited to 'main/tests')
8 files changed, 221 insertions, 0 deletions
diff --git a/main/tests/MonoDevelop.Core.Tests/MonoDevelop.Projects/SolutionTests.cs b/main/tests/MonoDevelop.Core.Tests/MonoDevelop.Projects/SolutionTests.cs index fb969dc51c..fbac6af29c 100644 --- a/main/tests/MonoDevelop.Core.Tests/MonoDevelop.Projects/SolutionTests.cs +++ b/main/tests/MonoDevelop.Core.Tests/MonoDevelop.Projects/SolutionTests.cs @@ -1055,6 +1055,40 @@ namespace MonoDevelop.Projects WorkspaceObject.UnregisterCustomExtension (en); } } + + [Test] + public async Task MultiRunConfig_ReloadProject_ProjectRunConfigUpdatedInMultiRunConfig () + { + string solFile = Util.GetSampleProject ("test-multi-run-config-reload", "test-multi-run-config-reload.sln"); + + using (var sol = (Solution)await Services.ProjectService.ReadWorkspaceItem (Util.GetMonitor (), solFile)) { + var projectA = (DotNetProject)sol.FindProjectByName ("ProjectA"); + var projectB = (DotNetProject)sol.FindProjectByName ("ProjectB"); + Assert.IsNotNull (projectA); + Assert.IsNotNull (projectB); + + var multiRunConfig = new MultiItemSolutionRunConfiguration ("MultiTestId", "multi"); + var startupItem1 = new StartupItem (projectA, projectA.RunConfigurations.Single ()); + multiRunConfig.Items.Add (startupItem1); + + var startupItem2 = new StartupItem (projectB, projectB.RunConfigurations.Single ()); + multiRunConfig.Items.Add (startupItem2); + + sol.MultiStartupRunConfigurations.Add (multiRunConfig); + + await sol.RootFolder.ReloadItem (Util.GetMonitor (), projectA); + + // Ensure latest project instance is used by getting them from the solution again. + projectA = (DotNetProject)sol.FindProjectByName ("ProjectA"); + projectB = (DotNetProject)sol.FindProjectByName ("ProjectB"); + + var runConfigA = multiRunConfig.Items.Single (item => item.SolutionItem == projectA); + Assert.AreEqual (projectA.RunConfigurations.Single (), runConfigA.RunConfiguration, "Multi-run config does not match project's run config (ProjectA)"); + + var runConfigB = multiRunConfig.Items.Single (item => item.SolutionItem == projectB); + Assert.AreEqual (projectB.RunConfigurations.Single (), runConfigB.RunConfiguration, "Multi-run config does not match project's run config (ProjectB)"); + } + } } class SomeItem: SolutionItem diff --git a/main/tests/test-projects/test-multi-run-config-reload/ProjectA/Program.cs b/main/tests/test-projects/test-multi-run-config-reload/ProjectA/Program.cs new file mode 100644 index 0000000000..5ecf514c73 --- /dev/null +++ b/main/tests/test-projects/test-multi-run-config-reload/ProjectA/Program.cs @@ -0,0 +1,12 @@ +using System; + +namespace ProjectA +{ + class MainClass + { + public static void Main (string[] args) + { + Console.WriteLine ("Project A: args.Length={0}", args.Length); + } + } +} diff --git a/main/tests/test-projects/test-multi-run-config-reload/ProjectA/ProjectA.csproj b/main/tests/test-projects/test-multi-run-config-reload/ProjectA/ProjectA.csproj new file mode 100644 index 0000000000..e4a22dee09 --- /dev/null +++ b/main/tests/test-projects/test-multi-run-config-reload/ProjectA/ProjectA.csproj @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">anycpu</Platform> + <ProjectGuid>{1217D2CD-2C77-4AEF-AC43-418FC5DD7CE9}</ProjectGuid> + <OutputType>Exe</OutputType> + <RootNamespace>ProjectA</RootNamespace> + <AssemblyName>ProjectA</AssemblyName> + <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|anycpu' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug</OutputPath> + <DefineConstants>DEBUG;</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <ExternalConsole>true</ExternalConsole> + <IntermediateOutputPath>obj\anycpu\Debug</IntermediateOutputPath> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|anycpu' "> + <Optimize>true</Optimize> + <OutputPath>bin\Release</OutputPath> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <ExternalConsole>true</ExternalConsole> + <IntermediateOutputPath>obj\anycpu\Release</IntermediateOutputPath> + </PropertyGroup> + <PropertyGroup Condition=" '$(RunConfiguration)' == 'Default' "> + <StartAction>Project</StartAction> + <StartArguments>A1</StartArguments> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Program.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> +</Project>
\ No newline at end of file diff --git a/main/tests/test-projects/test-multi-run-config-reload/ProjectA/Properties/AssemblyInfo.cs b/main/tests/test-projects/test-multi-run-config-reload/ProjectA/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..241be46e6f --- /dev/null +++ b/main/tests/test-projects/test-multi-run-config-reload/ProjectA/Properties/AssemblyInfo.cs @@ -0,0 +1,26 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle ("ProjectA")] +[assembly: AssemblyDescription ("")] +[assembly: AssemblyConfiguration ("")] +[assembly: AssemblyCompany ("Microsoft")] +[assembly: AssemblyProduct ("")] +[assembly: AssemblyCopyright ("Microsoft Corporation")] +[assembly: AssemblyTrademark ("")] +[assembly: AssemblyCulture ("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion ("1.0.*")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] diff --git a/main/tests/test-projects/test-multi-run-config-reload/ProjectB/Program.cs b/main/tests/test-projects/test-multi-run-config-reload/ProjectB/Program.cs new file mode 100644 index 0000000000..efd3edfec0 --- /dev/null +++ b/main/tests/test-projects/test-multi-run-config-reload/ProjectB/Program.cs @@ -0,0 +1,13 @@ + +using System; + +namespace ProjectB +{ + class MainClass + { + public static void Main (string[] args) + { + Console.WriteLine ("Project A: args.Length={0}", args.Length); + } + } +} diff --git a/main/tests/test-projects/test-multi-run-config-reload/ProjectB/ProjectB.csproj b/main/tests/test-projects/test-multi-run-config-reload/ProjectB/ProjectB.csproj new file mode 100644 index 0000000000..6eb3523f3f --- /dev/null +++ b/main/tests/test-projects/test-multi-run-config-reload/ProjectB/ProjectB.csproj @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">anycpu</Platform> + <ProjectGuid>{2D669FEF-FBF4-4183-87E6-A3A4D6C8C97F}</ProjectGuid> + <OutputType>Exe</OutputType> + <RootNamespace>ProjectB</RootNamespace> + <AssemblyName>ProjectB</AssemblyName> + <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|anycpu' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug</OutputPath> + <DefineConstants>DEBUG;</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <ExternalConsole>true</ExternalConsole> + <IntermediateOutputPath>obj\anycpu\Debug</IntermediateOutputPath> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|anycpu' "> + <Optimize>true</Optimize> + <OutputPath>bin\Release</OutputPath> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <ExternalConsole>true</ExternalConsole> + <IntermediateOutputPath>obj\anycpu\Release</IntermediateOutputPath> + </PropertyGroup> + <PropertyGroup Condition=" '$(RunConfiguration)' == 'Default' "> + <StartAction>Project</StartAction> + <StartArguments>B1 B2</StartArguments> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Program.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> +</Project>
\ No newline at end of file diff --git a/main/tests/test-projects/test-multi-run-config-reload/ProjectB/Properties/Properties b/main/tests/test-projects/test-multi-run-config-reload/ProjectB/Properties/Properties new file mode 100644 index 0000000000..35b79e04df --- /dev/null +++ b/main/tests/test-projects/test-multi-run-config-reload/ProjectB/Properties/Properties @@ -0,0 +1,27 @@ + +using System.Reflection; +using System.Runtime.CompilerServices; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle ("ProjectB")] +[assembly: AssemblyDescription ("")] +[assembly: AssemblyConfiguration ("")] +[assembly: AssemblyCompany ("Microsoft")] +[assembly: AssemblyProduct ("")] +[assembly: AssemblyCopyright ("Microsoft Corporation")] +[assembly: AssemblyTrademark ("")] +[assembly: AssemblyCulture ("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion ("1.0.*")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] diff --git a/main/tests/test-projects/test-multi-run-config-reload/test-multi-run-config-reload.sln b/main/tests/test-projects/test-multi-run-config-reload/test-multi-run-config-reload.sln new file mode 100644 index 0000000000..4a7cf57fa7 --- /dev/null +++ b/main/tests/test-projects/test-multi-run-config-reload/test-multi-run-config-reload.sln @@ -0,0 +1,23 @@ +
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectA", "ProjectA\ProjectA.csproj", "{1217D2CD-2C77-4AEF-AC43-418FC5DD7CE9}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectB", "ProjectB\ProjectB.csproj", "{2D669FEF-FBF4-4183-87E6-A3A4D6C8C97F}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|anycpu = Debug|anycpu
+ Release|anycpu = Release|anycpu
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {1217D2CD-2C77-4AEF-AC43-418FC5DD7CE9}.Debug|anycpu.ActiveCfg = Debug|anycpu
+ {1217D2CD-2C77-4AEF-AC43-418FC5DD7CE9}.Debug|anycpu.Build.0 = Debug|anycpu
+ {1217D2CD-2C77-4AEF-AC43-418FC5DD7CE9}.Release|anycpu.ActiveCfg = Release|anycpu
+ {1217D2CD-2C77-4AEF-AC43-418FC5DD7CE9}.Release|anycpu.Build.0 = Release|anycpu
+ {2D669FEF-FBF4-4183-87E6-A3A4D6C8C97F}.Debug|anycpu.ActiveCfg = Debug|anycpu
+ {2D669FEF-FBF4-4183-87E6-A3A4D6C8C97F}.Debug|anycpu.Build.0 = Debug|anycpu
+ {2D669FEF-FBF4-4183-87E6-A3A4D6C8C97F}.Release|anycpu.ActiveCfg = Release|anycpu
+ {2D669FEF-FBF4-4183-87E6-A3A4D6C8C97F}.Release|anycpu.Build.0 = Release|anycpu
+ EndGlobalSection
+EndGlobal
|