45 changed files with 2032 additions and 0 deletions
@ -0,0 +1,130 @@
@@ -0,0 +1,130 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00 |
||||
# Visual Studio 2010 |
||||
# SharpDevelop 4.1.0.7683-alpha |
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AspNet.Mvc", "Project\AspNet.Mvc.csproj", "{D781721F-C2A7-4E95-B76F-247170AC3B13}" |
||||
EndProject |
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AspNet.Mvc.Tests", "Test\AspNet.Mvc.Tests.csproj", "{0B12A079-B2DB-42B9-8A8E-AA5CBC2B3225}" |
||||
EndProject |
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop", "..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj", "{2748AD25-9C63-4E12-877B-4DCE96FBED54}" |
||||
EndProject |
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Core", "..\..\..\Main\Core\Project\ICSharpCode.Core.csproj", "{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}" |
||||
EndProject |
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NRefactory", "..\..\..\Libraries\NRefactory\Project\NRefactory.csproj", "{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}" |
||||
EndProject |
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AvalonDock", "..\..\..\Libraries\AvalonDock\AvalonDock\AvalonDock.csproj", "{87E61430-4243-45F2-B74E-0A4C096CEBF3}" |
||||
EndProject |
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.AvalonEdit", "..\..\..\Libraries\AvalonEdit\ICSharpCode.AvalonEdit\ICSharpCode.AvalonEdit.csproj", "{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}" |
||||
EndProject |
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Core.Presentation", "..\..\..\Main\ICSharpCode.Core.Presentation\ICSharpCode.Core.Presentation.csproj", "{7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}" |
||||
EndProject |
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Core.WinForms", "..\..\..\Main\ICSharpCode.Core.WinForms\ICSharpCode.Core.WinForms.csproj", "{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}" |
||||
EndProject |
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop.Dom", "..\..\..\Main\ICSharpCode.SharpDevelop.Dom\Project\ICSharpCode.SharpDevelop.Dom.csproj", "{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}" |
||||
EndProject |
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop.Widgets", "..\..\..\Main\ICSharpCode.SharpDevelop.Widgets\Project\ICSharpCode.SharpDevelop.Widgets.csproj", "{8035765F-D51F-4A0C-A746-2FD100E19419}" |
||||
EndProject |
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TextTemplating", "..\..\Misc\TextTemplating\Project\TextTemplating.csproj", "{B5D8C3E6-42EC-4D4B-AD05-3644B32563EF}" |
||||
EndProject |
||||
Global |
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
||||
Debug|x86 = Debug|x86 |
||||
Release|x86 = Release|x86 |
||||
Debug|Any CPU = Debug|Any CPU |
||||
Release|Any CPU = Release|Any CPU |
||||
EndGlobalSection |
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution |
||||
{D781721F-C2A7-4E95-B76F-247170AC3B13}.Debug|x86.Build.0 = Debug|x86 |
||||
{D781721F-C2A7-4E95-B76F-247170AC3B13}.Debug|x86.ActiveCfg = Debug|x86 |
||||
{D781721F-C2A7-4E95-B76F-247170AC3B13}.Release|x86.Build.0 = Release|x86 |
||||
{D781721F-C2A7-4E95-B76F-247170AC3B13}.Release|x86.ActiveCfg = Release|x86 |
||||
{0B12A079-B2DB-42B9-8A8E-AA5CBC2B3225}.Debug|x86.Build.0 = Debug|x86 |
||||
{0B12A079-B2DB-42B9-8A8E-AA5CBC2B3225}.Debug|x86.ActiveCfg = Debug|x86 |
||||
{0B12A079-B2DB-42B9-8A8E-AA5CBC2B3225}.Release|x86.Build.0 = Release|x86 |
||||
{0B12A079-B2DB-42B9-8A8E-AA5CBC2B3225}.Release|x86.ActiveCfg = Release|x86 |
||||
{0B12A079-B2DB-42B9-8A8E-AA5CBC2B3225}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
{0B12A079-B2DB-42B9-8A8E-AA5CBC2B3225}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
{0B12A079-B2DB-42B9-8A8E-AA5CBC2B3225}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
{0B12A079-B2DB-42B9-8A8E-AA5CBC2B3225}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
{2748AD25-9C63-4E12-877B-4DCE96FBED54}.Debug|x86.Build.0 = Debug|Any CPU |
||||
{2748AD25-9C63-4E12-877B-4DCE96FBED54}.Debug|x86.ActiveCfg = Debug|Any CPU |
||||
{2748AD25-9C63-4E12-877B-4DCE96FBED54}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
{2748AD25-9C63-4E12-877B-4DCE96FBED54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
{2748AD25-9C63-4E12-877B-4DCE96FBED54}.Release|x86.Build.0 = Release|Any CPU |
||||
{2748AD25-9C63-4E12-877B-4DCE96FBED54}.Release|x86.ActiveCfg = Release|Any CPU |
||||
{2748AD25-9C63-4E12-877B-4DCE96FBED54}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
{2748AD25-9C63-4E12-877B-4DCE96FBED54}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Debug|x86.Build.0 = Debug|Any CPU |
||||
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Debug|x86.ActiveCfg = Debug|Any CPU |
||||
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Release|x86.Build.0 = Release|Any CPU |
||||
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Release|x86.ActiveCfg = Release|Any CPU |
||||
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Debug|x86.Build.0 = Debug|Any CPU |
||||
{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Debug|x86.ActiveCfg = Debug|Any CPU |
||||
{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Release|x86.Build.0 = Release|Any CPU |
||||
{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Release|x86.ActiveCfg = Release|Any CPU |
||||
{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
{87E61430-4243-45F2-B74E-0A4C096CEBF3}.Debug|x86.Build.0 = Debug|Any CPU |
||||
{87E61430-4243-45F2-B74E-0A4C096CEBF3}.Debug|x86.ActiveCfg = Debug|Any CPU |
||||
{87E61430-4243-45F2-B74E-0A4C096CEBF3}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
{87E61430-4243-45F2-B74E-0A4C096CEBF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
{87E61430-4243-45F2-B74E-0A4C096CEBF3}.Release|x86.Build.0 = Release|Any CPU |
||||
{87E61430-4243-45F2-B74E-0A4C096CEBF3}.Release|x86.ActiveCfg = Release|Any CPU |
||||
{87E61430-4243-45F2-B74E-0A4C096CEBF3}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
{87E61430-4243-45F2-B74E-0A4C096CEBF3}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|x86.Build.0 = Debug|Any CPU |
||||
{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|x86.ActiveCfg = Debug|Any CPU |
||||
{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Release|x86.Build.0 = Release|Any CPU |
||||
{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Release|x86.ActiveCfg = Release|Any CPU |
||||
{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
{7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}.Debug|x86.Build.0 = Debug|Any CPU |
||||
{7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}.Debug|x86.ActiveCfg = Debug|Any CPU |
||||
{7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
{7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
{7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}.Release|x86.Build.0 = Release|Any CPU |
||||
{7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}.Release|x86.ActiveCfg = Release|Any CPU |
||||
{7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
{7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}.Debug|x86.Build.0 = Debug|Any CPU |
||||
{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}.Debug|x86.ActiveCfg = Debug|Any CPU |
||||
{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}.Release|x86.Build.0 = Release|Any CPU |
||||
{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}.Release|x86.ActiveCfg = Release|Any CPU |
||||
{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Debug|x86.Build.0 = Debug|Any CPU |
||||
{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Debug|x86.ActiveCfg = Debug|Any CPU |
||||
{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Release|x86.Build.0 = Release|Any CPU |
||||
{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Release|x86.ActiveCfg = Release|Any CPU |
||||
{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
{8035765F-D51F-4A0C-A746-2FD100E19419}.Debug|x86.Build.0 = Debug|Any CPU |
||||
{8035765F-D51F-4A0C-A746-2FD100E19419}.Debug|x86.ActiveCfg = Debug|Any CPU |
||||
{8035765F-D51F-4A0C-A746-2FD100E19419}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
{8035765F-D51F-4A0C-A746-2FD100E19419}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
{8035765F-D51F-4A0C-A746-2FD100E19419}.Release|x86.Build.0 = Release|Any CPU |
||||
{8035765F-D51F-4A0C-A746-2FD100E19419}.Release|x86.ActiveCfg = Release|Any CPU |
||||
{8035765F-D51F-4A0C-A746-2FD100E19419}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
{8035765F-D51F-4A0C-A746-2FD100E19419}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
{B5D8C3E6-42EC-4D4B-AD05-3644B32563EF}.Debug|x86.Build.0 = Debug|x86 |
||||
{B5D8C3E6-42EC-4D4B-AD05-3644B32563EF}.Debug|x86.ActiveCfg = Debug|x86 |
||||
{B5D8C3E6-42EC-4D4B-AD05-3644B32563EF}.Debug|Any CPU.Build.0 = Debug|x86 |
||||
{B5D8C3E6-42EC-4D4B-AD05-3644B32563EF}.Debug|Any CPU.ActiveCfg = Debug|x86 |
||||
{B5D8C3E6-42EC-4D4B-AD05-3644B32563EF}.Release|x86.Build.0 = Release|x86 |
||||
{B5D8C3E6-42EC-4D4B-AD05-3644B32563EF}.Release|x86.ActiveCfg = Release|x86 |
||||
{B5D8C3E6-42EC-4D4B-AD05-3644B32563EF}.Release|Any CPU.Build.0 = Release|x86 |
||||
{B5D8C3E6-42EC-4D4B-AD05-3644B32563EF}.Release|Any CPU.ActiveCfg = Release|x86 |
||||
EndGlobalSection |
||||
EndGlobal |
||||
@ -0,0 +1,36 @@
@@ -0,0 +1,36 @@
|
||||
<AddIn |
||||
name="ASP.NET MVC Binding" |
||||
author="Matt Ward" |
||||
copyright="prj:///doc/copyright.txt" |
||||
description="Adds support for ASP.NET MVC" |
||||
addInManagerHidden="preinstalled"> |
||||
|
||||
<Manifest> |
||||
<Identity name="ICSharpCode.AspNet.Mvc"/> |
||||
</Manifest> |
||||
|
||||
<Runtime> |
||||
<Import assembly=":ICSharpCode.SharpDevelop"/> |
||||
<Import assembly="$ICSharpCode.TextTemplating/TextTemplating.dll"/> |
||||
<Import assembly="AspNet.Mvc.dll"> |
||||
<ConditionEvaluator |
||||
name="IsMvcViewsFolder" |
||||
class="ICSharpCode.AspNet.Mvc.IsMvcViewFolderSelectedConditionEvaluator"/> |
||||
</Import> |
||||
</Runtime> |
||||
|
||||
<Path name="/SharpDevelop/Pads/ProjectBrowser/ContextMenu/FolderNode/Add"> |
||||
<Condition name="IsMvcViewsFolder" action="Exclude"> |
||||
<MenuItem |
||||
id="MvcView" |
||||
insertbefore="New Item" |
||||
label="View..." |
||||
icon="Icons.16x16.NewDocumentIcon" |
||||
class="ICSharpCode.AspNet.Mvc.AddMvcViewToProjectCommand"/> |
||||
<MenuItem |
||||
id="MvcSeparator" |
||||
insertbefore="New Item" |
||||
type="Separator"/> |
||||
</Condition> |
||||
</Path> |
||||
</AddIn> |
||||
@ -0,0 +1,118 @@
@@ -0,0 +1,118 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build"> |
||||
<PropertyGroup> |
||||
<ProjectGuid>{D781721F-C2A7-4E95-B76F-247170AC3B13}</ProjectGuid> |
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform> |
||||
<OutputType>Library</OutputType> |
||||
<RootNamespace>ICSharpCode.AspNet.Mvc</RootNamespace> |
||||
<AssemblyName>AspNet.Mvc</AssemblyName> |
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> |
||||
<AppDesignerFolder>Properties</AppDesignerFolder> |
||||
<OutputPath>..\..\..\..\..\AddIns\BackendBindings\AspNet.Mvc\</OutputPath> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Platform)' == 'x86' "> |
||||
<PlatformTarget>x86</PlatformTarget> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> |
||||
<DebugSymbols>True</DebugSymbols> |
||||
<DebugType>Full</DebugType> |
||||
<Optimize>False</Optimize> |
||||
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> |
||||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> |
||||
<DebugSymbols>False</DebugSymbols> |
||||
<DebugType>None</DebugType> |
||||
<Optimize>True</Optimize> |
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> |
||||
<DefineConstants>TRACE</DefineConstants> |
||||
</PropertyGroup> |
||||
<ItemGroup> |
||||
<Reference Include="Mono.TextTemplating"> |
||||
<HintPath>..\..\..\Misc\TextTemplating\Project\lib\Mono.TextTemplating.dll</HintPath> |
||||
<Private>True</Private> |
||||
</Reference> |
||||
<Reference Include="PresentationCore" /> |
||||
<Reference Include="PresentationFramework" /> |
||||
<Reference Include="System" /> |
||||
<Reference Include="System.Windows.Forms" /> |
||||
<Reference Include="System.Xaml"> |
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System.Xml" /> |
||||
<Reference Include="WindowsBase" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Compile Include="..\..\..\..\Main\GlobalAssemblyInfo.cs"> |
||||
<Link>Configuration\GlobalAssemblyInfo.cs</Link> |
||||
</Compile> |
||||
<Compile Include="Src\AddMvcViewToProjectCommand.cs" /> |
||||
<Compile Include="Src\AddMvcViewToProjectView.xaml.cs"> |
||||
<DependentUpon>AddMvcViewToProjectView.xaml</DependentUpon> |
||||
<SubType>Code</SubType> |
||||
</Compile> |
||||
<Compile Include="Src\AddMvcViewToProjectViewModel.cs" /> |
||||
<Compile Include="Src\CloseDialogBehaviour.cs" /> |
||||
<Compile Include="Src\DelegateCommand.cs" /> |
||||
<Compile Include="Src\IAddMvcItemToProjectView.cs" /> |
||||
<Compile Include="Src\IMvcTextTemplateHost.cs" /> |
||||
<Compile Include="Src\IMvcTextTemplateHostFactory.cs" /> |
||||
<Compile Include="Src\IMvcViewFileGenerator.cs" /> |
||||
<Compile Include="Src\ISelectedMvcViewFolder.cs" /> |
||||
<Compile Include="Src\IsMvcViewFolderSelectedConditionEvaluator.cs" /> |
||||
<Compile Include="Configuration\AssemblyInfo.cs" /> |
||||
<Compile Include="Src\MvcTextTemplateHost.cs" /> |
||||
<Compile Include="Src\MvcTextTemplateHostFactory.cs" /> |
||||
<Compile Include="Src\MvcTextTemplateLanguage.cs" /> |
||||
<Compile Include="Src\MvcTextTemplateLanguageConverter.cs" /> |
||||
<Compile Include="Src\MvcTextTemplateRepository.cs" /> |
||||
<Compile Include="Src\MvcViewFileName.cs" /> |
||||
<Compile Include="Src\MvcViewFileGenerator.cs" /> |
||||
<Compile Include="Src\MvcViewTextTemplateFileName.cs" /> |
||||
<Compile Include="Src\SelectedMvcViewFolder.cs" /> |
||||
<Compile Include="Src\ViewModelBase.cs" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Folder Include="ItemTemplates" /> |
||||
<Folder Include="ItemTemplates\CSharp\CodeTemplates" /> |
||||
<Folder Include="ItemTemplates\CSharp" /> |
||||
<Folder Include="ItemTemplates\CSharp\CodeTemplates\AddView" /> |
||||
<Folder Include="ItemTemplates\CSharp\CodeTemplates\AddView\AspxCSharp" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<ProjectReference Include="..\..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj"> |
||||
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project> |
||||
<Name>ICSharpCode.SharpDevelop</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\..\..\..\Main\Core\Project\ICSharpCode.Core.csproj"> |
||||
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project> |
||||
<Name>ICSharpCode.Core</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\..\..\..\Main\ICSharpCode.Core.Presentation\ICSharpCode.Core.Presentation.csproj"> |
||||
<Project>{7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}</Project> |
||||
<Name>ICSharpCode.Core.Presentation</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\..\..\Misc\TextTemplating\Project\TextTemplating.csproj"> |
||||
<Project>{B5D8C3E6-42EC-4D4B-AD05-3644B32563EF}</Project> |
||||
<Name>TextTemplating</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<None Include="AspNet.Mvc.addin"> |
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
||||
</None> |
||||
<None Include="ItemTemplates\CSharp\CodeTemplates\AddView\AspxCSharp\Empty.tt"> |
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
||||
</None> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Page Include="Src\AddMvcViewToProjectView.xaml" /> |
||||
</ItemGroup> |
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> |
||||
<Import Project="PostBuildEvent.proj" /> |
||||
</Project> |
||||
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System.Reflection; |
||||
|
||||
// Information about this assembly is defined by the following
|
||||
// attributes.
|
||||
//
|
||||
// change them to the information which is associated with the assembly
|
||||
// you compile.
|
||||
|
||||
[assembly: AssemblyTitle("AspNet.Mvc")] |
||||
[assembly: AssemblyDescription("ASP.NET MVC support SharpDevelop")] |
||||
[assembly: AssemblyConfiguration("")] |
||||
[assembly: AssemblyTrademark("")] |
||||
[assembly: AssemblyCulture("")] |
||||
@ -0,0 +1,18 @@
@@ -0,0 +1,18 @@
|
||||
<#@ template language="C#" HostSpecific="true" #> |
||||
<#@ output extension=".aspx" #> |
||||
<# |
||||
MvcTextTemplateHost mvcHost = (MvcTextTemplateHost)Host; |
||||
#> |
||||
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %> |
||||
|
||||
<!DOCTYPE html> |
||||
<html> |
||||
<head runat="server"> |
||||
<title><#= mvcHost.ViewName #></title> |
||||
</head> |
||||
<body> |
||||
<div id="page"> |
||||
|
||||
</div> |
||||
</body> |
||||
</html> |
||||
@ -0,0 +1,11 @@
@@ -0,0 +1,11 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<PropertyGroup> |
||||
<PrepareForRunDependsOn>$(PrepareForRunDependsOn);MyPostBuildTarget</PrepareForRunDependsOn> |
||||
</PropertyGroup> |
||||
<ItemGroup> |
||||
<MyCopyItem Include="$(OutputPath)\..\..\Misc\TextTemplating\TextTemplating.dll" /> |
||||
</ItemGroup> |
||||
<Target Name="MyPostBuildTarget"> |
||||
<Copy SourceFiles="@(MyCopyItem)" DestinationFolder="$(OutputPath)" /> |
||||
</Target> |
||||
</Project> |
||||
@ -0,0 +1,40 @@
@@ -0,0 +1,40 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
|
||||
namespace ICSharpCode.AspNet.Mvc |
||||
{ |
||||
public class AddMvcViewToProjectCommand : AbstractCommand |
||||
{ |
||||
public override void Run() |
||||
{ |
||||
IAddMvcItemToProjectView view = CreateView(); |
||||
view.DataContext = CreateDataContext(); |
||||
view.ShowDialog(); |
||||
} |
||||
|
||||
protected virtual IAddMvcItemToProjectView CreateView() |
||||
{ |
||||
return new AddMvcViewToProjectView() { |
||||
Owner = WorkbenchSingleton.MainWindow |
||||
}; |
||||
} |
||||
|
||||
protected virtual object CreateDataContext() |
||||
{ |
||||
SelectedMvcViewFolder selectedFolder = GetSelectedFolder(); |
||||
var generator = new MvcViewFileGenerator(); |
||||
return new AddMvcViewToProjectViewModel(selectedFolder, generator); |
||||
} |
||||
|
||||
SelectedMvcViewFolder GetSelectedFolder() |
||||
{ |
||||
var directoryNode = Owner as DirectoryNode; |
||||
return new SelectedMvcViewFolder(directoryNode); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,56 @@
@@ -0,0 +1,56 @@
|
||||
<Window |
||||
x:Class="ICSharpCode.AspNet.Mvc.AddMvcViewToProjectView" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:core="http://icsharpcode.net/sharpdevelop/core" |
||||
xmlns:mvc="clr-namespace:ICSharpCode.AspNet.Mvc" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
Title="Add View" |
||||
Style="{x:Static core:GlobalStyles.DialogWindowStyle}" |
||||
mvc:CloseWindowBehaviour.IsClosed="{Binding IsClosed}" |
||||
WindowStartupLocation="CenterOwner" |
||||
FocusManager.FocusedElement="{Binding ElementName=ViewNameTextBox}" |
||||
Height="400" |
||||
Width="400"> |
||||
|
||||
<Window.Resources> |
||||
<Style TargetType="Button" BasedOn="{x:Static core:GlobalStyles.ButtonStyle}"/> |
||||
</Window.Resources> |
||||
|
||||
<Grid> |
||||
<Grid.RowDefinitions> |
||||
<RowDefinition Height="Auto"/> |
||||
<RowDefinition Height="*"/> |
||||
<RowDefinition Height="Auto"/> |
||||
</Grid.RowDefinitions> |
||||
|
||||
<Grid> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto"/> |
||||
<ColumnDefinition Width="*"/> |
||||
</Grid.ColumnDefinitions> |
||||
|
||||
<TextBlock |
||||
Margin="4" |
||||
FontWeight="Bold" |
||||
Text="View Name:"/> |
||||
<TextBox |
||||
x:Name="ViewNameTextBox" |
||||
Grid.Column="1" |
||||
Text="{Binding Path=ViewName}"/> |
||||
</Grid> |
||||
|
||||
<StackPanel |
||||
Orientation="Horizontal" |
||||
HorizontalAlignment="Right" |
||||
Margin="4" |
||||
Grid.Row="2"> |
||||
<Button |
||||
Content="_Add" |
||||
IsDefault="True" |
||||
Command="{Binding Path=AddMvcViewCommand}"/> |
||||
<Button |
||||
Content="_Cancel" |
||||
IsCancel="True"/> |
||||
</StackPanel> |
||||
</Grid> |
||||
</Window> |
||||
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Windows; |
||||
|
||||
namespace ICSharpCode.AspNet.Mvc |
||||
{ |
||||
public partial class AddMvcViewToProjectView : Window, IAddMvcItemToProjectView |
||||
{ |
||||
public AddMvcViewToProjectView() |
||||
{ |
||||
InitializeComponent(); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,80 @@
@@ -0,0 +1,80 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.IO; |
||||
using System.Windows.Input; |
||||
|
||||
namespace ICSharpCode.AspNet.Mvc |
||||
{ |
||||
public class AddMvcViewToProjectViewModel : ViewModelBase<AddMvcViewToProjectViewModel> |
||||
{ |
||||
IMvcViewFileGenerator viewGenerator; |
||||
ISelectedMvcViewFolder selectedViewFolder; |
||||
MvcViewFileName viewFileName = new MvcViewFileName(); |
||||
bool closed; |
||||
|
||||
public AddMvcViewToProjectViewModel( |
||||
ISelectedMvcViewFolder selectedViewFolder, |
||||
IMvcViewFileGenerator viewGenerator) |
||||
{ |
||||
this.selectedViewFolder = selectedViewFolder; |
||||
this.viewGenerator = viewGenerator; |
||||
this.viewFileName.ViewFolder = selectedViewFolder.Path; |
||||
|
||||
CreateCommands(); |
||||
} |
||||
|
||||
void CreateCommands() |
||||
{ |
||||
AddMvcViewCommand = new DelegateCommand(param => AddMvcView()); |
||||
} |
||||
|
||||
public ICommand AddMvcViewCommand { get; private set; } |
||||
|
||||
public string ViewName { |
||||
get { return viewFileName.ViewName; } |
||||
set { viewFileName.ViewName = value; } |
||||
} |
||||
|
||||
public bool IsClosed { |
||||
get { return closed; } |
||||
set { |
||||
closed = value; |
||||
OnPropertyChanged(viewModel => viewModel.IsClosed); |
||||
} |
||||
} |
||||
|
||||
public void AddMvcView() |
||||
{ |
||||
GenerateMvcViewFile(); |
||||
AddMvcViewFileToProject(); |
||||
IsClosed = true; |
||||
} |
||||
|
||||
void GenerateMvcViewFile() |
||||
{ |
||||
ConfigureMvcViewGenerator(); |
||||
viewGenerator.GenerateView(viewFileName); |
||||
} |
||||
|
||||
void ConfigureMvcViewGenerator() |
||||
{ |
||||
viewGenerator.Language = GetTemplateLanguage(); |
||||
viewGenerator.Project = selectedViewFolder.Project; |
||||
} |
||||
|
||||
MvcTextTemplateLanguage GetTemplateLanguage() |
||||
{ |
||||
string language = selectedViewFolder.Project.Language; |
||||
return MvcTextTemplateLanguageConverter.Convert(language); |
||||
} |
||||
|
||||
void AddMvcViewFileToProject() |
||||
{ |
||||
string fileName = viewFileName.GetFileName(); |
||||
selectedViewFolder.AddFileToProject(fileName); |
||||
} |
||||
} |
||||
} |
||||
|
||||
@ -0,0 +1,34 @@
@@ -0,0 +1,34 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Windows; |
||||
|
||||
namespace ICSharpCode.AspNet.Mvc |
||||
{ |
||||
public static class CloseWindowBehaviour |
||||
{ |
||||
public static readonly DependencyProperty IsClosedProperty = |
||||
DependencyProperty.RegisterAttached( |
||||
"IsClosed", |
||||
typeof(bool), |
||||
typeof(CloseWindowBehaviour), |
||||
new UIPropertyMetadata(false, OnIsClosedChanged)); |
||||
|
||||
public static bool GetIsClosed(Window window) |
||||
{ |
||||
return (bool)window.GetValue(IsClosedProperty); |
||||
} |
||||
|
||||
public static void SetIsClosed(Window window, bool value) |
||||
{ |
||||
window.SetValue(IsClosedProperty, value); |
||||
} |
||||
|
||||
static void OnIsClosedChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e) |
||||
{ |
||||
var window = dependencyObject as Window; |
||||
window.DialogResult = (bool)e.NewValue; |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,43 @@
@@ -0,0 +1,43 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Windows.Input; |
||||
|
||||
namespace ICSharpCode.AspNet.Mvc |
||||
{ |
||||
public class DelegateCommand : ICommand |
||||
{ |
||||
Action<object> execute; |
||||
Predicate<object> canExecute; |
||||
|
||||
public DelegateCommand(Action<object> execute, Predicate<object> canExecute) |
||||
{ |
||||
this.execute = execute; |
||||
this.canExecute = canExecute; |
||||
} |
||||
|
||||
public DelegateCommand(Action<object> execute) |
||||
: this(execute, null) |
||||
{ |
||||
} |
||||
|
||||
public event EventHandler CanExecuteChanged { |
||||
add { CommandManager.RequerySuggested += value; } |
||||
remove { CommandManager.RequerySuggested -= value; } |
||||
} |
||||
|
||||
public void Execute(object parameter) |
||||
{ |
||||
execute(parameter); |
||||
} |
||||
|
||||
public bool CanExecute(object parameter) |
||||
{ |
||||
if (canExecute != null) { |
||||
return canExecute(parameter); |
||||
} |
||||
return true; |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,13 @@
@@ -0,0 +1,13 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
|
||||
namespace ICSharpCode.AspNet.Mvc |
||||
{ |
||||
public interface IAddMvcItemToProjectView |
||||
{ |
||||
bool? ShowDialog(); |
||||
object DataContext { get; set; } |
||||
} |
||||
} |
||||
@ -0,0 +1,15 @@
@@ -0,0 +1,15 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.TextTemplating; |
||||
|
||||
namespace ICSharpCode.AspNet.Mvc |
||||
{ |
||||
public interface IMvcTextTemplateHost : IDisposable |
||||
{ |
||||
string ViewName { get; set; } |
||||
|
||||
bool ProcessTemplate(string inputFile, string outputFile); |
||||
} |
||||
} |
||||
@ -0,0 +1,13 @@
@@ -0,0 +1,13 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
|
||||
namespace ICSharpCode.AspNet.Mvc |
||||
{ |
||||
public interface IMvcTextTemplateHostFactory |
||||
{ |
||||
IMvcTextTemplateHost CreateMvcTextTemplateHost(IProject project); |
||||
} |
||||
} |
||||
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
|
||||
namespace ICSharpCode.AspNet.Mvc |
||||
{ |
||||
public interface IMvcViewFileGenerator |
||||
{ |
||||
MvcTextTemplateLanguage Language { get; set; } |
||||
IProject Project { get; set; } |
||||
|
||||
void GenerateView(MvcViewFileName fileName); |
||||
} |
||||
} |
||||
@ -0,0 +1,20 @@
@@ -0,0 +1,20 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
|
||||
namespace ICSharpCode.AspNet.Mvc |
||||
{ |
||||
public interface ISelectedMvcViewFolder |
||||
{ |
||||
string Path { get; } |
||||
IProject Project { get; } |
||||
|
||||
/// <summary>
|
||||
/// Adds the file to the view folder.
|
||||
/// </summary>
|
||||
/// <param name="fileName">The filename should not have any path information</param>
|
||||
void AddFileToProject(string fileName); |
||||
} |
||||
} |
||||
@ -0,0 +1,18 @@
@@ -0,0 +1,18 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
|
||||
namespace ICSharpCode.AspNet.Mvc |
||||
{ |
||||
public class IsMvcViewFolderSelectedConditionEvaluator : IConditionEvaluator |
||||
{ |
||||
public bool IsValid(object owner, Condition condition) |
||||
{ |
||||
var directoryNode = owner as DirectoryNode; |
||||
return directoryNode != null; |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,34 @@
@@ -0,0 +1,34 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.TextTemplating; |
||||
|
||||
namespace ICSharpCode.AspNet.Mvc |
||||
{ |
||||
public class MvcTextTemplateHost : TextTemplatingHost, IMvcTextTemplateHost |
||||
{ |
||||
public MvcTextTemplateHost( |
||||
ITextTemplatingAppDomainFactory appDomainFactory, |
||||
ITextTemplatingAssemblyResolver assemblyResolver, |
||||
string applicationBase) |
||||
: base(appDomainFactory, assemblyResolver, applicationBase) |
||||
{ |
||||
AddAssemblyReferenceForMvcHost(); |
||||
AddImports(); |
||||
} |
||||
|
||||
void AddAssemblyReferenceForMvcHost() |
||||
{ |
||||
Refs.Add(GetType().Assembly.Location); |
||||
Refs.Add(typeof(TextTemplatingHost).Assembly.Location); |
||||
} |
||||
|
||||
void AddImports() |
||||
{ |
||||
Imports.Add("ICSharpCode.AspNet.Mvc"); |
||||
} |
||||
|
||||
public string ViewName { get; set; } |
||||
} |
||||
} |
||||
@ -0,0 +1,27 @@
@@ -0,0 +1,27 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.IO; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using ICSharpCode.TextTemplating; |
||||
|
||||
namespace ICSharpCode.AspNet.Mvc |
||||
{ |
||||
public class MvcTextTemplateHostFactory : IMvcTextTemplateHostFactory |
||||
{ |
||||
public IMvcTextTemplateHost CreateMvcTextTemplateHost(IProject project) |
||||
{ |
||||
var appDomainFactory = new TextTemplatingAppDomainFactory(); |
||||
string applicationBase = GetAssemblyBaseLocation(); |
||||
var assemblyResolver = new TextTemplatingAssemblyResolver(project); |
||||
return new MvcTextTemplateHost(appDomainFactory, assemblyResolver, applicationBase); |
||||
} |
||||
|
||||
string GetAssemblyBaseLocation() |
||||
{ |
||||
string location = GetType().Assembly.Location; |
||||
return Path.GetDirectoryName(location); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,13 @@
@@ -0,0 +1,13 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
|
||||
namespace ICSharpCode.AspNet.Mvc |
||||
{ |
||||
public enum MvcTextTemplateLanguage |
||||
{ |
||||
CSharp, |
||||
VisualBasic |
||||
} |
||||
} |
||||
@ -0,0 +1,22 @@
@@ -0,0 +1,22 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
|
||||
namespace ICSharpCode.AspNet.Mvc |
||||
{ |
||||
public static class MvcTextTemplateLanguageConverter |
||||
{ |
||||
/// <summary>
|
||||
/// Converts from an IProject.Language string to an MvcTemplateLanguage. Only C# and VB.NET languages
|
||||
/// are supported.
|
||||
/// </summary>
|
||||
public static MvcTextTemplateLanguage Convert(string language) |
||||
{ |
||||
if (language == "VBNet") { |
||||
return MvcTextTemplateLanguage.VisualBasic; |
||||
} |
||||
return MvcTextTemplateLanguage.CSharp; |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,37 @@
@@ -0,0 +1,37 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.IO; |
||||
using ICSharpCode.Core; |
||||
|
||||
namespace ICSharpCode.AspNet.Mvc |
||||
{ |
||||
public class MvcTextTemplateRepository |
||||
{ |
||||
string textTemplatesRootDirectory; |
||||
|
||||
public MvcTextTemplateRepository(string mvcAddInPath) |
||||
{ |
||||
GetTextTemplatesRootDirectory(mvcAddInPath); |
||||
} |
||||
|
||||
public MvcTextTemplateRepository() |
||||
: this(StringParser.GetValue("addinpath:ICSharpCode.AspNet.Mvc")) |
||||
{ |
||||
} |
||||
|
||||
void GetTextTemplatesRootDirectory(string mvcAddInPath) |
||||
{ |
||||
this.textTemplatesRootDirectory = Path.Combine(mvcAddInPath, "ItemTemplates"); |
||||
} |
||||
|
||||
public string GetMvcViewTextTemplateFileName( |
||||
MvcTextTemplateLanguage language, |
||||
string templateName) |
||||
{ |
||||
var fileName = new MvcViewTextTemplateFileName(textTemplatesRootDirectory, language, templateName); |
||||
return fileName.GetPath(); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,62 @@
@@ -0,0 +1,62 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
|
||||
namespace ICSharpCode.AspNet.Mvc |
||||
{ |
||||
public class MvcViewFileGenerator : IMvcViewFileGenerator |
||||
{ |
||||
IMvcTextTemplateHostFactory hostFactory; |
||||
MvcTextTemplateRepository textTemplateRepository; |
||||
|
||||
public MvcViewFileGenerator() |
||||
: this( |
||||
new MvcTextTemplateHostFactory(), |
||||
new MvcTextTemplateRepository()) |
||||
{ |
||||
} |
||||
|
||||
public MvcViewFileGenerator( |
||||
IMvcTextTemplateHostFactory hostFactory, |
||||
MvcTextTemplateRepository textTemplateRepository) |
||||
{ |
||||
this.hostFactory = hostFactory; |
||||
this.textTemplateRepository = textTemplateRepository; |
||||
} |
||||
|
||||
public MvcTextTemplateLanguage Language { get; set; } |
||||
public IProject Project { get; set; } |
||||
|
||||
public void GenerateView(MvcViewFileName fileName) |
||||
{ |
||||
using (IMvcTextTemplateHost host = CreateHost()) { |
||||
GenerateView(host, fileName); |
||||
} |
||||
} |
||||
|
||||
IMvcTextTemplateHost CreateHost() |
||||
{ |
||||
return hostFactory.CreateMvcTextTemplateHost(Project); |
||||
} |
||||
|
||||
void GenerateView(IMvcTextTemplateHost host, MvcViewFileName fileName) |
||||
{ |
||||
ConfigureHost(host, fileName); |
||||
string templateFileName = GetTextTemplateFileName(); |
||||
string outputViewFileName = fileName.GetPath(); |
||||
host.ProcessTemplate(templateFileName, outputViewFileName); |
||||
} |
||||
|
||||
void ConfigureHost(IMvcTextTemplateHost host, MvcViewFileName fileName) |
||||
{ |
||||
host.ViewName = fileName.ViewName; |
||||
} |
||||
|
||||
string GetTextTemplateFileName() |
||||
{ |
||||
return textTemplateRepository.GetMvcViewTextTemplateFileName(Language, "Empty"); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,73 @@
@@ -0,0 +1,73 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.IO; |
||||
|
||||
namespace ICSharpCode.AspNet.Mvc |
||||
{ |
||||
public class MvcViewFileName |
||||
{ |
||||
string viewName = String.Empty; |
||||
string viewFolder = String.Empty; |
||||
|
||||
public string ViewName { |
||||
get { |
||||
EnsureViewNameIsNotNull(); |
||||
return viewName; |
||||
} |
||||
set { viewName = value; } |
||||
} |
||||
|
||||
void EnsureViewNameIsNotNull() |
||||
{ |
||||
viewName = ConvertToEmptyStringIfNull(viewName); |
||||
} |
||||
|
||||
static string ConvertToEmptyStringIfNull(string text) |
||||
{ |
||||
if (text != null) { |
||||
return text; |
||||
} |
||||
return String.Empty; |
||||
} |
||||
|
||||
public string ViewFolder { |
||||
get { |
||||
EnsureViewFolderIsNotNull(); |
||||
return viewFolder; |
||||
} |
||||
set { viewFolder = value; } |
||||
} |
||||
|
||||
void EnsureViewFolderIsNotNull() |
||||
{ |
||||
viewFolder = ConvertToEmptyStringIfNull(viewFolder); |
||||
} |
||||
|
||||
public override string ToString() |
||||
{ |
||||
return GetPath(); |
||||
} |
||||
|
||||
public string GetPath() |
||||
{ |
||||
string fileName = GetFileName(); |
||||
return Path.Combine(ViewFolder, fileName); |
||||
} |
||||
|
||||
public string GetFileName() |
||||
{ |
||||
string viewName = GetViewName(); |
||||
return viewName + ".aspx"; |
||||
} |
||||
|
||||
string GetViewName() |
||||
{ |
||||
if (viewName != null) { |
||||
return viewName; |
||||
} |
||||
return "View1"; |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,48 @@
@@ -0,0 +1,48 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.IO; |
||||
|
||||
namespace ICSharpCode.AspNet.Mvc |
||||
{ |
||||
public class MvcViewTextTemplateFileName |
||||
{ |
||||
string textTemplatesRootDirectory; |
||||
MvcTextTemplateLanguage language; |
||||
string templateName; |
||||
|
||||
public MvcViewTextTemplateFileName( |
||||
string textTemplatesRootDirectory, |
||||
MvcTextTemplateLanguage language, |
||||
string templateName) |
||||
{ |
||||
this.textTemplatesRootDirectory = textTemplatesRootDirectory; |
||||
this.language = language; |
||||
this.templateName = templateName; |
||||
} |
||||
|
||||
public string GetPath() |
||||
{ |
||||
string fileName = GetTemplateFileName(); |
||||
string directory = GetTemplateDirectory(language); |
||||
return Path.Combine(directory, fileName); |
||||
} |
||||
|
||||
string GetTemplateFileName() |
||||
{ |
||||
return templateName + ".tt"; |
||||
} |
||||
|
||||
string GetTemplateDirectory(MvcTextTemplateLanguage language) |
||||
{ |
||||
string languageSubdirectory = GetLanguageSubdirectory(language); |
||||
return Path.Combine(textTemplatesRootDirectory, languageSubdirectory); |
||||
} |
||||
|
||||
string GetLanguageSubdirectory(MvcTextTemplateLanguage language) |
||||
{ |
||||
return String.Format("{0}\\CodeTemplates\\AddView\\Aspx{0}", language.ToString()); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,48 @@
@@ -0,0 +1,48 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
|
||||
namespace ICSharpCode.AspNet.Mvc |
||||
{ |
||||
public class SelectedMvcViewFolder : ISelectedMvcViewFolder |
||||
{ |
||||
DirectoryNode directoryNode; |
||||
|
||||
public SelectedMvcViewFolder(DirectoryNode directoryNode) |
||||
{ |
||||
this.directoryNode = directoryNode; |
||||
} |
||||
|
||||
public SelectedMvcViewFolder() |
||||
: this(ProjectBrowserPad.Instance.SelectedNode as DirectoryNode) |
||||
{ |
||||
} |
||||
|
||||
public string Path { |
||||
get { return directoryNode.Directory; } |
||||
} |
||||
|
||||
public IProject Project { |
||||
get { return directoryNode.Project; } |
||||
} |
||||
|
||||
public void AddFileToProject(string fileName) |
||||
{ |
||||
string fullPath = System.IO.Path.Combine(Path, fileName); |
||||
AddNewFileToDirectoryNode(fullPath); |
||||
SaveProject(); |
||||
} |
||||
|
||||
protected virtual void AddNewFileToDirectoryNode(string path) |
||||
{ |
||||
directoryNode.AddNewFile(path); |
||||
} |
||||
|
||||
void SaveProject() |
||||
{ |
||||
directoryNode.Project.Save(); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,41 @@
@@ -0,0 +1,41 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.ComponentModel; |
||||
using System.Linq.Expressions; |
||||
|
||||
namespace ICSharpCode.AspNet.Mvc |
||||
{ |
||||
public abstract class ViewModelBase<TModel> : INotifyPropertyChanged |
||||
{ |
||||
public event PropertyChangedEventHandler PropertyChanged; |
||||
|
||||
public string PropertyChangedFor<TProperty>(Expression<Func<TModel, TProperty>> expression) |
||||
{ |
||||
MemberExpression memberExpression = expression.Body as MemberExpression; |
||||
return PropertyChangedFor(memberExpression); |
||||
} |
||||
|
||||
string PropertyChangedFor(MemberExpression memberExpression) |
||||
{ |
||||
if (memberExpression != null) { |
||||
return memberExpression.Member.Name; |
||||
} |
||||
return String.Empty; |
||||
} |
||||
|
||||
protected void OnPropertyChanged<TProperty>(Expression<Func<TModel, TProperty>> expression) |
||||
{ |
||||
string propertyName = PropertyChangedFor(expression); |
||||
OnPropertyChanged(propertyName); |
||||
} |
||||
|
||||
protected void OnPropertyChanged(string propertyName) |
||||
{ |
||||
if (PropertyChanged != null) { |
||||
PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,89 @@
@@ -0,0 +1,89 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build"> |
||||
<PropertyGroup> |
||||
<ProjectGuid>{0B12A079-B2DB-42B9-8A8E-AA5CBC2B3225}</ProjectGuid> |
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform> |
||||
<OutputType>Library</OutputType> |
||||
<RootNamespace>AspNet.Mvc.Tests</RootNamespace> |
||||
<AssemblyName>AspNet.Mvc.Tests</AssemblyName> |
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> |
||||
<AppDesignerFolder>Properties</AppDesignerFolder> |
||||
<OutputPath>..\..\..\..\..\bin\UnitTests\</OutputPath> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Platform)' == 'x86' "> |
||||
<PlatformTarget>x86</PlatformTarget> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> |
||||
<DebugSymbols>True</DebugSymbols> |
||||
<DebugType>Full</DebugType> |
||||
<Optimize>False</Optimize> |
||||
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> |
||||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> |
||||
<DebugSymbols>False</DebugSymbols> |
||||
<DebugType>None</DebugType> |
||||
<Optimize>True</Optimize> |
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> |
||||
<DefineConstants>TRACE</DefineConstants> |
||||
</PropertyGroup> |
||||
<ItemGroup> |
||||
<Reference Include="nunit.framework"> |
||||
<HintPath>..\..\..\..\Tools\NUnit\nunit.framework.dll</HintPath> |
||||
</Reference> |
||||
<Reference Include="PresentationCore"> |
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System" /> |
||||
<Reference Include="System.Windows.Forms" /> |
||||
<Reference Include="System.Xml" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Compile Include="..\..\..\..\Main\GlobalAssemblyInfo.cs"> |
||||
<Link>Configuration\GlobalAssemblyInfo.cs</Link> |
||||
</Compile> |
||||
<Compile Include="Helpers\FakeAddMvcItemToProjectView.cs" /> |
||||
<Compile Include="Helpers\FakeMvcTextTemplateHost.cs" /> |
||||
<Compile Include="Helpers\FakeMvcTextTemplateHostFactory.cs" /> |
||||
<Compile Include="Helpers\FakeMvcViewFileGenerator.cs" /> |
||||
<Compile Include="Helpers\FakeSelectedMvcViewFolder.cs" /> |
||||
<Compile Include="Helpers\TestableAddMvcViewToProjectCommand.cs" /> |
||||
<Compile Include="Helpers\TestableProject.cs" /> |
||||
<Compile Include="Helpers\TestableSelectedMvcViewFolder.cs" /> |
||||
<Compile Include="Src\AddMvcViewToProjectCommandTests.cs" /> |
||||
<Compile Include="Src\AddMvcViewToProjectViewModelTests.cs" /> |
||||
<Compile Include="Src\IsMvcViewFolderSelectedConditionTests.cs" /> |
||||
<Compile Include="Configuration\AssemblyInfo.cs" /> |
||||
<Compile Include="Src\MvcTextTemplateRepositoryTests.cs" /> |
||||
<Compile Include="Src\MvcViewFileNameTests.cs" /> |
||||
<Compile Include="Src\MvcViewFileGeneratorTests.cs" /> |
||||
<Compile Include="Src\SelectedMvcViewFolderTests.cs" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<ProjectReference Include="..\..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj"> |
||||
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project> |
||||
<Name>ICSharpCode.SharpDevelop</Name> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\..\..\..\Main\Core\Project\ICSharpCode.Core.csproj"> |
||||
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project> |
||||
<Name>ICSharpCode.Core</Name> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\..\..\..\Main\ICSharpCode.SharpDevelop.Dom\Project\ICSharpCode.SharpDevelop.Dom.csproj"> |
||||
<Project>{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}</Project> |
||||
<Name>ICSharpCode.SharpDevelop.Dom</Name> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\..\..\Misc\TextTemplating\Project\TextTemplating.csproj"> |
||||
<Project>{B5D8C3E6-42EC-4D4B-AD05-3644B32563EF}</Project> |
||||
<Name>TextTemplating</Name> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\Project\AspNet.Mvc.csproj"> |
||||
<Project>{D781721F-C2A7-4E95-B76F-247170AC3B13}</Project> |
||||
<Name>AspNet.Mvc</Name> |
||||
</ProjectReference> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Folder Include="Helpers" /> |
||||
</ItemGroup> |
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> |
||||
</Project> |
||||
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System.Reflection; |
||||
|
||||
// Information about this assembly is defined by the following
|
||||
// attributes.
|
||||
//
|
||||
// change them to the information which is associated with the assembly
|
||||
// you compile.
|
||||
|
||||
[assembly: AssemblyTitle("AspNet.Mvc.Tests")] |
||||
[assembly: AssemblyDescription("ASP.NET MVC support SharpDevelop")] |
||||
[assembly: AssemblyConfiguration("")] |
||||
[assembly: AssemblyTrademark("")] |
||||
[assembly: AssemblyCulture("")] |
||||
@ -0,0 +1,21 @@
@@ -0,0 +1,21 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.AspNet.Mvc; |
||||
|
||||
namespace AspNet.Mvc.Tests.Helpers |
||||
{ |
||||
public class FakeAddMvcItemToProjectView : IAddMvcItemToProjectView |
||||
{ |
||||
public bool IsShowDialogCalled; |
||||
|
||||
public bool? ShowDialog() |
||||
{ |
||||
IsShowDialogCalled = true; |
||||
return true; |
||||
} |
||||
|
||||
public object DataContext { get; set; } |
||||
} |
||||
} |
||||
@ -0,0 +1,31 @@
@@ -0,0 +1,31 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.AspNet.Mvc; |
||||
|
||||
namespace AspNet.Mvc.Tests.Helpers |
||||
{ |
||||
public class FakeMvcTextTemplateHost : IMvcTextTemplateHost |
||||
{ |
||||
public bool ProcessTemplateReturnValue = true; |
||||
public string InputFilePassedToProcessTemplate; |
||||
public string OutputFilePassedToProcessTemplate; |
||||
|
||||
public bool ProcessTemplate(string inputFile, string outputFile) |
||||
{ |
||||
InputFilePassedToProcessTemplate = inputFile; |
||||
OutputFilePassedToProcessTemplate = outputFile; |
||||
return ProcessTemplateReturnValue; |
||||
} |
||||
|
||||
public bool IsDisposed; |
||||
|
||||
public void Dispose() |
||||
{ |
||||
IsDisposed = true; |
||||
} |
||||
|
||||
public string ViewName { get; set; } |
||||
} |
||||
} |
||||
@ -0,0 +1,21 @@
@@ -0,0 +1,21 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.AspNet.Mvc; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
|
||||
namespace AspNet.Mvc.Tests.Helpers |
||||
{ |
||||
public class FakeMvcTextTemplateHostFactory : IMvcTextTemplateHostFactory |
||||
{ |
||||
public IProject ProjectPassedToCreateMvcTextTemplateHost; |
||||
public FakeMvcTextTemplateHost FakeMvcTextTemplateHost = new FakeMvcTextTemplateHost(); |
||||
|
||||
public IMvcTextTemplateHost CreateMvcTextTemplateHost(IProject project) |
||||
{ |
||||
ProjectPassedToCreateMvcTextTemplateHost = project; |
||||
return FakeMvcTextTemplateHost; |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,24 @@
@@ -0,0 +1,24 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.AspNet.Mvc; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
|
||||
namespace AspNet.Mvc.Tests.Helpers |
||||
{ |
||||
public class FakeMvcViewFileGenerator : IMvcViewFileGenerator |
||||
{ |
||||
public MvcTextTemplateLanguage Language { get; set; } |
||||
public IProject Project { get; set; } |
||||
|
||||
public bool IsGenerateViewCalled; |
||||
public MvcViewFileName FileNamePassedToGenerateView; |
||||
|
||||
public void GenerateView(MvcViewFileName fileName) |
||||
{ |
||||
FileNamePassedToGenerateView = fileName; |
||||
IsGenerateViewCalled = true; |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,32 @@
@@ -0,0 +1,32 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.AspNet.Mvc; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
|
||||
namespace AspNet.Mvc.Tests.Helpers |
||||
{ |
||||
public class FakeSelectedMvcViewFolder : ISelectedMvcViewFolder |
||||
{ |
||||
public string Path { get; set; } |
||||
|
||||
public string ProjectLanguage { |
||||
get { return FakeProject.Language; } |
||||
set { FakeProject.SetLanguage(value); } |
||||
} |
||||
|
||||
public TestableProject FakeProject = TestableProject.CreateProject(); |
||||
|
||||
public IProject Project { |
||||
get { return FakeProject; } |
||||
} |
||||
|
||||
public string FileNamePassedToAddFile; |
||||
|
||||
public void AddFileToProject(string fileName) |
||||
{ |
||||
FileNamePassedToAddFile = fileName; |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,25 @@
@@ -0,0 +1,25 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.AspNet.Mvc; |
||||
|
||||
namespace AspNet.Mvc.Tests.Helpers |
||||
{ |
||||
public class TestableAddMvcViewToProjectCommand : AddMvcViewToProjectCommand |
||||
{ |
||||
public FakeAddMvcItemToProjectView FakeAddMvcViewToProjectView = new FakeAddMvcItemToProjectView(); |
||||
|
||||
protected override IAddMvcItemToProjectView CreateView() |
||||
{ |
||||
return FakeAddMvcViewToProjectView; |
||||
} |
||||
|
||||
public object FakeDataContext { get; set; } |
||||
|
||||
protected override object CreateDataContext() |
||||
{ |
||||
return FakeDataContext; |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,49 @@
@@ -0,0 +1,49 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.SharpDevelop.Internal.Templates; |
||||
using Dom = ICSharpCode.SharpDevelop.Dom; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
|
||||
namespace AspNet.Mvc.Tests.Helpers |
||||
{ |
||||
public class TestableProject : CompilableProject |
||||
{ |
||||
string language = "C#"; |
||||
|
||||
public TestableProject(ProjectCreateInformation createInfo) |
||||
: base(createInfo) |
||||
{ |
||||
} |
||||
|
||||
public static TestableProject CreateProject() |
||||
{ |
||||
var createInfo = new ProjectCreateInformation(); |
||||
createInfo.Solution = new Solution(); |
||||
createInfo.OutputProjectFileName = @"d:\projects\MyProject\MyProject.csproj"; |
||||
return new TestableProject(createInfo); |
||||
} |
||||
|
||||
public override LanguageProperties LanguageProperties { |
||||
get { return Dom.LanguageProperties.CSharp; } |
||||
} |
||||
|
||||
public override string Language { |
||||
get { return language; } |
||||
} |
||||
|
||||
public void SetLanguage(string language) |
||||
{ |
||||
this.language = language; |
||||
} |
||||
|
||||
public bool IsSaved; |
||||
|
||||
public override void Save(string fileName) |
||||
{ |
||||
IsSaved = true; |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,24 @@
@@ -0,0 +1,24 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.AspNet.Mvc; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
|
||||
namespace AspNet.Mvc.Tests.Helpers |
||||
{ |
||||
public class TestableSelectedMvcViewFolder : SelectedMvcViewFolder |
||||
{ |
||||
public TestableSelectedMvcViewFolder(DirectoryNode directoryNode) |
||||
: base(directoryNode) |
||||
{ |
||||
} |
||||
|
||||
public string PathPassedToAddNewFileToDirectoryNode; |
||||
|
||||
protected override void AddNewFileToDirectoryNode(string path) |
||||
{ |
||||
PathPassedToAddNewFileToDirectoryNode = path; |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,44 @@
@@ -0,0 +1,44 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using AspNet.Mvc.Tests.Helpers; |
||||
using NUnit.Framework; |
||||
|
||||
namespace AspNet.Mvc.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class AddMvcViewToProjectCommandTests |
||||
{ |
||||
TestableAddMvcViewToProjectCommand command; |
||||
FakeAddMvcItemToProjectView fakeView; |
||||
|
||||
void CreateCommand() |
||||
{ |
||||
command = new TestableAddMvcViewToProjectCommand(); |
||||
fakeView = command.FakeAddMvcViewToProjectView; |
||||
} |
||||
|
||||
[Test] |
||||
public void Run_CommandExecuted_ViewIsDisplayed() |
||||
{ |
||||
CreateCommand(); |
||||
command.Run(); |
||||
|
||||
Assert.IsTrue(fakeView.IsShowDialogCalled); |
||||
} |
||||
|
||||
[Test] |
||||
public void Run_CommandExecuted_ViewDataContextIsSet() |
||||
{ |
||||
CreateCommand(); |
||||
object expectedDataContext = new object(); |
||||
command.FakeDataContext = expectedDataContext; |
||||
command.Run(); |
||||
|
||||
object dataContext = fakeView.DataContext; |
||||
|
||||
Assert.AreEqual(expectedDataContext, dataContext); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,153 @@
@@ -0,0 +1,153 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using AspNet.Mvc.Tests.Helpers; |
||||
using ICSharpCode.AspNet.Mvc; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using NUnit.Framework; |
||||
|
||||
namespace AspNet.Mvc.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class AddMvcViewToProjectViewModelTests |
||||
{ |
||||
AddMvcViewToProjectViewModel viewModel; |
||||
FakeMvcViewFileGenerator fakeViewGenerator; |
||||
FakeSelectedMvcViewFolder fakeSelectedMvcViewFolder; |
||||
List<string> propertyChangedEvents; |
||||
|
||||
void CreateViewModel() |
||||
{ |
||||
string path = @"d:\projects\MyAspMvcProject\Views\Home"; |
||||
CreateViewModelWithViewFolderPath(path); |
||||
} |
||||
|
||||
void CreateViewModelWithViewFolderPath(string path) |
||||
{ |
||||
fakeSelectedMvcViewFolder = new FakeSelectedMvcViewFolder(); |
||||
fakeSelectedMvcViewFolder.Path = path; |
||||
fakeViewGenerator = new FakeMvcViewFileGenerator(); |
||||
viewModel = new AddMvcViewToProjectViewModel( |
||||
fakeSelectedMvcViewFolder, |
||||
fakeViewGenerator); |
||||
} |
||||
|
||||
void MonitorPropertyChangedEvents() |
||||
{ |
||||
propertyChangedEvents = new List<string>(); |
||||
viewModel.PropertyChanged += (source, e) => propertyChangedEvents.Add(e.PropertyName); |
||||
} |
||||
|
||||
[Test] |
||||
public void AddMvcViewCommand_ExecutedWhenViewNameSpecified_MvcViewIsGenerated() |
||||
{ |
||||
CreateViewModel(); |
||||
viewModel.ViewName = "MyViewPage"; |
||||
viewModel.AddMvcViewCommand.Execute(null); |
||||
|
||||
bool generated = fakeViewGenerator.IsGenerateViewCalled; |
||||
|
||||
Assert.IsTrue(generated); |
||||
} |
||||
|
||||
[Test] |
||||
public void AddMvcView_ViewNameAndViewFolderSpecified_ViewFullPathUsedToGenerateFile() |
||||
{ |
||||
CreateViewModelWithViewFolderPath(@"d:\projects\MyProject\Views\Home"); |
||||
viewModel.ViewName = "Index"; |
||||
viewModel.AddMvcView(); |
||||
|
||||
MvcViewFileName viewFileName = fakeViewGenerator.FileNamePassedToGenerateView; |
||||
string fileName = viewFileName.GetPath(); |
||||
string expectedFileName = @"d:\projects\MyProject\Views\Home\Index.aspx"; |
||||
|
||||
Assert.AreEqual(expectedFileName, fileName); |
||||
} |
||||
|
||||
[Test] |
||||
public void AddMvcView_SelectedViewFolderIsInVisualBasicProject_VisualBasicMvcViewFileGenerated() |
||||
{ |
||||
CreateViewModel(); |
||||
fakeSelectedMvcViewFolder.ProjectLanguage = "VBNet"; |
||||
viewModel.AddMvcView(); |
||||
|
||||
MvcTextTemplateLanguage templateLanguage = fakeViewGenerator.Language; |
||||
|
||||
Assert.AreEqual(MvcTextTemplateLanguage.VisualBasic, templateLanguage); |
||||
} |
||||
|
||||
[Test] |
||||
public void AddMvcView_SelectedViewFolderIsInCSharpProject_CSharpMvcViewFileGenerated() |
||||
{ |
||||
CreateViewModel(); |
||||
fakeSelectedMvcViewFolder.ProjectLanguage = "C#"; |
||||
viewModel.AddMvcView(); |
||||
|
||||
MvcTextTemplateLanguage templateLanguage = fakeViewGenerator.Language; |
||||
|
||||
Assert.AreEqual(MvcTextTemplateLanguage.CSharp, templateLanguage); |
||||
} |
||||
|
||||
[Test] |
||||
public void AddMvcView_SelectedViewFolderIsInVisualBasicProject_VisualBasicProjectIsPassedToMvcViewGenerator() |
||||
{ |
||||
CreateViewModel(); |
||||
fakeSelectedMvcViewFolder.ProjectLanguage = "VBNet"; |
||||
viewModel.AddMvcView(); |
||||
|
||||
IProject project = fakeViewGenerator.Project; |
||||
TestableProject expectedProject = fakeSelectedMvcViewFolder.FakeProject; |
||||
|
||||
Assert.AreEqual(expectedProject, project); |
||||
} |
||||
|
||||
[Test] |
||||
public void AddMvcView_FileIsGenerated_FileIsAddedToProject() |
||||
{ |
||||
CreateViewModel(); |
||||
viewModel.ViewName = "Index"; |
||||
fakeSelectedMvcViewFolder.ProjectLanguage = "C#"; |
||||
fakeSelectedMvcViewFolder.Path = @"d:\projects\MyAspMvcProject\Views\Home"; |
||||
viewModel.AddMvcView(); |
||||
|
||||
string fileAddedToProject = fakeSelectedMvcViewFolder.FileNamePassedToAddFile; |
||||
string expectedFileAddedToProject = "Index.aspx"; |
||||
|
||||
Assert.AreEqual(expectedFileAddedToProject, fileAddedToProject); |
||||
} |
||||
|
||||
[Test] |
||||
public void AddMvcView_FileIsGenerated_WindowIsClosed() |
||||
{ |
||||
CreateViewModel(); |
||||
viewModel.AddMvcView(); |
||||
|
||||
bool closed = viewModel.IsClosed; |
||||
|
||||
Assert.IsTrue(closed); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsClosed_MvcViewFileIsNotGenerated_ReturnsFalse() |
||||
{ |
||||
CreateViewModel(); |
||||
bool closed = viewModel.IsClosed; |
||||
|
||||
Assert.IsFalse(closed); |
||||
} |
||||
|
||||
[Test] |
||||
public void AddMvcView_FileIsGenerated_PropertyChangedEventIsFiredForIsClosedProperty() |
||||
{ |
||||
CreateViewModel(); |
||||
MonitorPropertyChangedEvents(); |
||||
viewModel.AddMvcView(); |
||||
|
||||
bool fired = propertyChangedEvents.Contains("IsClosed"); |
||||
|
||||
Assert.IsTrue(fired); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,51 @@
@@ -0,0 +1,51 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.AspNet.Mvc; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using NUnit.Framework; |
||||
|
||||
namespace AspNet.Mvc.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class IsMvcViewFolderSelectedConditionEvaluatorTests |
||||
{ |
||||
IsMvcViewFolderSelectedConditionEvaluator conditionEvaluator; |
||||
|
||||
void CreateConditionEvaluator() |
||||
{ |
||||
conditionEvaluator = new IsMvcViewFolderSelectedConditionEvaluator(); |
||||
} |
||||
|
||||
bool IsValid(object owner) |
||||
{ |
||||
CreateConditionEvaluator(); |
||||
return conditionEvaluator.IsValid(owner, null); |
||||
} |
||||
|
||||
DirectoryNode CreateViewsFolderNode() |
||||
{ |
||||
var node = new DirectoryNode("Views"); |
||||
return node; |
||||
} |
||||
|
||||
[Test] |
||||
public void IsValid_NullOwnerIsPassed_ReturnsFalse() |
||||
{ |
||||
bool valid = IsValid(owner: null); |
||||
|
||||
Assert.IsFalse(valid); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsValid_ViewsFolderNodePassed_ReturnsTrue() |
||||
{ |
||||
DirectoryNode owner = CreateViewsFolderNode(); |
||||
bool valid = IsValid(owner); |
||||
|
||||
Assert.IsTrue(valid); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,46 @@
@@ -0,0 +1,46 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.AspNet.Mvc; |
||||
using NUnit.Framework; |
||||
|
||||
namespace AspNet.Mvc.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class MvcTextTemplateRepositoryTests |
||||
{ |
||||
MvcTextTemplateRepository repository; |
||||
|
||||
void CreateRepositoryWithAspNetMvcAddInDirectory(string mvcAddInPath) |
||||
{ |
||||
repository = new MvcTextTemplateRepository(mvcAddInPath); |
||||
} |
||||
|
||||
[Test] |
||||
public void GetMvcViewTextTemplateFileName_CSharpEmptyTemplateRequested_ReturnsFileNameToCSharpEmptyTextTemplate() |
||||
{ |
||||
CreateRepositoryWithAspNetMvcAddInDirectory(@"C:\SD\AddIns\AspNet.Mvc"); |
||||
|
||||
string fileName = repository.GetMvcViewTextTemplateFileName(MvcTextTemplateLanguage.CSharp, "Empty"); |
||||
|
||||
string expectedFileName = |
||||
@"C:\SD\AddIns\AspNet.Mvc\ItemTemplates\CSharp\CodeTemplates\AddView\AspxCSharp\Empty.tt"; |
||||
|
||||
Assert.AreEqual(expectedFileName, fileName); |
||||
} |
||||
|
||||
[Test] |
||||
public void GetMvcViewTextTemplateFileName_VisualBasicEmptyTemplateRequested_ReturnsFileNameToVisualBasicEmptyTextTemplate() |
||||
{ |
||||
CreateRepositoryWithAspNetMvcAddInDirectory(@"C:\SD\AddIns\AspNet.Mvc"); |
||||
|
||||
string fileName = repository.GetMvcViewTextTemplateFileName(MvcTextTemplateLanguage.VisualBasic, "Empty"); |
||||
|
||||
string expectedFileName = |
||||
@"C:\SD\AddIns\AspNet.Mvc\ItemTemplates\VisualBasic\CodeTemplates\AddView\AspxVisualBasic\Empty.tt"; |
||||
|
||||
Assert.AreEqual(expectedFileName, fileName); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,135 @@
@@ -0,0 +1,135 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using AspNet.Mvc.Tests.Helpers; |
||||
using ICSharpCode.AspNet.Mvc; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using NUnit.Framework; |
||||
|
||||
namespace AspNet.Mvc.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class MvcViewFileGeneratorTests |
||||
{ |
||||
MvcViewFileGenerator generator; |
||||
TestableProject projectUsedByGenerator; |
||||
MvcTextTemplateRepository templateRepository; |
||||
FakeMvcTextTemplateHostFactory fakeHostFactory; |
||||
FakeMvcTextTemplateHost fakeHost; |
||||
|
||||
void CreateTemplateRepository(string templateRootDirectory) |
||||
{ |
||||
templateRepository = new MvcTextTemplateRepository(templateRootDirectory); |
||||
} |
||||
|
||||
void CreateGenerator() |
||||
{ |
||||
CreateTemplateRepository(@"d:\sd\addins\AspNet.Mvc"); |
||||
CreateGenerator(templateRepository); |
||||
} |
||||
|
||||
void CreateGenerator(MvcTextTemplateRepository templateRepository) |
||||
{ |
||||
fakeHostFactory = new FakeMvcTextTemplateHostFactory(); |
||||
fakeHost = fakeHostFactory.FakeMvcTextTemplateHost; |
||||
generator = new MvcViewFileGenerator(fakeHostFactory, templateRepository); |
||||
projectUsedByGenerator = TestableProject.CreateProject(); |
||||
generator.Project = projectUsedByGenerator; |
||||
ProjectPassedToGeneratorIsCSharpProject(); |
||||
} |
||||
|
||||
void ProjectPassedToGeneratorIsCSharpProject() |
||||
{ |
||||
projectUsedByGenerator.SetLanguage("C#"); |
||||
generator.Language = MvcTextTemplateLanguage.CSharp; |
||||
} |
||||
|
||||
void GenerateView() |
||||
{ |
||||
GenerateView(@"d:\projects\myproject\Views\Home", "Index"); |
||||
} |
||||
|
||||
void GenerateView(string folder, string name) |
||||
{ |
||||
var fileName = new MvcViewFileName(); |
||||
fileName.ViewFolder = folder; |
||||
fileName.ViewName = name; |
||||
GenerateView(fileName); |
||||
} |
||||
|
||||
void GenerateView(MvcViewFileName fileName) |
||||
{ |
||||
generator.GenerateView(fileName); |
||||
} |
||||
|
||||
[Test] |
||||
public void GenerateView_CSharpEmptyViewTemplate_MvcTextTemplateHostIsCreated() |
||||
{ |
||||
CreateGenerator(); |
||||
ProjectPassedToGeneratorIsCSharpProject(); |
||||
GenerateView(); |
||||
IProject project = fakeHostFactory.ProjectPassedToCreateMvcTextTemplateHost; |
||||
|
||||
Assert.AreEqual(projectUsedByGenerator, project); |
||||
} |
||||
|
||||
[Test] |
||||
public void GenerateView_CSharpEmptyViewTemplate_MvcTextTemplateHostIsDisposed() |
||||
{ |
||||
CreateGenerator(); |
||||
ProjectPassedToGeneratorIsCSharpProject(); |
||||
GenerateView(); |
||||
bool disposed = fakeHost.IsDisposed; |
||||
|
||||
Assert.IsTrue(disposed); |
||||
} |
||||
|
||||
[Test] |
||||
public void GenerateView_CSharpEmptyViewTemplate_OutputFileGeneratedUsingFileNamePassedToGenerator() |
||||
{ |
||||
CreateGenerator(); |
||||
ProjectPassedToGeneratorIsCSharpProject(); |
||||
|
||||
string viewFolder = @"d:\projects\MyProject\Views\Home"; |
||||
string viewName = "Index"; |
||||
GenerateView(viewFolder, viewName); |
||||
|
||||
string outputFileGenerated = fakeHost.OutputFilePassedToProcessTemplate; |
||||
string expectedOutputFileGenerated = |
||||
@"d:\projects\MyProject\Views\Home\Index.aspx"; |
||||
|
||||
Assert.AreEqual(expectedOutputFileGenerated, outputFileGenerated); |
||||
} |
||||
|
||||
[Test] |
||||
public void GenerateView_CSharpEmptyViewTemplate_TemplateFileUsedIsIsCSharpEmptyViewTemplate() |
||||
{ |
||||
string templateRootDirectory = @"d:\SharpDev\AddIns\AspNet.Mvc"; |
||||
CreateTemplateRepository(templateRootDirectory); |
||||
CreateGenerator(templateRepository); |
||||
ProjectPassedToGeneratorIsCSharpProject(); |
||||
|
||||
GenerateView(); |
||||
|
||||
string inputFileName = fakeHost.InputFilePassedToProcessTemplate; |
||||
string expectedInputFileName = |
||||
@"d:\SharpDev\AddIns\AspNet.Mvc\ItemTemplates\CSharp\CodeTemplates\AddView\AspxCSharp\Empty.tt"; |
||||
|
||||
Assert.AreEqual(expectedInputFileName, inputFileName); |
||||
} |
||||
|
||||
[Test] |
||||
public void GenerateView_CSharpEmptyViewTemplate_MvcTextTemplateHostViewNameIsSet() |
||||
{ |
||||
CreateGenerator(); |
||||
ProjectPassedToGeneratorIsCSharpProject(); |
||||
|
||||
string viewFolder = @"d:\projects\MyProject\Views\Home"; |
||||
string viewName = "About"; |
||||
GenerateView(viewFolder, viewName); |
||||
|
||||
Assert.AreEqual("About", fakeHost.ViewName); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,92 @@
@@ -0,0 +1,92 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.AspNet.Mvc; |
||||
using NUnit.Framework; |
||||
|
||||
namespace AspNet.Mvc.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class MvcViewFileNameTests |
||||
{ |
||||
MvcViewFileName mvcViewFileName; |
||||
|
||||
void CreateFileName() |
||||
{ |
||||
mvcViewFileName = new MvcViewFileName(); |
||||
} |
||||
|
||||
[Test] |
||||
public void ToString_ViewNameAndViewFolderSpecified_ReturnsViewFileNameGeneratedFromViewNameAndFolder() |
||||
{ |
||||
CreateFileName(); |
||||
mvcViewFileName.ViewName = "Index"; |
||||
mvcViewFileName.ViewFolder = @"d:\projects\MyAspProject\Views\About"; |
||||
|
||||
string fileName = mvcViewFileName.ToString(); |
||||
string expectedFileName = @"d:\projects\MyAspProject\Views\About\Index.aspx"; |
||||
|
||||
Assert.AreEqual(expectedFileName, fileName); |
||||
} |
||||
|
||||
[Test] |
||||
public void GetPath_ViewFolderIsNull_ReturnsViewFileNameUsingOnlyViewName() |
||||
{ |
||||
CreateFileName(); |
||||
mvcViewFileName.ViewFolder = null; |
||||
mvcViewFileName.ViewName = "Home"; |
||||
|
||||
string fileName = mvcViewFileName.GetPath(); |
||||
|
||||
Assert.AreEqual("Home.aspx", fileName); |
||||
} |
||||
|
||||
[Test] |
||||
public void GetPath_ViewNameIsNull_ReturnsView1AsFileNameAndUsesViewFolder() |
||||
{ |
||||
CreateFileName(); |
||||
mvcViewFileName.ViewFolder = @"d:\projects\MyProject\Views\Home"; |
||||
mvcViewFileName.ViewName = null; |
||||
|
||||
string fileName = mvcViewFileName.GetPath(); |
||||
string expectedFileName = @"d:\projects\MyProject\Views\Home\View1.aspx"; |
||||
|
||||
Assert.AreEqual(expectedFileName, fileName); |
||||
} |
||||
|
||||
[Test] |
||||
public void ViewName_ViewNameIsNull_ReturnsEmptyString() |
||||
{ |
||||
CreateFileName(); |
||||
mvcViewFileName.ViewName = null; |
||||
|
||||
string viewName = mvcViewFileName.ViewName; |
||||
|
||||
Assert.AreEqual(String.Empty, viewName); |
||||
} |
||||
|
||||
[Test] |
||||
public void ViewFolder_ViewFolderIsNull_ReturnsEmptyString() |
||||
{ |
||||
CreateFileName(); |
||||
mvcViewFileName.ViewFolder = null; |
||||
|
||||
string viewFolder = mvcViewFileName.ViewFolder; |
||||
|
||||
Assert.AreEqual(String.Empty, viewFolder); |
||||
} |
||||
|
||||
[Test] |
||||
public void GetFileName_ViewNameAndViewFolderSpecified_ReturnsViewNameWithExtensionButNoFolderPath() |
||||
{ |
||||
CreateFileName(); |
||||
mvcViewFileName.ViewFolder = @"d:\projects\myproject\Views"; |
||||
mvcViewFileName.ViewName = "Index"; |
||||
|
||||
string fileName = mvcViewFileName.GetFileName(); |
||||
|
||||
Assert.AreEqual("Index.aspx", fileName); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,81 @@
@@ -0,0 +1,81 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using AspNet.Mvc.Tests.Helpers; |
||||
using ICSharpCode.AspNet.Mvc; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using NUnit.Framework; |
||||
|
||||
namespace AspNet.Mvc.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class SelectedMvcViewFolderTests |
||||
{ |
||||
TestableSelectedMvcViewFolder selectedFolder; |
||||
DirectoryNode directoryNode; |
||||
TestableProject projectForSelectedFolder; |
||||
ProjectNode projectNode; |
||||
|
||||
void CreateSelectedFolder() |
||||
{ |
||||
CreateSelectedFolder(@"d:\projects\MyAspMvcApp\Views\Home"); |
||||
} |
||||
|
||||
void CreateSelectedFolder(string folder) |
||||
{ |
||||
projectForSelectedFolder = TestableProject.CreateProject(); |
||||
projectNode = new ProjectNode(projectForSelectedFolder); |
||||
|
||||
directoryNode = new DirectoryNode(folder); |
||||
directoryNode.AddTo(projectNode); |
||||
|
||||
selectedFolder = new TestableSelectedMvcViewFolder(directoryNode); |
||||
} |
||||
|
||||
[Test] |
||||
public void Path_DirectorySpecified_ReturnsDirectory() |
||||
{ |
||||
string expectedPath = @"d:\projects\MyAspMvcApp\Views\Home"; |
||||
CreateSelectedFolder(expectedPath); |
||||
|
||||
string path = selectedFolder.Path; |
||||
|
||||
Assert.AreEqual(expectedPath, path); |
||||
} |
||||
|
||||
[Test] |
||||
public void AddFileToProject_FileRelativePathPassed_FullPathIncludingViewFolderIsUsedToAddFile() |
||||
{ |
||||
CreateSelectedFolder(@"d:\projects\MyAspMvcApp\Views\About"); |
||||
selectedFolder.AddFileToProject("Index.aspx"); |
||||
|
||||
string fileNameAddedToProject = selectedFolder.PathPassedToAddNewFileToDirectoryNode; |
||||
string expectedFileNameAddedToProject = |
||||
@"d:\projects\MyAspMvcApp\Views\About\Index.aspx"; |
||||
|
||||
Assert.AreEqual(expectedFileNameAddedToProject, fileNameAddedToProject); |
||||
} |
||||
|
||||
[Test] |
||||
public void AddFileToProject_FilePassed_IsProjectSaved() |
||||
{ |
||||
CreateSelectedFolder(@"d:\projects\MyAspMvcApp\Views\About"); |
||||
selectedFolder.AddFileToProject("Index.aspx"); |
||||
|
||||
bool saved = projectForSelectedFolder.IsSaved; |
||||
|
||||
Assert.IsTrue(saved); |
||||
} |
||||
|
||||
[Test] |
||||
public void Project_DirectoryNodeHasParentProject_ReturnsProject() |
||||
{ |
||||
CreateSelectedFolder(); |
||||
|
||||
IProject project = selectedFolder.Project; |
||||
|
||||
Assert.AreEqual(projectForSelectedFolder, project); |
||||
} |
||||
} |
||||
} |
||||
Loading…
Reference in new issue