diff --git a/Mvc.sln b/Mvc.sln index 5c1f9b359a..aa6260411f 100644 --- a/Mvc.sln +++ b/Mvc.sln @@ -112,6 +112,8 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "CompositeViewEngineWebSite" EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ValueProvidersWebSite", "test\WebSites\ValueProvidersWebSite\ValueProvidersWebSite.kproj", "{14F79E79-AE79-48FA-95DE-D794EF4EABB3}" EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "MvcTagHelpersWebSite", "test\WebSites\MvcTagHelpersWebSite\MvcTagHelpersWebSite.kproj", "{920F8A0E-6F7D-4BBE-84FF-840B89099BE6}" +EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ActionResultsWebSite", "test\WebSites\ActionResultsWebSite\ActionResultsWebSite.kproj", "{0A6BB4C0-48D3-4E7F-952B-B8917345E075}" EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "LoggingWebSite", "test\WebSites\LoggingWebSite\LoggingWebSite.kproj", "{0AD78AB5-D67C-49BC-81B1-0C51BFA82B5E}" @@ -612,6 +614,18 @@ Global {14F79E79-AE79-48FA-95DE-D794EF4EABB3}.Release|Mixed Platforms.Build.0 = Release|Any CPU {14F79E79-AE79-48FA-95DE-D794EF4EABB3}.Release|x86.ActiveCfg = Release|Any CPU {14F79E79-AE79-48FA-95DE-D794EF4EABB3}.Release|x86.Build.0 = Release|Any CPU + {920F8A0E-6F7D-4BBE-84FF-840B89099BE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {920F8A0E-6F7D-4BBE-84FF-840B89099BE6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {920F8A0E-6F7D-4BBE-84FF-840B89099BE6}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {920F8A0E-6F7D-4BBE-84FF-840B89099BE6}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {920F8A0E-6F7D-4BBE-84FF-840B89099BE6}.Debug|x86.ActiveCfg = Debug|Any CPU + {920F8A0E-6F7D-4BBE-84FF-840B89099BE6}.Debug|x86.Build.0 = Debug|Any CPU + {920F8A0E-6F7D-4BBE-84FF-840B89099BE6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {920F8A0E-6F7D-4BBE-84FF-840B89099BE6}.Release|Any CPU.Build.0 = Release|Any CPU + {920F8A0E-6F7D-4BBE-84FF-840B89099BE6}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {920F8A0E-6F7D-4BBE-84FF-840B89099BE6}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {920F8A0E-6F7D-4BBE-84FF-840B89099BE6}.Release|x86.ActiveCfg = Release|Any CPU + {920F8A0E-6F7D-4BBE-84FF-840B89099BE6}.Release|x86.Build.0 = Release|Any CPU {0A6BB4C0-48D3-4E7F-952B-B8917345E075}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0A6BB4C0-48D3-4E7F-952B-B8917345E075}.Debug|Any CPU.Build.0 = Debug|Any CPU {0A6BB4C0-48D3-4E7F-952B-B8917345E075}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -690,6 +704,7 @@ Global {B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} {A853B2BA-4449-4908-A416-5A3C027FC22B} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} {14F79E79-AE79-48FA-95DE-D794EF4EABB3} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} + {920F8A0E-6F7D-4BBE-84FF-840B89099BE6} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} {0A6BB4C0-48D3-4E7F-952B-B8917345E075} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} {0AD78AB5-D67C-49BC-81B1-0C51BFA82B5E} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C} EndGlobalSection diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/AntiForgeryTestHelper.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/AntiForgeryTestHelper.cs index ed11373ee0..d5b4377f86 100644 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/AntiForgeryTestHelper.cs +++ b/test/Microsoft.AspNet.Mvc.FunctionalTests/AntiForgeryTestHelper.cs @@ -25,8 +25,10 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests { foreach (var input in form.Descendants("input")) { - if (input.Attributes("name").First().Value == "__RequestVerificationToken" && - input.Attributes("type").First().Value == "hidden") + if (input.Attribute("name") != null && + input.Attribute("type") != null && + input.Attribute("name").Value == "__RequestVerificationToken" && + input.Attribute("type").Value == "hidden") { return input.Attributes("value").First().Value; } diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/Compiler/Resources/MvcTagHelpersWebSite.MvcTagHelper_Customer.Index.html b/test/Microsoft.AspNet.Mvc.FunctionalTests/Compiler/Resources/MvcTagHelpersWebSite.MvcTagHelper_Customer.Index.html new file mode 100644 index 0000000000..22b7b20f68 --- /dev/null +++ b/test/Microsoft.AspNet.Mvc.FunctionalTests/Compiler/Resources/MvcTagHelpersWebSite.MvcTagHelper_Customer.Index.html @@ -0,0 +1,44 @@ + + + + + +
+
+ + + A value is required. +
+
+ + +
+
+ + + +
+
+ + +
+
+ + + The Password field is required. +
+
+ + Male + Female + +
+
+
+ +
+ + \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/Compiler/Resources/MvcTagHelpersWebSite.MvcTagHelper_Home.Customer.html b/test/Microsoft.AspNet.Mvc.FunctionalTests/Compiler/Resources/MvcTagHelpersWebSite.MvcTagHelper_Home.Customer.html new file mode 100644 index 0000000000..6ba3d0ffc8 --- /dev/null +++ b/test/Microsoft.AspNet.Mvc.FunctionalTests/Compiler/Resources/MvcTagHelpersWebSite.MvcTagHelper_Home.Customer.html @@ -0,0 +1,42 @@ + + + + + +
+
+ + + +
+
+ + +
+
+ + + +
+
+ + +
+
+ + + +
+
+ + Male + Female + +
+
+
+ +
+ + \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/Compiler/Resources/MvcTagHelpersWebSite.MvcTagHelper_Home.Index.html b/test/Microsoft.AspNet.Mvc.FunctionalTests/Compiler/Resources/MvcTagHelpersWebSite.MvcTagHelper_Home.Index.html new file mode 100644 index 0000000000..a40ea80fa0 --- /dev/null +++ b/test/Microsoft.AspNet.Mvc.FunctionalTests/Compiler/Resources/MvcTagHelpersWebSite.MvcTagHelper_Home.Index.html @@ -0,0 +1,76 @@ + + + + + +
+ Product Index +
+
+ Product List +
+
+ MvcTagHelperTest Index +
+
+ Default Controller +
+
+ Product Index Fragment +
+
+ Produt Submit Fragment +
+
+ + MvcTagHelperTest Index Fragment + +
+
+ + FTP MvcTagHelperTest Index Fragment + +
+
+ + Unknown Protocol Product List + +
+
+ + Empty Protocol MvcTagHelperTest Index + +
+
+ Customer Area Customer Index +
+
+ Href Order List +
+
+ Non-existent Controller +
+
+ + Non-existent Controller Fragment + +
+
+ Non-existent Action +
+
+ Some Where +
+
+ + Unknown Protocol Non-existent Controller Fragment + +
+
+ Product Route Non-existent Area Parameter +
+
+ Non-existent Area +
+ + \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/Compiler/Resources/MvcTagHelpersWebSite.MvcTagHelper_Home.Order.html b/test/Microsoft.AspNet.Mvc.FunctionalTests/Compiler/Resources/MvcTagHelpersWebSite.MvcTagHelper_Home.Order.html new file mode 100644 index 0000000000..04a01ad1f8 --- /dev/null +++ b/test/Microsoft.AspNet.Mvc.FunctionalTests/Compiler/Resources/MvcTagHelpersWebSite.MvcTagHelper_Home.Order.html @@ -0,0 +1,79 @@ + + + + + + + + + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + + +
+
+ + +
+
+ + + +
+
+ + +
+
+ + + +
+
+ + Male + Female + +
+
+ + +
+ + \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/Compiler/Resources/MvcTagHelpersWebSite.MvcTagHelper_Home.Product.html b/test/Microsoft.AspNet.Mvc.FunctionalTests/Compiler/Resources/MvcTagHelpersWebSite.MvcTagHelper_Home.Product.html new file mode 100644 index 0000000000..7bffe7572d --- /dev/null +++ b/test/Microsoft.AspNet.Mvc.FunctionalTests/Compiler/Resources/MvcTagHelpersWebSite.MvcTagHelper_Home.Product.html @@ -0,0 +1,23 @@ + + + + + + + + + +
+
+ + +
+
+ + +
+ +
+ + \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/MvcTagHelpersTests.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/MvcTagHelpersTests.cs new file mode 100644 index 0000000000..7407bb7887 --- /dev/null +++ b/test/Microsoft.AspNet.Mvc.FunctionalTests/MvcTagHelpersTests.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Reflection; +using System.Threading.Tasks; +using Microsoft.AspNet.Builder; +using Microsoft.AspNet.TestHost; +using MvcTagHelpersWebSite; +using Xunit; + +namespace Microsoft.AspNet.Mvc.FunctionalTests +{ + public class MvcTagHelpersTests + { + private readonly IServiceProvider _provider = TestHelper.CreateServices("MvcTagHelpersWebSite"); + private readonly Action _app = new Startup().Configure; + private static readonly Assembly _resourcesAssembly = typeof(TagHelpersTests).GetTypeInfo().Assembly; + + [Theory] + [InlineData("Index", null)] + [InlineData("Order", "/MvcTagHelper_Order/Submit")] + [InlineData("Product", null)] + [InlineData("Customer", "/Customer/MvcTagHelper_Customer")] + public async Task MvcTagHelpers_GeneratesExpectedResults(string action, string antiForgeryPath) + { + // Arrange + var server = TestServer.Create(_provider, _app); + var client = server.CreateClient(); + var expectedMediaType = MediaTypeHeaderValue.Parse("text/html; charset=utf-8"); + + // The K runtime compiles every file under compiler/resources as a resource at runtime with the same name + // as the file name, in order to update a baseline you just need to change the file in that folder. + var expectedContent = + await _resourcesAssembly.ReadResourceAsStringAsync + ("compiler/resources/MvcTagHelpersWebSite.MvcTagHelper_Home." + action + ".html"); + + // Act + // The host is not important as everything runs in memory and tests are isolated from each other. + var response = await client.GetAsync("http://localhost/MvcTagHelper_Home/" + action); + var responseContent = await response.Content.ReadAsStringAsync(); + + // Assert + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + Assert.Equal(expectedMediaType, response.Content.Headers.ContentType); + + if (antiForgeryPath != null) + { + var forgeryToken = AntiForgeryTestHelper.RetrieveAntiForgeryToken(responseContent, antiForgeryPath); + expectedContent = string.Format(expectedContent, forgeryToken); + } + Assert.Equal(expectedContent.Trim(), responseContent.Trim()); + } + + [Fact] + public async Task ValidationTagHelpers_GeneratesExpectedSpansAndDivs() + { + // Arrange + var server = TestServer.Create(_provider, _app); + var client = server.CreateClient(); + var expectedContent = + await _resourcesAssembly.ReadResourceAsStringAsync + ("compiler/resources/MvcTagHelpersWebSite.MvcTagHelper_Customer.Index.html"); + + var request = new HttpRequestMessage(HttpMethod.Post, "http://localhost/Customer/MvcTagHelper_Customer"); + var nameValueCollection = new List> + { + new KeyValuePair("Number", string.Empty), + new KeyValuePair("Name", string.Empty), + new KeyValuePair("Email", string.Empty), + new KeyValuePair("PhoneNumber", string.Empty), + new KeyValuePair("Password", string.Empty) + }; + request.Content = new FormUrlEncodedContent(nameValueCollection); + + // Act + var response = await client.SendAsync(request); + var responseContent = await response.Content.ReadAsStringAsync(); + + // Assert + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + + var forgeryToken = AntiForgeryTestHelper.RetrieveAntiForgeryToken(responseContent, "Customer/MvcTagHelper_Customer"); + expectedContent = string.Format(expectedContent, forgeryToken); + Assert.Equal(expectedContent.Trim(), responseContent.Trim()); + } + } +} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/project.json b/test/Microsoft.AspNet.Mvc.FunctionalTests/project.json index 6b889106c6..a9669ca8df 100644 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/project.json +++ b/test/Microsoft.AspNet.Mvc.FunctionalTests/project.json @@ -35,6 +35,7 @@ "WebApiCompatShimWebSite": "1.0.0", "Microsoft.AspNet.TestHost": "1.0.0-*", "Microsoft.AspNet.Mvc.TestConfiguration": "1.0.0", + "MvcTagHelpersWebSite": "1.0.0", "Microsoft.Framework.ConfigurationModel.Json": "1.0.0-*", "xunit.runner.kre": "1.0.0-*", "Microsoft.AspNet.WebUtilities": "1.0.0-*" diff --git a/test/WebSites/MvcTagHelpersWebSite/Areas/Customer/Controllers/MvcTagHelper_CustomerController.cs b/test/WebSites/MvcTagHelpersWebSite/Areas/Customer/Controllers/MvcTagHelper_CustomerController.cs new file mode 100644 index 0000000000..f4c23ee962 --- /dev/null +++ b/test/WebSites/MvcTagHelpersWebSite/Areas/Customer/Controllers/MvcTagHelper_CustomerController.cs @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using Microsoft.AspNet.Mvc; + +namespace MvcTagHelpersWebSite.Areas.Customer.Controllers +{ + [Area("Customer")] + public class MvcTagHelper_CustomerController : Controller + { + public IActionResult Index(MvcTagHelpersWebSite.Models.Customer customer) + { + return View("Customer"); + } + } +} \ No newline at end of file diff --git a/test/WebSites/MvcTagHelpersWebSite/Controllers/MvcTagHelper_HomeController.cs b/test/WebSites/MvcTagHelpersWebSite/Controllers/MvcTagHelper_HomeController.cs new file mode 100644 index 0000000000..bd0dad40de --- /dev/null +++ b/test/WebSites/MvcTagHelpersWebSite/Controllers/MvcTagHelper_HomeController.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.AspNet.Mvc; +using Microsoft.AspNet.Mvc.Rendering; +using MvcTagHelpersWebSite.Models; + +namespace MvcTagHelpersWebSite.Controllers +{ + public class MvcTagHelper_HomeController : Controller + { + public IActionResult Order() + { + var products = new List(); + products = new List(); + + for (int i = 7; i < 13; ++i) + { + products.Add(new Product() + { + ProductName = "Product_" + i, + Number = i, + PartNumbers = Enumerable.Range(1, 3).Select(n => string.Format("{0}-{1}", i, n)) + }); + } + + ViewBag.Items = new SelectList(products, "Number", "ProductName", 9); + + var order = new Order() + { + Shipping = "UPSP", + Customer = new Customer() + { + Key = "KeyA", + Number = 1, + Gender = Gender.Female, + Name = "NameStringValue", + }, + NeedSpecialHandle = true, + PaymentMethod = new List { "Check" } + }; + + return View(order); + } + + public IActionResult Product() + { + var product = new Product() + { + HomePage = new System.Uri("http://www.contoso.com"), + Description = "Type the product description" + }; + return View(product); + } + + public IActionResult ProductSubmit(Product product) + { + throw new NotImplementedException(); + } + + public IActionResult Customer() + { + return View(); + } + + public IActionResult Index() + { + return View(); + } + } +} diff --git a/test/WebSites/MvcTagHelpersWebSite/Controllers/MvcTagHelper_OrderController.cs b/test/WebSites/MvcTagHelpersWebSite/Controllers/MvcTagHelper_OrderController.cs new file mode 100644 index 0000000000..63870408ed --- /dev/null +++ b/test/WebSites/MvcTagHelpersWebSite/Controllers/MvcTagHelper_OrderController.cs @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using Microsoft.AspNet.Mvc; +using MvcTagHelpersWebSite.Models; + +namespace MvcTagHelpersWebSite.Controllers +{ + public class MvcTagHelper_OrderController : Controller + { + public IActionResult Submit(Order order) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/test/WebSites/MvcTagHelpersWebSite/Controllers/MvcTagHelper_ProductController.cs b/test/WebSites/MvcTagHelpersWebSite/Controllers/MvcTagHelper_ProductController.cs new file mode 100644 index 0000000000..71b891d6ed --- /dev/null +++ b/test/WebSites/MvcTagHelpersWebSite/Controllers/MvcTagHelper_ProductController.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using Microsoft.AspNet.Mvc; +using MvcTagHelpersWebSite.Models; + +namespace MvcTagHelpersWebSite.Controllers +{ + public class MvcTagHelper_ProductController : Controller + { + public IActionResult Index() + { + throw new NotImplementedException(); + } + + public IActionResult Submit(Product product) + { + throw new NotImplementedException(); + } + + public IActionResult List() + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/test/WebSites/MvcTagHelpersWebSite/Models/Customer.cs b/test/WebSites/MvcTagHelpersWebSite/Models/Customer.cs new file mode 100644 index 0000000000..682b2a0c23 --- /dev/null +++ b/test/WebSites/MvcTagHelpersWebSite/Models/Customer.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.ComponentModel.DataAnnotations; + +namespace MvcTagHelpersWebSite.Models +{ + public class Customer + { + [Range(1, 100)] + public int Number + { + get; + set; + } + + public string Key + { + get; + set; + } + + public string Name + { + get; + set; + } + + [Required] + public string Password + { + get; + set; + } + + [EnumDataType(typeof(Gender))] + public Gender Gender + { + get; + set; + } + + public string PhoneNumber + { + get; + set; + } + + [DataType(DataType.EmailAddress)] + public string Email + { + get; + set; + } + } +} \ No newline at end of file diff --git a/test/WebSites/MvcTagHelpersWebSite/Models/Gender.cs b/test/WebSites/MvcTagHelpersWebSite/Models/Gender.cs new file mode 100644 index 0000000000..2ce966e4a1 --- /dev/null +++ b/test/WebSites/MvcTagHelpersWebSite/Models/Gender.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace MvcTagHelpersWebSite.Models +{ + public enum Gender + { + Male, + Female + } +} \ No newline at end of file diff --git a/test/WebSites/MvcTagHelpersWebSite/Models/Order.cs b/test/WebSites/MvcTagHelpersWebSite/Models/Order.cs new file mode 100644 index 0000000000..8878234937 --- /dev/null +++ b/test/WebSites/MvcTagHelpersWebSite/Models/Order.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; + +namespace MvcTagHelpersWebSite.Models +{ + public class Order + { + public bool NeedSpecialHandle + { + get; + set; + } + + public int OrderNumber + { + get; + set; + } + + public DateTimeOffset OrderDate + { + get; + set; + } + + public ICollection PaymentMethod + { + get; + set; + } + + public DateTime ShippingDateTime + { + get; + set; + } + + public string Shipping + { + get; + set; + } + + public IEnumerable Products + { + get; + set; + } + + public Customer Customer + { + get; + set; + } + } +} \ No newline at end of file diff --git a/test/WebSites/MvcTagHelpersWebSite/Models/Product.cs b/test/WebSites/MvcTagHelpersWebSite/Models/Product.cs new file mode 100644 index 0000000000..bdf4db8030 --- /dev/null +++ b/test/WebSites/MvcTagHelpersWebSite/Models/Product.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; + +namespace MvcTagHelpersWebSite.Models +{ + public class Product + { + [Required] + public string ProductName + { + get; + set; + } + + public int Number + { + get; + set; + } + + public string Description + { + get; + set; + } + + public IEnumerable PartNumbers + { + get; + set; + } + + public Uri HomePage + { + get; + set; + } + } +} \ No newline at end of file diff --git a/test/WebSites/MvcTagHelpersWebSite/MvcTagHelpersWebSite.kproj b/test/WebSites/MvcTagHelpersWebSite/MvcTagHelpersWebSite.kproj new file mode 100644 index 0000000000..b0d0f0b700 --- /dev/null +++ b/test/WebSites/MvcTagHelpersWebSite/MvcTagHelpersWebSite.kproj @@ -0,0 +1,29 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + 920f8a0e-6f7d-4bbe-84ff-840b89099be6 + ..\..\..\artifacts\obj\$(MSBuildProjectName) + ..\..\..\artifacts\bin\$(MSBuildProjectName)\ + + + MvcTagHelpersWebSite + + + MvcTagHelpersWebSite + + + 2.0 + 49646 + + + + + + + + \ No newline at end of file diff --git a/test/WebSites/MvcTagHelpersWebSite/Startup.cs b/test/WebSites/MvcTagHelpersWebSite/Startup.cs new file mode 100644 index 0000000000..067828ecdf --- /dev/null +++ b/test/WebSites/MvcTagHelpersWebSite/Startup.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.AspNet.Builder; +using Microsoft.AspNet.Routing; +using Microsoft.Framework.DependencyInjection; + +namespace MvcTagHelpersWebSite +{ + public class Startup + { + public void Configure(IApplicationBuilder app) + { + var configuration = app.GetTestConfiguration(); + + app.UseServices(services => + { + services.AddMvc(configuration); + }); + + app.UseMvc(routes => + { + routes.MapRoute( + name: "default", + template: "{controller}/{action}/{id?}", + defaults: new { controller = "MvcTagHelper_Home", action = "Index" }); + routes.MapRoute( + name: "areaRoute", + template: "{area:exists}/{controller}/{action}/{id?}", + defaults: new { action = "Index" }); + routes.MapRoute( + name: "productRoute", + template: "Product/{action}", + defaults: new { controller = "Product" }); + }); + } + } +} diff --git a/test/WebSites/MvcTagHelpersWebSite/Views/MvcTagHelper_Home/Index.cshtml b/test/WebSites/MvcTagHelpersWebSite/Views/MvcTagHelper_Home/Index.cshtml new file mode 100644 index 0000000000..c6db4ade18 --- /dev/null +++ b/test/WebSites/MvcTagHelpersWebSite/Views/MvcTagHelper_Home/Index.cshtml @@ -0,0 +1,91 @@ +@{ + ViewBag.Title = "Home Page"; +} + +@addtaghelper "Microsoft.AspNet.Mvc.TagHelpers.AnchorTagHelper, Microsoft.AspNet.Mvc.TagHelpers" + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/WebSites/MvcTagHelpersWebSite/Views/MvcTagHelper_Home/Order.cshtml b/test/WebSites/MvcTagHelpersWebSite/Views/MvcTagHelper_Home/Order.cshtml new file mode 100644 index 0000000000..cf5c51fd0c --- /dev/null +++ b/test/WebSites/MvcTagHelpersWebSite/Views/MvcTagHelper_Home/Order.cshtml @@ -0,0 +1,83 @@ +@model MvcTagHelpersWebSite.Models.Order + +@{ + ViewBag.Title = "Order Page"; +} + +@addtaghelper "Microsoft.AspNet.Mvc.TagHelpers.FormTagHelper, Microsoft.AspNet.Mvc.TagHelpers" +@addtaghelper "Microsoft.AspNet.Mvc.TagHelpers.InputTagHelper, Microsoft.AspNet.Mvc.TagHelpers" +@addtaghelper "Microsoft.AspNet.Mvc.TagHelpers.LabelTagHelper, Microsoft.AspNet.Mvc.TagHelpers" +@addtaghelper "Microsoft.AspNet.Mvc.TagHelpers.OptionTagHelper, Microsoft.AspNet.Mvc.TagHelpers" +@addtaghelper "Microsoft.AspNet.Mvc.TagHelpers.SelectTagHelper, Microsoft.AspNet.Mvc.TagHelpers" +@addtaghelper "Microsoft.AspNet.Mvc.TagHelpers.ValidationMessageTagHelper, Microsoft.AspNet.Mvc.TagHelpers" +@addtaghelper "Microsoft.AspNet.Mvc.TagHelpers.ValidationSummaryTagHelper, Microsoft.AspNet.Mvc.TagHelpers" + + + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + + + \ No newline at end of file diff --git a/test/WebSites/MvcTagHelpersWebSite/Views/MvcTagHelper_Home/Product.cshtml b/test/WebSites/MvcTagHelpersWebSite/Views/MvcTagHelper_Home/Product.cshtml new file mode 100644 index 0000000000..559af73824 --- /dev/null +++ b/test/WebSites/MvcTagHelpersWebSite/Views/MvcTagHelper_Home/Product.cshtml @@ -0,0 +1,27 @@ +@model MvcTagHelpersWebSite.Models.Product + +@{ + ViewBag.Title = "Product Page"; +} + +@addtaghelper "Microsoft.AspNet.Mvc.TagHelpers" + + + + + + + +
+
+
+
+