diff options
author | Lluis Sanchez <lluis@xamarin.com> | 2014-02-11 12:27:43 +0400 |
---|---|---|
committer | Lluis Sanchez <lluis@xamarin.com> | 2014-02-11 12:28:01 +0400 |
commit | 0e37c07da3e62dd8aa17090d729d875c185538f9 (patch) | |
tree | 4a8666294e6b6a8a98f2d511d22e35a11bd5b3e2 /main/tests | |
parent | 138ad2f7b71abfb2d97f73331d073b4a55158749 (diff) |
[Core] Added unit tests
Added unit test for bug 17316 - Monodevelop overwrites conditional references
Also simplified a bit the fix.
Diffstat (limited to 'main/tests')
5 files changed, 136 insertions, 0 deletions
diff --git a/main/tests/UnitTests/MonoDevelop.Projects/MSBuildTests.cs b/main/tests/UnitTests/MonoDevelop.Projects/MSBuildTests.cs index 804d6563b6..a87347d514 100644 --- a/main/tests/UnitTests/MonoDevelop.Projects/MSBuildTests.cs +++ b/main/tests/UnitTests/MonoDevelop.Projects/MSBuildTests.cs @@ -430,5 +430,20 @@ namespace MonoDevelop.Projects { LoadBuildVSConsoleProject ("2013", "12.0"); } + + [Test] + public void SaveReferenceWithCondition () + { + string solFile = Util.GetSampleProject ("console-project-conditional-reference", "ConsoleProject.sln"); + Solution sol = Services.ProjectService.ReadWorkspaceItem (Util.GetMonitor (), solFile) as Solution; + + string proj = sol.GetAllProjects ().First ().FileName; + + string projectXml1 = Util.GetXmlFileInfoset (proj); + sol.Save (new NullProgressMonitor ()); + + string projectXml2 = Util.GetXmlFileInfoset (proj); + Assert.AreEqual (projectXml1, projectXml2); + } } } diff --git a/main/tests/test-projects/console-project-conditional-reference/ConsoleProject.sln b/main/tests/test-projects/console-project-conditional-reference/ConsoleProject.sln new file mode 100755 index 0000000000..199aa24543 --- /dev/null +++ b/main/tests/test-projects/console-project-conditional-reference/ConsoleProject.sln @@ -0,0 +1,23 @@ +
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleProject", "ConsoleProject\ConsoleProject.csproj", "{4A9E3523-48F0-4BDF-A0F4-49DAD4431FAB}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {4A9E3523-48F0-4BDF-A0F4-49DAD4431FAB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4A9E3523-48F0-4BDF-A0F4-49DAD4431FAB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4A9E3523-48F0-4BDF-A0F4-49DAD4431FAB}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4A9E3523-48F0-4BDF-A0F4-49DAD4431FAB}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(MonoDevelopProperties) = preSolution
+ StartupItem = ConsoleProject\ConsoleProject.csproj
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/main/tests/test-projects/console-project-conditional-reference/ConsoleProject/ConsoleProject.csproj b/main/tests/test-projects/console-project-conditional-reference/ConsoleProject/ConsoleProject.csproj new file mode 100755 index 0000000000..1b82a09794 --- /dev/null +++ b/main/tests/test-projects/console-project-conditional-reference/ConsoleProject/ConsoleProject.csproj @@ -0,0 +1,51 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.50727</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{4A9E3523-48F0-4BDF-A0F4-49DAD4431FAB}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>ConsoleProject</RootNamespace> + <AssemblyName>ConsoleProject</AssemblyName> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>True</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>False</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>True</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="protobuf-net" Condition=" '$(Configuration)' == 'Debug' "> + <HintPath>..\Lib\Debug\protobuf-net.dll</HintPath> + </Reference> + <Reference Include="protobuf-net" Condition=" '$(Configuration)' != 'Debug' "> + <HintPath>..\Lib\Release\protobuf-net.dll</HintPath> + </Reference> </ItemGroup> + <ItemGroup> + <Compile Include="Program.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> diff --git a/main/tests/test-projects/console-project-conditional-reference/ConsoleProject/Program.cs b/main/tests/test-projects/console-project-conditional-reference/ConsoleProject/Program.cs new file mode 100755 index 0000000000..cd4be63967 --- /dev/null +++ b/main/tests/test-projects/console-project-conditional-reference/ConsoleProject/Program.cs @@ -0,0 +1,14 @@ +using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ConsoleProject
+{
+ class Program
+ {
+ static void Main (string[] args)
+ {
+ Console.WriteLine ("Hello world");
+ }
+ }
+}
diff --git a/main/tests/test-projects/console-project-conditional-reference/ConsoleProject/Properties/AssemblyInfo.cs b/main/tests/test-projects/console-project-conditional-reference/ConsoleProject/Properties/AssemblyInfo.cs new file mode 100755 index 0000000000..be1e50670d --- /dev/null +++ b/main/tests/test-projects/console-project-conditional-reference/ConsoleProject/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +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 ("ConsoleProject")]
+[assembly: AssemblyDescription ("")]
+[assembly: AssemblyConfiguration ("")]
+[assembly: AssemblyCompany ("")]
+[assembly: AssemblyProduct ("ConsoleProject")]
+[assembly: AssemblyCopyright ("Copyright © 2008")]
+[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 ("a1b85c5f-e506-462a-911c-cbe67c035c93")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+[assembly: AssemblyVersion ("1.0.0.0")]
+[assembly: AssemblyFileVersion ("1.0.0.0")]
|