This repository has been archived by the owner on Oct 4, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Ide] Add tests to ensure we can always create projects
We should never ship a Xamarin Studio which cannot create projects from it's own project templates now.
- Loading branch information
1 parent
acdd984
commit 466fc7f
Showing
9 changed files
with
172 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?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> | ||
<ProductVersion>10.0.0</ProductVersion> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<ProjectGuid>{73D4CC8B-BAB9-4A29-841B-F25C6311F067}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<RootNamespace>Ide.Tests</RootNamespace> | ||
<AssemblyName>Ide.Tests</AssemblyName> | ||
<TestRunnerCommand>..\..\build\bin\mdtool.exe</TestRunnerCommand> | ||
<TestRunnerArgs>run-md-tests</TestRunnerArgs> | ||
</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> | ||
<ConsolePause>false</ConsolePause> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>full</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release</OutputPath> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<ConsolePause>false</ConsolePause> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="ProjectTemplateTests.cs" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> | ||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\core\MonoDevelop.Ide\MonoDevelop.Ide.csproj"> | ||
<Project>{27096E7F-C91C-4AC6-B289-6897A701DF21}</Project> | ||
<Name>MonoDevelop.Ide</Name> | ||
<Private>False</Private> | ||
</ProjectReference> | ||
<ProjectReference Include="..\..\src\core\MonoDevelop.Core\MonoDevelop.Core.csproj"> | ||
<Project>{7525BB88-6142-4A26-93B9-A30C6983390A}</Project> | ||
<Name>MonoDevelop.Core</Name> | ||
<Private>False</Private> | ||
</ProjectReference> | ||
<ProjectReference Include="..\..\external\guiunit\src\framework\GuiUnit_NET_4_0.csproj"> | ||
<Project>{E13A0A7B-4DE6-43ED-A139-41052D065A9B}</Project> | ||
<Name>GuiUnit_NET_4_0</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
// | ||
// MyClass.cs | ||
// | ||
// Author: | ||
// alan <> | ||
// | ||
// Copyright (c) 2013 alan | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
using System; | ||
using MonoDevelop.Ide.Templates; | ||
using MonoDevelop.Projects; | ||
using NUnit.Framework; | ||
using System.IO; | ||
using System.Text; | ||
|
||
namespace MonoDevelop.Ide | ||
{ | ||
[TestFixture] | ||
public class ProjectTemplateTests | ||
{ | ||
string TempDir { | ||
get; set; | ||
} | ||
|
||
[SetUp] | ||
public void Setup () | ||
{ | ||
var currentDir = Path.GetDirectoryName (typeof(ProjectTemplateTests).Assembly.Location); | ||
TempDir = Path.GetFullPath (Path.Combine (currentDir, "TempDirForTests")); | ||
} | ||
|
||
[TearDown] | ||
public void Teardown () | ||
{ | ||
try { Directory.Delete (TempDir, true); } catch { } | ||
} | ||
|
||
[Test] | ||
public void CreateEveryProjectTemplate () | ||
{ | ||
var builder = new StringBuilder (); | ||
foreach (var template in ProjectTemplate.ProjectTemplates) { | ||
try { | ||
try { Directory.Delete (TempDir, true); } catch { } | ||
var cinfo = new ProjectCreateInformation { | ||
ProjectBasePath = TempDir, | ||
ProjectName = "ProjectName", | ||
SolutionName = "SolutionName", | ||
SolutionPath = TempDir | ||
}; | ||
template.CreateWorkspaceItem (cinfo); | ||
} catch { | ||
builder.AppendFormat ("Could not create a project from the template '{0} / {1}'", template.Category, template.Name); | ||
builder.AppendLine (); | ||
} | ||
} | ||
|
||
if (builder.Length > 0) | ||
Assert.Fail (builder.ToString ()); | ||
} | ||
} | ||
} | ||
|