\r\n\t<%: Html.ActionLink(\"Edit\", \"Edit\") %> |\r\n\t<%: Html" + + ".ActionLink(\"Back\", \"Index\") %>\r\n
\r\n"); + + #line default + #line hidden + + #line 37 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\AspxCSharp\Details.tt" + + if (MvcHost.IsPartialView) { + // Do nothing. + } else if (MvcHost.IsContentPage) { + PopIndent(); + + + #line default + #line hidden + + #line 43 "D:\projects\dotnet\SharpDevelop.AspNetMvc\src\AddIns\BackendBindings\AspNet.Mvc\Project\ItemTemplates\CSharp\CodeTemplates\AddView\AspxCSharp\Details.tt" + this.Write("+ <%: Html.ActionLink("Edit", "Edit") %> | + <%: Html.ActionLink("Back", "Index") %> +
+<# + if (MvcHost.IsPartialView) { + // Do nothing. + } else if (MvcHost.IsContentPage) { + PopIndent(); +#> ++ <%: Html.ActionLink(""Edit"", ""Edit"") %> | + <%: Html.ActionLink(""Back"", ""Index"") %> +
+ + +"; + Assert.AreEqual(expectedOutput, output); + } + + [Test] + public void TransformText_ModelHasNoPropertiesAndIsPartialView_ReturnsControlWithFormAndFieldSetForModel() + { + CreateViewTemplatePreprocessor(); + mvcHost.IsPartialView = true; + Type modelType = typeof(ModelWithNoProperties); + mvcHost.ViewDataType = modelType; + mvcHost.ViewDataTypeName = modelType.FullName; + mvcHost.ViewName = "MyView"; + + string output = templatePreprocessor.TransformText(); + + string expectedOutput = +@"<%@ Control Language=""C#"" Inherits=""System.Web.Mvc.ViewUserControl+ <%: Html.ActionLink(""Edit"", ""Edit"") %> | + <%: Html.ActionLink(""Back"", ""Index"") %> +
+"; + Assert.AreEqual(expectedOutput, output); + } + + [Test] + public void TransformText_ModelHasNoPropertiesAndIsContentPage_ReturnsContentPageWithFormAndFieldSetForModel() + { + CreateViewTemplatePreprocessor(); + mvcHost.IsContentPage = true; + Type modelType = typeof(ModelWithNoProperties); + mvcHost.ViewDataType = modelType; + mvcHost.ViewDataTypeName = modelType.FullName; + mvcHost.ViewName = "MyView"; + mvcHost.MasterPageFile = "~/Views/Shared/Site.master"; + mvcHost.PrimaryContentPlaceHolderID = "Main"; + + string output = templatePreprocessor.TransformText(); + + string expectedOutput = +@"<%@ Page Language=""C#"" MasterPageFile=""~/Views/Shared/Site.master"" Inherits=""System.Web.Mvc.ViewPage+ <%: Html.ActionLink(""Edit"", ""Edit"") %> | + <%: Html.ActionLink(""Back"", ""Index"") %> +
+